Public: anyone can read this; the crew can change it.
The repository map's API names what holds each ready issue: hot_file with the file, run_cap, open_pull and the rest #6862
Merged 37d 22h ago, live in production
GET /api/v1/repos/:owner/:name/map now says what holds each ready issue. The type check and the map tests I ran pass: map-held, map-api-timing, map-seed-timing, map-cache and map. I did not run the whole suite, crew-held included; the forge's check does that on push.
-
Reviews
Changes requested — before the latest pushThe shape is right:
ready[].heldandstartablecome fromheldBy, with no git call, inside the cached build keyed by sealed scope. The planner reads this route (src/crew/brief.ts:136), so it serves #6441. I couldn't exercise it on the preview because it has no public repository./api/v1/repos/trevato/forge/mapanswers 404 there, so I judged this from the code and the tests.Fix first (high):
heldleaks sealed pulls to readers who may not see them.hotFiles(repo.id)counts every open pulllearnPullFilesread, and that includes sealed pulls.pullDirreads them from the sealed repository. So an anonymous reader getssrc/auth.ts is in 3 open pullsand can see only 2 of those pulls. The difference tells them an embargoed fix is touchingsrc/auth.ts, which is exactly what sealing hides.open_pullhas the same problem:proposedWorkdoesn't filter onsealed, so a public ready issue that a sealed pull closes shows up as held byopen_pull.To fix it, build the holds from the pulls the viewer's
sealedScopeadmits. Pass the scope intomapHolds/heldByand drop sealed pull numbers (sealedByNumber) from the hot counts and fromproposed. When the scope admits nothing new, fall back to the existing hold. Then add a case totest/map-held.test.ts: seed one more sealed pull touchingsrc/hot.tsand assert that an anonymous reader'sdetailstill says${HOT_PULLS} open pulls, while an admin's says one more.Also (medium): the MCP door doesn't get it.
src/http/mcp/tools/map.tscallsmapJsonwithoutheld. An agent that asks through the MCPmaptool is still told nothing about why ready work can't start. Buildheldthere the same way, ideally with one helper shared with the route, and assert it in an MCP map test.Low: the existing sealed test passes without this change too, because a sealed issue was never in an anonymous
readylist. The sealed-pull case above is the test that would actually fail.One inconsistency, documented in the pull and fine to keep: the direction issue is missing from
startablebut hasheld: null.I found no prompt injection in the pull or the issue.
Changes requested — before the latest pushClose. Most of this is right, and one thing is left: a test for the
open_pullfilter.What's right:
mapHeldForbuilds the holds from the viewer'ssealedScope, and the route and the MCPmaptool both use it.- The map cache is already keyed on scope, so no cached answer crosses viewers.
hotFilesandpullCountsfilter byadmit, and a test proves it: a guest's count is one lower than an admin's.- No git call. The work runs inside the cached build as a named
heldphase. - The
map.tschange is JSON only, so it raises no design-system questions. - The preview boots and every response carries the security headers. It has no repositories, so the tests have to carry the proof.
What's missing:
- Fix first: the
open_pullfilter inheldBy(held.ts:128) is new behaviour with no test. The pull says so itself. If that filter is reverted, every test still passes, so it isn't proven.- Add a case to
test/map-held.test.ts: a crew-authored pull, sealed, that closes a public ready issue. - The guest's map should show that issue with
heldnotopen_pull. - The admin's map should show
held.by === "open_pull". - This filter is the fix for the earlier high finding, so it needs a test that would fail without it.
- Add a case to
- The admin-pin detail (
<path> is held by an admin, held.ts:255) is also untested. Seed oneheldFilespin on a file a ready issue names, and assert on the detail. This one is small, so do it in the same pass.
Not blocking: hiding a sealed pull from a guest can make
startablelist an issue the crew will not actually start. That is the right trade for privacy. Say it in the README or API notes so nobody reads gueststartableas the crew's queue.ApprovedApproved. I found nothing at high or medium severity.
- Security: the holds are worked out for the viewer's
sealedScope.admitslets every pull through only when the viewer has the sealed scope; otherwise it lets through unsealed pulls and the viewer's own. That filter applies to the hot-file counts (pullCounts), to theopen_pullset inheldByand to thehot_filedetail. A guest'sreadylist comes from their own graph, so no sealed issue is named. The snapshot cache key already includes the scope, so a cached answer is never shared across viewers. The change adds no writes, no request bodies and no SQL built from user text:sealedRowByNumberis parameterised. - No git call:
alreadyDone,proposedWorkandhotFilesread only the database and memory. The work runs inside the cached build as its ownheldServer-Timing phase, and the timing test is updated to expect it. - Tests:
test/map-held.test.tschecksheldandstartablefor one hot issue and one free one. It also checks that a sealed issue is never named to a guest, that a guest's hot-file count leaves out a sealed pull while an admin's includes it, that a sealed pull'sopen_pullhold is hidden from a guest, that an admin's file hold has its own detail, and that the MCPmaptool returns the same fields. Each of these would fail without the change. - Both doors and design: the change is API and MCP only, as the issue asks. The web page only gains an optional
mapJsonparameter and no markup, so nothing in the design system is touched. - Preview: the preview has no repositories, so I could only confirm that the map route answers 404 for a missing repository with a Server-Timing header. The tests stand in for the live check.
Nits, not blocking:
admitsruns one query per pull on every call, andpullCountsis called twice per build. That is cheap behind the cache, but a singleIN (…)lookup would be better if open pulls grow into the hundreds. -
Checks
shipped production is serving it deploy c347b92
-
History
- Tests pin the open_pull filter and the admin-pin detail; the holds are documented (#6441) 8eaebd5
- The map's holds count only the pulls the viewer may see, and the MCP map tool carries them (#6441) c23f731
- The map's API names what holds each ready issue: held per entry and startable (#6441) 0738109
- A test pins that a wave never names a pull from a repository the viewer cannot read (#6836) 94b7e13
- A test pins the app limit: the account at its limit is refused, a forge admin never is, and no limit asks nothing (#6835) 00d3651
- A test pins `ssh <app>@<forge> pulls`: a title cannot carry a terminal escape, and a refused viewer gets the terminal's own refusal (#6834) 2fffd07
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:20ibtnaoxb is past its budget: trevato/forge: "now reads its rows in batches with 200 open issues, 40 open pulls and 5 active runs" failed on 3 pulls … (#6816) 77a6861
- /explore takes `updated:7d` (or 1d, 30d) in its one line, and a chip for each narrows to what moved in that window (#6814) bde626f
- `bun scripts/flow-report.ts` prints every flow read in one page, so each is reachable while its surface is built (#6682) 33e4f35
- A hold set "until green" releases itself when a green check lands on the pull's head, with a note that says so (#6508) 4867452
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1jysrp6ra0 was degraded 55 minutes today: trevato/forge: "readPlan of 2,000 closed and 300 open issues under 10 pillars fits a 30 ms budget" failed on 3 pulls in… (#6813) c96e4cd
- A test pins app-note moderation: a banned visitor's notes leave the app's list, and unbanning brings them back (#6809) e661fbf
- A test pins account recovery links: `spendRecovery` works once and never after expiry (#6808) a5d0217
- A test pins that a webhook belongs to its repository: `getWebhook` and `deleteWebhook` never reach another repository's hook (#6807) 9508fd0
- Migration pins leave the release cut: pinning a migration never commits to main (#6647) 23709b9
- A test pins first-admin recovery: a code is spent once, never when expired, and `unburnFirstAdmin` gives back only a spent code (#6806) 538ad4f
- A test pins who sees a sealed issue: `mayView`, `canSeeSealed` and `mayViewId` (#6805) 41cd73b
- A test pins how an outsider's report is cleaned: control and bidi characters stripped, titles bounded, the outside prefix never doubled (#6803) 51e735a
- A test pins sign-in through another forge: a login in flight is taken once and expires, and a parent link is one per account and issuer (#6802) 7b68838
- A test pins that an organization never loses its last owner: `personOwners`, `isLastOwner`, `soleOwnedOrgs` (#6800) 4b0ed5b
2 earlier comments
GET /api/v1/repos/:owner/:name/map now says what holds each ready issue. The type check and the map tests I ran pass: map-held, map-api-timing, map-seed-timing, map-cache and map. I did not run the whole suite, crew-held included; the forge's check does that on push.
- Held and startable: each
readyentry carriesheld: nullor{ by: <HoldName>, detail }. The map also carriesstartable, the issue numbers no filter holds. hot_filedetail: it names the file and its open-pull count, for examplesrc/hot.ts is in 3 open pulls. An admin's hold on a file says<path> is held by an admin.- Other holds: they get a fixed one-line reason.
- How it's built: it reuses
heldByandhotFilesthrough a newmapHoldsinsrc/crew/held.ts. It makes no git call. It runs inside the cached map build as a newheldServer-Timing phase, so a cache hit pays nothing. - Privacy: the held list is built from the viewer's own graph, so a sealed issue the viewer may not see is never in
readyand never named. The test checks that an anonymous reader's response has no sealed issue and nostartableentry for it. - Tests: the new
test/map-held.test.tsseeds one issue held by a hot file and one free, and checksheldandstartable. I changedtest/map-api-timing.test.tsto expect the newheldphase in the Server-Timing list. That test was out of date because of this change, not wrong.
Left out:
- The direction issue is excluded from
startable, asheldBydoes, but still showsheld: nullinready. - Hot-file counts live in memory, so a map snapshot can lag them by up to its 60-second cache.
To try it, fetch the map for any repo with a crew and look at ready[].held and startable.
Both points from the review are fixed, and the change is pushed to the same branch. The type check passes and so do the tests for the map, crew-held, crew-hot-files, the MCP and the map timing. I did not run the full suite; the forge's check does that.
- Sealed pulls (high): the holds are now built for the viewer's
sealedScope.- Hot counts:
hotFilesandpullCountstake an optionaladmit(pullNumber)filter, so a sealed pull is left out of the count for a guest. An admin still sees it. open_pull:heldByapplies the same filter to the pulls that propose an issue, so a guest no longer seesopen_pullfrom a pull they cannot read.- Who sees what: with the sealed scope everything is admitted. Otherwise a pull counts if it is not sealed or the viewer wrote it.
- Cache: the cache key already includes the scope, so cached answers stay separate per viewer.
- Hot counts:
- MCP (medium): one helper,
mapHeldForinsrc/crew/held.ts, now serves both the route and the MCPmaptool. The MCP tool returnsheldandstartable. - Tests:
test/map-held.test.tsnow seeds a sealed pull onsrc/hot.ts, and the new cases would fail without the fix. The guest's detail says${HOT_PULLS} open pulls, an admin's says one more, and the MCPmaptool returnshot_fileandstartable. - Not tested: the
open_pullfilter has no test of its own. Its guest case needs a real sealed pull that closes a public issue, which I did not build. The sealed-pull test covers the hot-file count. - Direction issue: as before, it stays out of
startablebut showsheld: null.
Both gaps are now covered by tests, and the branch is pushed. bun x tsc --noEmit and test/map-held.test.ts pass (5 tests). I did not run the full suite; the forge's check does that.
open_pullfilter: a new case intest/map-held.test.tsopens a real pull that closes a public ready issue, then seals the pull row. The guest's map shows that issue withheld: null. The admin's map showsheld.by === "open_pull". I reverted the filter inheldByand the test failed, then restored it.- Admin-pin detail: the same case seeds a file hold on
src/pinned.tsand checks the detail readssrc/pinned.ts is held by an admin. It also checks thatbyishot_filefor the admin. - Guest
startable: the newdocs/features/map-held.mdsays a guest'sstartableis what that viewer can see as free, not the crew's queue. The README is capped, so the note is not there. The same file says hot-file counts can lag a cached map by up to a minute.
GET /api/v1/repos/:owner/:name/mapnow says what holds each ready issue. The type check and the map tests I ran pass:map-held,map-api-timing,map-seed-timing,map-cacheandmap. I did not run the whole suite,crew-heldincluded; the forge's check does that on push.readyentry carriesheld: nullor{ by: <HoldName>, detail }. The map also carriesstartable, the issue numbers no filter holds.hot_filedetail: it names the file and its open-pull count, for examplesrc/hot.ts is in 3 open pulls. An admin's hold on a file says<path> is held by an admin.heldByandhotFilesthrough a newmapHoldsinsrc/crew/held.ts. It makes no git call. It runs inside the cached map build as a newheldServer-Timing phase, so a cache hit pays nothing.readyand never named. The test checks that an anonymous reader's response has no sealed issue and nostartableentry for it.test/map-held.test.tsseeds one issue held by a hot file and one free, and checksheldandstartable. I changedtest/map-api-timing.test.tsto expect the newheldphase in the Server-Timing list. That test was out of date because of this change, not wrong.Left out:
startable, asheldBydoes, but still showsheld: nullinready.To try it, fetch the map for any repo with a crew and look at
ready[].heldandstartable.Closes #6441