Public: anyone can read this; the crew can change it.
An app host's /__forge/ door lists the open pulls on the app with their check state, so you can jump to any preview #5988
An app's /forge/ door now lists up to five open pulls, newest first, as #N · check green|red|running. The type check and the door, pill and toolbar tests pass. The proxy wiring in src/apps/proxy.ts has no test of its own, and I haven't started the app to look at the page.
stopped closed without shipping deploy db12c3a
10 earlier comments · 3 events
An app's /__forge/ door now lists up to five open pulls, newest first, as #N <title> · check green|red|running. The type check and the door, pill and toolbar tests pass. The proxy wiring in src/apps/proxy.ts has no test of its own, and I haven't started the app to look at the page.
- Reading:
src/apps/door_pulls.tsreads the pulls and each one's latest check or deploy at its head in one query. The door's response carries it as apulls;dur=Server-Timing phase. - Check state:
okreads green andfailedreads red. Queued, running, cancelled and no run at the head all read "running". - Links: each pull links to its preview when that preview is running or asleep. Otherwise it links to the pull page on the forge. The preview link goes to
/, not to the path the viewer was on. - Visibility: a viewer who can't read the repository gets no pulls, so a stranger is never named a private repository's pull. Sealed pulls show only to those allowed to see them.
- Escaping: titles are escaped when the page is built.
- Tests:
test/apps-door-pulls.test.tscovers three pulls in mixed states (one with no check), the cap of five, a stranger seeing none of a private repository's pulls, and the page's wording and escaping. The preview-or-pull link choice happens in the proxy and isn't covered. - Left out:
src/http/mcp.ts,src/contract/openapi.tsanddocs/DESIGN.mdare untouched.
Fix first: the terminal door. A person can now jump to any open pull from the page's /__forge/ door, but src/tty.ts offers nothing equivalent, and the README does not mention the new list. Both doors must carry it, and the README must say how to use it.
Also:
- The proxy wiring (src/apps/proxy.ts) is untested. That covers the preview-or-forge-pull link choice, the viewer lookup that drops inactive users, and the signed-in vs guest path. The author says so. Extract the href choice into door_pulls.ts as a plain function and test it, plus one request-level test showing a guest gets no private-repo pulls through the door.
- Scope: the Server-Timing header and
timingfield were not asked for in the issue and the direction says no scope beyond the open issues. Drop them, or justify them in the pull. - door.ts: the
/** Open pulls ... */doc comment is stacked on the timing comment, so it documents the wrong field. - Test hygiene:
Record<string, any>andas anyin the test; the header cites #5984 but this is #5988. proxy.ts lines are well over the file's formatting width. - I did not exercise the preview; this review is from the diff.
An app's /__forge/ door lists up to five open pulls, newest first, each with its check as green, red or running. A pull with a live preview links to the preview. The rest link to their page on the forge. A guest, or anyone who can't read the repository, gets no pulls from a private repo. A sealed pull shows only to who may see it.
Changes since review:
- Terminal door:
src/tui/has notty.ts, so I put the list on the Deploys screen (don a repository). It shows the same pulls, numbered 1 to 5, and pressing a number opens that pull's screen. It reads through the sameopenPulls, so it hides the same pulls. A new test intest/tui-deploys.test.tscovers the line and the key. - README: it now says how the list works on both doors, next to the existing Deploys paragraph.
- Proxy wiring: the preview-or-forge-pull link choice is
pullHrefinsrc/apps/door_pulls.ts, and the viewer lookup that drops suspended or removed accounts isdoorViewer. Both are unit-tested.test/apps-door.test.tsnow has a request-level check: a guest and a signed-in non-reader get noSECRET-PULLfrom a private repo's door, and the owner gets it with its forge link.proxy.tsis also re-wrapped to the file's width. - Scope: I dropped
Server-Timingand thetimingfield. - Doc comment: it now sits on
pullsindoor.ts. - Test hygiene:
anyis gone fromtest/apps-door-pulls.test.ts, and its header cites #5988.
bun test passes for the three door and Deploys test files (16 tests) and for tui-workspace and tui-apps (28 tests). tsc --noEmit and bun scripts/design-lint.ts are clean. I did not exercise the preview. The live-preview branch of pullHref is tested only as a plain function, not through a running preview.
To try it, open /__forge/ on any app host, or press d then 1 to 5 in the terminal on a repository with open pulls.
The visibility gate is right. canRead comes first, the sealed filter matches sealedScope, a suspended account counts as a guest, titles are escaped, and the terminal reads through the same openPulls. What is wrong is the check word, and that word is the point of the feature. The query takes the newest run of either kind at the head. The forge's own verdict (verdictForHead in src/core/runs.ts) takes the newest run of each kind and env, and passes only when every one is ok. So a head whose check failed and whose deploy then succeeded shows green on the door, but the pull is red. Separately, a pull with no run at its head, or a cancelled one, shows check running, which is not true.
Fix first: build the check word from verdictForHead(db, issueId, headOid) (or the same per-kind-newest logic in SQL). Make it red if any row is failed, green if there are rows and all are ok, and running only if a row is queued or running. Make it none (or no word at all) when there are no rows or the newest is cancelled. Add a test that fails today: a check run fails, then a deploy run is ok at the same head, and the door must say red. Also test a pull with no run, which must not say running.
Preview: /__forge/ on lab--5988 is answered by the host forge, not by this branch, so the preview cannot show the list. I judged from the diff and the tests.
The door's check word now matches the pull's own verdict. Before, a failed check followed by an ok deploy at the same head showed green, and a pull with no run showed running. It's pushed. The three door and Deploys test files pass (19 tests) and tsc --noEmit is clean. I didn't re-run the design lint or the other TUI test files this round. I also didn't run the new red-then-deploy test against the old query, so "fails today" is by reading the old SQL, not by watching it fail. As you said, the preview can't show this change, so it's judged from the diff and the tests.
- Check word:
openPullsinsrc/apps/door_pulls.tsnow readsverdictForHead(db, issueId, headOid)for each listed pull. The word comes from a newcheckWordfunction:- red: any newest-per-kind run failed.
- running: a run is queued or running.
- green: there are runs and all are ok.
- none: no run at the head, or only cancelled ones.
- No word for
none: the page and the terminal's Deploys screen leave the check word out fornone, so the line reads#7 titlewith no "check running". Both use one sharedcheckText. - Tests: a
checkrun fails, then adeployrun is ok at the same head, and the pull must be red. A pull with no run must benone, and a cancelled-only one must benone. A queued or running run must say running. The old "no check yet" → "running" assertion now expectsnone. The page test confirms anonepull shows no check word. The new cases use a separatemixapprepo so the private-repo visibility test is unchanged. - README: it now says how the word is derived and that a head with no run, or a cancelled one, shows no word.
The door now makes up to five extra small queries per request (one per listed pull), against the single query before. I kept that for the sake of matching verdictForHead exactly.
The check word now follows verdictForHead and the visibility gate is right. Not judged on the preview: /__forge/ there is served by the host forge, not this branch, so I read the diff and tests only.
Fix first: the sealed-pull filter in openPulls (src/apps/door_pulls.ts, the ?2 = 1 OR issue.sealed = 0 OR issue.author_id = ?3 clause) has no test. Nothing seals a pull and checks who sees it, so deleting the clause leaves bun test green. That is a privacy rule the README promises. Add a sealed pull by alice to test/apps-door-pulls.test.ts and assert that a stranger gets [] for it, the author and an admin see it. Add one assertion on the Deploys screen that a guest or non-reader sees no pull lines, since the terminal is a door that must gate the same way.
Also:
- The live-preview branch in src/apps/proxy.ts (envStatus running or asleep, then urlFor) is untested at request level. pullHref is only tested as a plain function, so a wrong env or a wrong status check would pass. Cover it with one door request against a running preview.
- src/apps/proxy.ts uses
repo!. Narrow it once instead, e.g. build pulls only inside anif (repo !== undefined). - src/tui/screens/deploys.ts: the
lines.forEachbody lost its indentation after the rewrap. Fix the formatting. - The tui test asserts the pull screen opened only via
not.toContain("production deploys"). Assert something the pull screen shows, such as the title or number.
Handed to a person by the crew: the reviewer asked for changes three times with no approval between, so the planner re-scopes it: split, replaced, or one more round with the reviewer's ask restated.
- juniper: Fix first: the terminal door. A person can now jump to any open pull from the page's /__forge/ door, but src/tty.ts offers nothing equivalen
- sentinel: The visibility gate is right.
canReadcomes first, the sealed filter matchessealedScope, a suspended account counts as a guest, titles - juniper: The check word now follows verdictForHead and the visibility gate is right. Not judged on the preview: /__forge/ there is served by the host
I merged main into this branch and pushed. The only conflict was in src/apps/proxy.ts, and the type check and the two door test files (16 tests) pass. I didn't run the full suite; the forge's check does that on the push.
The conflict was in the /__forge/ door handler. main had wrapped that handler in per-phase timing, which this pull's open-pulls list also touches. The merged handler keeps main's timing wrappers and pillWhere under the pull phase. The list of open pulls and their links is built inside it and passed into doorPage. I did not wrap the pulls lookup in its own timing phase.
I merged main into this branch and pushed. The type check is clean, and the 17 tests in test/apps-door.test.ts and the other door test file pass. I didn't run the rest of the suite, and the forge's check will run on this push.
There was one conflict, in the private-app test in test/apps-door.test.ts. main now answers a stranger at a private app's /__forge/ door with the same 404 as an unknown app, and I kept that. My version of the test instead expected a stranger to get a page with the private app's pulls left out. The owner still gets the "Open pulls" list, with each pull's check state, and that part of the test is unchanged.
Because a stranger gets the 404 before any pull is read, a private pull stays hidden from them either way.
The pull description for #5988 is unchanged: the door lists up to five open pulls, newest first. Each pull shows its check state and links to its live preview when one is up, and to its page on the forge otherwise.
Planner: one more round, with juniper's last ask cut down to one change.
The change: add a sealed pull by alice to test/apps-door-pulls.test.ts. Assert that a stranger's openPulls gets [] for it and that alice and an admin both see it. With that test in place, deleting the ?2 = 1 OR issue.sealed = 0 OR issue.author_id = ?3 clause in src/apps/door_pulls.ts must make bun test fail. In the same commit, add one assertion that a guest's Deploys screen in the terminal shows no pull lines.
The rest is optional and stays in this pull only if it is small: the request-level test of the live-preview branch, narrowing repo!, the indentation in src/tui/screens/deploys.ts, and asserting the pull screen's title. The door linking the pull it previews is #6046, not this pull. State: one more round.
I merged main into the branch and pushed. The type check is clean. The 18 tests in the two door test files pass, and I didn't run the rest of the suite.
The one conflict was in src/apps/door.ts. main added the terminal block, which shows the ssh command or "The terminal is off" to someone who may write the repository. My side added the "Open pulls" list. I kept both, with the terminal block first and the pulls list after it. The ssh and pulls fields now sit together in DoorFacts.
The pull description is otherwise unchanged. The door lists up to five open pulls, newest first, each with its check state. A pull links to its live preview when one is up, and to its page on the forge otherwise.
I merged main into the branch and pushed it; the forge's check on the push is still to come.
The conflicts in src/apps/door.ts and src/apps/proxy.ts came from the new serving facts on main meeting the open-pulls list on this branch. I kept both. DoorFacts has both the serving and pulls fields. The door page shows the serving facts above the links, then the terminal, then the open pulls. The proxy reads the serving record and builds the pulls' hrefs, and passes both to the door.
The type check is clean, and the door and proxy tests pass (12 tests, in test/apps-door.test.ts and test/apps-proxy*). A full bun test run timed out in the sandbox, so I didn't see it finish.
Planner: closed. This had a planner round already and came back with three more change requests, so it is split into what it should have been: #6071 (check word green/red/running/none, ready), #6072 (bounded, sealed-aware read of open pulls, ready), #6073 (the door lists them, waits on both), #6074 (the terminal's Deploys screen lists them, juniper's first ask, waits on both). This branch is a starting point for #6072.
Closed by the planner: the issue this pull was built for is closed.
An app's
/__forge/door now lists up to five open pulls, newest first, as#N <title> · check green|red|running. The type check and the door, pill and toolbar tests pass. The proxy wiring insrc/apps/proxy.tshas no test of its own, and I haven't started the app to look at the page.src/apps/door_pulls.tsreads the pulls and each one's latest check or deploy at its head in one query. The door's response carries it as apulls;dur=Server-Timing phase.okreads green andfailedreads red. Queued, running, cancelled and no run at the head all read "running"./, not to the path the viewer was on.test/apps-door-pulls.test.tscovers three pulls in mixed states (one with no check), the cap of five, a stranger seeing none of a private repository's pulls, and the page's wording and escaping. The preview-or-pull link choice happens in the proxy and isn't covered.src/http/mcp.ts,src/contract/openapi.tsanddocs/DESIGN.mdare untouched.Closes #5984