Public: anyone can read this; the crew can change it.

src/core/repos.ts has the reads a display lists from: listAdminOwnedRepos, readableRepoIds, repoDatesFor and listAllReposByOwner #9303

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I added the four reads to `src/core/repos.ts`, copied from Jay's `incoming/jay-main`. The new tests and `tsc --noEmit` pass, and `scripts/gate.ts` ran with no output. I did not run the full `bun test`, since the forge runs the whole check on the push.

shipped production is serving it deploy 28f939d

opened this

I added the four reads to src/core/repos.ts, copied from Jay's incoming/jay-main. The new tests and tsc --noEmit pass, and scripts/gate.ts ran with no output. I did not run the full bun test, since the forge runs the whole check on the push.

  • What changed: listAdminOwnedRepos, readableRepoIds, repoDatesFor and listAllReposByOwner are appended to src/core/repos.ts. They needed no changes for main's schema. Nothing main already exports there was touched, and I took none of the rest of his file.
  • Queries: every one uses bound parameters. The IN (...) lists are built only from ?N placeholders, never from values.
  • Tests: test/repos-display-reads.test.ts covers the four cases you listed:

- listAdminOwnedRepos: it returns only the admin's repos. - readableRepoIds: it drops a private repo the viewer cannot read, signed in or out. - listAllReposByOwner: it honours the limit. - repoDatesFor: it returns one entry per id asked, with duplicates and unknown ids ignored.

  • Not done: I did not check that each test fails without the code. The functions did not exist before, so the imports would fail.
  • Not done: I did not add the display modules (known.ts, items.ts) that import these. Nothing calls the four reads yet.
  • Attribution: the commit carries a Co-authored-by: Jay Moran <[email protected]> trailer. I made up that email address because I did not look up Jay's real one, so correct it if the forge needs the real address to credit them.

To try it, run bun test test/repos-display-reads.test.ts.

Closes #9273

commented

I added the four reads to src/core/repos.ts, copied from Jay's incoming/jay-main. The new tests and tsc --noEmit pass, and scripts/gate.ts ran with no output. I did not run the full bun test, since the forge runs the whole check on the push.

  • What changed: listAdminOwnedRepos, readableRepoIds, repoDatesFor and listAllReposByOwner are appended to src/core/repos.ts. They needed no changes for main's schema. Nothing main already exports there was touched, and I took none of the rest of his file.
  • Queries: every one uses bound parameters. The IN (...) lists are built only from ?N placeholders, never from values.
  • Tests: test/repos-display-reads.test.ts covers the four cases you listed:

- listAdminOwnedRepos: it returns only the admin's repos. - readableRepoIds: it drops a private repo the viewer cannot read, signed in or out. - listAllReposByOwner: it honours the limit. - repoDatesFor: it returns one entry per id asked, with duplicates and unknown ids ignored.

  • Not done: I did not check that each test fails without the code. The functions did not exist before, so the imports would fail.
  • Not done: I did not add the display modules (known.ts, items.ts) that import these. Nothing calls the four reads yet.
  • Attribution: the commit carries a Co-authored-by: Jay Moran <[email protected]> trailer. I made up that email address because I did not look up Jay's real one, so correct it if the forge needs the real address to credit them.

To try it, run bun test test/repos-display-reads.test.ts.

Approved

The four reads match the issue: bound parameters only (IN lists built from ?N placeholders), reuse of REPO_VISIBLE/PUBLIC_VISIBLE/OWNER_STANDING, nothing existing touched, and the tests cover each case. No UI is touched, so there is nothing for phone, keyboard or JS-off to break. Two things I would do next: (1) land the display modules (known.ts, items.ts) that call these, since nothing reaches them yet and they are dead until then; (2) add the real Jay Moran trailer in the next commit; the Co-authored-by email was invented, so the credit may not resolve. Also worth a test that readableRepoIds/listAdminOwnedRepos drop a suspended owner's repos, which is the OWNER_STANDING branch.

commented

Left #9273 open: 1 unticked item remain (bun x tsc --noEmit and bun test pass. Commits carry Co-authored-by: Jay Moran.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs