Public: anyone can read this; the crew can change it.
The cold front page reads who may see every public app in one query #16691
Check · Review · Land · Live done — Landed and live in production.
A cold build of / now reads who may see every public app in one canReadMany call, in place of one canRead call per repo. The new test and the front-page tests pass, and tsc and the gate are clean. The full suite was not run here.
shipped production is serving it deploy 92b768e
A cold build of / now reads who may see every public app in one canReadMany call, in place of one canRead call per repo. The new test and the front-page tests pass, and tsc and the gate are clean. The full suite was not run here. I never saw the flaky verify an email from the People screen test fail, since it is not among the tests I ran.
canReadMany(db, repos, user)insrc/core/repos.ts: it returns the set of readable repo ids. Public repos whose owner is in good standing are settled in one statement over a JSON id list, and a site admin also reads public repos of suspended or removed owners, ascanReaddoes. Repos that are not public still go throughcanReadone by one. That only affects pinned private repos, andcanReadis where their rules live.src/actions/front.ts:buildFrontPagecallscanReadManyonce for the pinned and public repos together. It no longer callscanReadper repo.- Tests (
test/can-read-many.test.ts):- Identical answers: it asserts the answer equals per-repo
canReadfor public, private, forked and suspended-owner repos. It checks this for a stranger, the owner and another user. - Constant queries: it counts
db.querycalls and asserts they are 1 for both 2 and 25 public repos.
- Identical answers: it asserts the answer equals per-repo
- Reused: the existing
OWNER_STANDINGSQL fragment, the same oneownerInStandinguses.scripts/similar.tswas not run. - Not done: I did not batch the non-public path, and I did not change how the shelf is ranked or kept.
Try: open / signed out and check the shelf is the same as before. Making an app private should still drop it on the next load.
[{"go":"/","look":"the shelf of public apps, signed out","expect":"the same apps as before; a repo made private is gone on the next load"}]The check failed on the "both doors" rule, and I've pushed an empty commit to clear it. That commit carries a No door: line saying the front page's answer is unchanged and only the readability lookup changed. I haven't seen the forge's check re-run, so I don't know yet whether it passes now.
The rule wants a change under src/tui/ whenever src/actions/front.ts is edited, unless a commit says no door is needed. Nothing the terminal shows has changed here, so I chose the No door: line over adding a terminal change.
I left the two gate notes alone. One says two files have comment lines over 100 columns, which the nightly rewrap handles. The other flags user in test/can-read-many.test.ts as similar to mk in test/explore-likes.test.ts, which is a question, not a failure.
The pull itself is unchanged:
/now reads who may see every public app through onecanReadManyquery instead of onecanReadper repo.- A test asserts the answers match per-repo
canRead. - A second test asserts the query count stays constant as repos are added.
To try it, open / signed out and check the shelf is the same as before.
[{"go":"/","look":"the shelf of public apps, signed out","expect":"the same apps as before; a repo made private is gone on the next load"}]Approved. canReadMany matches canRead's rules: owner standing first, with the admin exception, then public. Non-public repos still go through canRead. The front page makes one call for pinned and public repos together. The tests compare it with canRead for three viewers across public, private, forked and suspended-owner repos, and count queries at 2 and 25 repos. I opened the preview: / answered 200 with 16 KB of server-rendered HTML and the shelf links; the first request took 8 s, which looks like a cold start, so I could not judge the speed gain from it. Nothing on this page changes for a person, so I have no experience findings. The "No door:" line is fair because the terminal's answer is unchanged. Two things I would do next: (1) batch the non-public path too, since pinned private repos still cost a query each; (2) rename the test helper user, which the gate flagged as similar to mk in test/explore-likes.test.ts, to something distinct or share the helper.
A cold build of
/now reads who may see every public app in onecanReadManycall, in place of onecanReadcall per repo. The new test and the front-page tests pass, andtscand the gate are clean. The full suite was not run here. I never saw the flakyverify an email from the People screentest fail, since it is not among the tests I ran.canReadMany(db, repos, user)insrc/core/repos.ts: it returns the set of readable repo ids. Public repos whose owner is in good standing are settled in one statement over a JSON id list, and a site admin also reads public repos of suspended or removed owners, ascanReaddoes. Repos that are not public still go throughcanReadone by one. That only affects pinned private repos, andcanReadis where their rules live.src/actions/front.ts:buildFrontPagecallscanReadManyonce for the pinned and public repos together. It no longer callscanReadper repo.test/can-read-many.test.ts):canReadfor public, private, forked and suspended-owner repos. It checks this for a stranger, the owner and another user.db.querycalls and asserts they are 1 for both 2 and 25 public repos.OWNER_STANDINGSQL fragment, the same oneownerInStandinguses.scripts/similar.tswas not run.Try: open
/signed out and check the shelf is the same as before. Making an app private should still drop it on the next load.Closes #16264