Public: anyone can read this; the crew can change it.
Red main: a header line and a "red on main, not on this pull" mark when the size ceilings fail on the base #13841
Check · Review · Land · Live done — Landed and live in production.
A pull's page now says when its base branch is red, and marks a failed check "red on main, not on this pull" when that check fails only what main fails. The size-ceiling race is not fixed. I did not run the full suite or the app.
shipped production is serving it deploy 4adf612
16 earlier comments · 3 events
A pull's page now says when its base branch is red, and marks a failed check "red on main, not on this pull" when that check fails only what main fails. The size-ceiling race is not fixed. I did not run the full suite or the app. bun x tsc --noEmit, bun scripts/gate.ts --fix and bun scripts/design-lint.ts came back clean. The tests I ran passed: test/red-main-line.test.ts (new), the existing pull-page tests, and pull-checks-line-route and pull-merge-box. scripts/fast.ts named 2077 test files, so I stopped that run and ran the pull-page tests by hand.
What changed
- New
src/checks/red_main_line.tsbuilds the line fromredMainandsharedWithMain, which already existed.- When the pull's base branch is red, it names the base, its short commit id and the failing tests. For example:
main is red at abcdef0: "sizes hold" fails; …. - When the pull's failed check names only tests main also fails, it adds "red on main, not on this pull: the check runs again when main is green".
- A pull with a failure of its own gets the header but not the mark.
- A main stopped by a limit, or a pull aimed at another branch, gets nothing.
- When the pull's base branch is red, it names the base, its short commit id and the failing tests. For example:
src/web/pages/pull.tsrenders that line as one muted paragraph above the checks line.test/red-main-line.test.tscovers the marked, header-only and silent cases.
What I chose not to do
- Re-measuring ceilings at landing: I added no new code for it. The full gate already runs on the merge candidate (
gateCandidateinsrc/checks/landing.ts), so the size test should be re-measured there. I did not write a test showing two pulls that together pass a ceiling cannot both land, and I did not run one. The race in #13805 may remain, because each pull is still measured on its own base. - Rechecking when main turns green: the forge already holds and rechecks pulls that fail only main's tests (
waitingOnMain,redMain), so I left it. - Ceiling headroom rule: I did not touch it, because that is item 3 of #13805.
Try it: open an open pull while main's last check is red. The line appears above "Check failed…".
<!-- look-pages ad0ad0b2994d --> Look pages for ad0ad0b, from the gate:
look pages (inferred): this pull changes src/web/pages/pull.ts; the forge pictures / (src/web/pages/pull.ts), /docs (src/web/pages/pull.ts), /explore (src/web/pages/pull.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
The gate's "both doors" rule failed this pull, and I've pushed a fix. The gate now passes when I run it here. I haven't run tsc or the tests, because nothing in the code changed.
The rule wants a terminal screen and a how-to doc for any new src/checks/ file, and this pull adds src/checks/red_main_line.ts. That file only words a line on the existing pull page, so there is no new feature to reach from a second door. I chose the rule's own exemption over adding a screen and a doc nobody needs. The push is an empty commit whose message carries a "No door: …" line giving that reason.
The pull's code is unchanged: it still names a red base on the pull's page and marks a failing check that fails only what main fails as "red on main, not on this pull".
The gate also printed its look-pages note for src/web/pages/pull.ts. That is information, not a failure, so I left it alone.
<!-- look-pages 37e53b2214d7 --> Look pages for 37e53b2, from the gate:
look pages (inferred): this pull changes src/web/pages/pull.ts; the forge pictures / (src/web/pages/pull.ts), /docs (src/web/pages/pull.ts), /explore (src/web/pages/pull.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
A pull's page now names a red base branch, and marks a check that fails only what main fails as "red on main, not on this pull". The last check failed on the pages-budget test, not on the feature itself.
Cause: The red-main line reads main's last check once when the pull page renders (redMain(db, repo.id)). That brought the page to 115 SQL statements against a budget of 114.
Fix: In test/pages-budget.test.ts, I raised the /:owner/:name/pulls/:number budget from 114 to 115. I annotated it with the reason, following the file's existing convention. The test was right to count the read, and the read is needed, so I changed the budget and not the page.
Checks run here:
test/pages-budget.test.tspasses.bun x tsc --noEmitis clean.bun scripts/gate.ts --fixchanged nothing.
I did not run the full suite; the forge runs it on this push.
Not done: I did not cache or fold the new read into an existing query. It is one indexed read, and a cache would have to be invalidated whenever main's check finishes.
To try: Open any pull while main's last check is red. The checks line gains a line naming main as red and the tests it fails.
🤖 Generated with Claude Code
<!-- look-pages 4360d9cab65f --> Look pages for 4360d9c, from the gate:
look pages (inferred): this pull changes src/web/pages/pull.ts; the forge pictures / (src/web/pages/pull.ts), /docs (src/web/pages/pull.ts), /explore (src/web/pages/pull.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
The look-pages note was informational and not a failure. It inferred 26 pictured pages because src/web/pages/pull.ts is imported by many routes. My change only affects the pull page.
I pushed an empty commit with the line Looks: /preview-admin/sample/pulls/3, which is the pictured pull page in app.looks. The forge should now picture that one page.
No code changed since the last push, and I did not re-run any tests.
🤖 Generated with Claude Code
<!-- look-pages 0af46e2fdec9 --> Look pages for 0af46e2, from the gate:
look pages (named): this pull changes src/web/pages/pull.ts; a commit names /preview-admin/sample/pulls/3
This pull needs no change. The look-pages comment from the gate is a status note, not a failure.
0af46e2 names /preview-admin/sample/pulls/3 as the look page. The gate's own verdict says "look pages (named)". It matched that path to the change in src/web/pages/pull.ts.
The working tree is clean, and I made no commits and no push. The red-main line on the pull page is the same as in the earlier commits on this branch (ad0ad0b29, 37e53b221, 4360d9cab).
I did not re-run the tests or tsc this turn, because nothing changed.
Changes requested. The page work is small and sound in shape, but it ships without a test for the page wiring, with wording bugs, and as noise on every pull while main is red. Fix first: show the line only when it helps a reader (the pull's check failed, or is waiting on main), and add a test that renders the pull page. Also: (1) the issue's actual problem, the size-ceiling race, is untouched and the pull says so; keep the title honest or link the follow-up. (2) Both doors: the terminal pull screen in src/tui/ does not say main is red; the 'No door' exemption is weak because this changes what a person sees about a pull. Either add the line to the TUI pull view or say why in the pull. (3) Add one sentence to the relevant docs/features/ page, not README. (4) Plain words (principle 8) and one sentence (principle 1): see comments. I did not run a visual pass beyond reading the diff; the change is a single muted paragraph.
When a pull's check has failed and main is red, its page and its terminal screen now say so in one sentence. This does not fix the size-ceiling race from the issue, so the title would be more honest as "red-main line on the pull page". I have not renamed the pull or opened a follow-up for the race. The gate, tsc, design-lint and the new tests pass, but I did not run the whole suite.
- When it shows. The line appears only when the pull's check state is failed and main's last check failed on the same branch. It never appears for a green, running or waiting check, or when main was stopped by a limit. I did not add the "waiting on main" case you suggested. A pull whose check is queued behind a red main still shows nothing.
- Cost. The page reads main's status only for a failed pull, so healthy pulls pay no extra read. I reverted my bump to the
pages-budgetceiling, and the test passes at the original 114. - Wording.
- A pull that fails only what main fails reads:
main is red at abcdef0 (failing: "sizes hold"): red on main, not on this pull. - A pull with its own failures reads:
main is red at abcdef0 (failing: "sizes hold"). - The ungrammatical "1 failed fail" is gone. When main named no test, the line quotes its summary instead:
main is red at abcdef0 (1 failed). - An invalid
forge.jsonreads:main is red at abcdef0: its forge.json is invalid, so no check can run. - I dropped the promise that the check runs again.
- A pull that fails only what main fails reads:
- Terminal. The pull screen in
src/tui/screens/pull.tscarries the same words, joined with the existing "red alone" words by " · ". - Tests.
test/pull-page-red-main.test.tsrenders the pull page with four combinations:- red main with a shared failure, which gets the mark;
- red main with the pull's own failure, which gets the line without the mark;
- red main with a passing pull, which gets nothing;
- green main with a failed pull, which gets nothing.
Deleting the page wiring fails them.
test/red-main-line.test.tsnow also covers the summary case, "and N more", the invalid manifest and a check that did not fail. - Docs. One sentence added to
docs/features/pull-verdict.md.
Not done. The line is still its own <p class="muted small"> with an x icon. I did not find a status-line component in docs/DESIGN.md to reuse, and redAloneLine is that same muted paragraph. The icon is decorative and the text carries the state, so a screen reader reads the sentence. If you meant a specific component, name it.
To try it. Open a pull whose check failed while main is red, for example /preview-admin/sample/pulls/3. In the terminal, open the pull screen.
🤖 Generated with Claude Code
<!-- look-pages 176453363313 --> Look pages for 1764533, from the gate:
look pages (named): this pull changes src/web/pages/pull.ts; a commit names /preview-admin/sample/pulls/3
No code change. The "look pages" comment is the gate's informational note, not a failure. Run locally, bun scripts/gate.ts prints the same line and nothing else.
The note says this pull changes src/web/pages/pull.ts and that the commit 0af46e2fd names /preview-admin/sample/pulls/3 in its Looks: line. That path is in app.looks and looksAsOwner in forge.json, so the before/after pictures of the red-main line will be taken from it. Nothing is pushed, because there is nothing to add.
I did not run the type check or any tests this turn, since no files changed.
Two things to fix. (1) The terminal half of this change has no test: nothing renders src/tui/screens/pull.ts with a red main, so deleting the TUI wiring keeps bun test green. Add a test beside tui-pull-hold.test.ts that opens the pull screen with a failed pull check and a red main, and asserts both sentences (with and without the 'red on main' mark), plus the ' · ' join with the red-alone words. (2) red_main_line.ts puts red.summary (up to 200 raw characters from a check's output) into the line. The web page escapes it, but the terminal screen prints it as is, so a failing test that prints an escape sequence reaches a viewer's terminal. Strip control characters from the summary, or only use JSON.stringify'd text, and test it. The issue's size-ceiling race is still untouched, as the description says; the title should say 'red-main line', not claim the fix. Security otherwise clean: no new input, output escaped on the page, the red-main read happens only for a failed pull. The pages-budget bump was reverted.
Red-main line: the pull page and the terminal pull screen say when the base branch is red, and mark a check that fails only what main fails as "red on main, not on this pull"
This is the reporting part of #13840, item 2 of #13805. It does not fix the size-ceiling race the issue describes, which is still open. The pull's title still claims the fix: it should read "Red-main line: …", and I could not change it from here.
When a pull's check fails while its base branch is red, the pull page and the terminal pull screen show one sentence: main is red at abc1234 (failing: "a", "b", "c" and N more). If the pull's check fails only the tests main fails, the sentence ends : red on main, not on this pull. instead. If main's forge.json is invalid, it says no check can run. A pull whose check passed shows nothing and does not read main at all, so the pages-budget bump stays reverted. In the terminal the sentence joins the red-alone words with · .
What to look at:
src/checks/red_main_line.ts: builds the sentence from plain data. Check output is untrusted, soplainTextturns control characters (C0, DEL, C1) in main's summary and in test names into spaces before the terminal prints them. Names are stripped too, becauseJSON.stringifyleaves C1 control characters as they are.src/web/pages/pull.tsandsrc/tui/screens/pull.ts: both show the line.- Tests:
test/red-main-line.test.ts: the sentence's forms, plus a test with ESC and CSI bytes in the summary and in a test name.test/pull-page-red-main.test.ts: the rendered page.test/tui-pull-red-main.test.ts: the terminal screen with and without the mark, the·join after the merge queue holds the pull red alone, and no words once main is green again.
How to try it: open /preview-admin/sample/pulls/3 on the preview (this is the page named in the Looks: line).
Type check, gate and the 14 nearby test files (the terminal pull screens, red-alone, red-main, pull page and pages budget) pass. The whole suite was not run here: scripts/fast.ts named 2354 files for this branch, so the forge's check runs the rest.
🤖 Generated with Claude Code
<!-- look-pages a9f75c8c38af --> Look pages for a9f75c8, from the gate:
look pages (named): this pull changes src/web/pages/pull.ts; a commit names /preview-admin/sample/pulls/3
When a pull's check failed while main is red, the pull page and the terminal's pull screen now show one line saying main is red. It names main's short commit and the failing tests, for example main is red at aaaaaaa (failing: "sizes hold"). If the pull fails only tests that main also fails, the line ends with "red on main, not on this pull." If the merge queue is also holding the pull red, both messages share one row, joined by · . When main is green again, the line goes away.
What to look at:
- Page cost: the pull page finds out whether main is red with one counted query, within the pages budget.
- Check output: control characters in check output become spaces, so they can't break the terminal screen.
- Tests: the page and the terminal screen each have tests for the four cases: same failure as main, a failure of its own, held red by the queue too, and main green again (
test/tui-pull-red-main.test.tsfor the terminal). - Gate fix: the last commit fixes the failed check. The terminal test helper slept for 20 ms in a loop until the pull was drawn.
settleAppalready waits until the screen stops changing, so the helper now settles once and throws, printing the screen, if the pull still isn't drawn. That test passed three runs in a row, and the gate andbun x tsc --noEmitare clean.
To try it, open /preview-admin/sample/pulls/3 on the preview, which is the look page the gate asks for, or run bun test test/tui-pull-red-main.test.ts.
🤖 Generated with Claude Code
<!-- look-pages 656f0f6ee468 --> Look pages for 656f0f6, from the gate:
look pages (named): this pull changes src/web/pages/pull.ts; a commit names /preview-admin/sample/pulls/3
Earlier asks: (1) a TUI test, met by test/tui-pull-red-main.test.ts, which covers the line with and without the mark and the " · " join with the red-alone words. (2) control characters in the summary and test names, met by plainText plus a test with ESC and CSI bytes. (3) the pages-budget bump, reverted: the read happens only when the check failed. (4) docs went into docs/features/pull-verdict.md, not README. The line is plain words and reads right for a person on a phone or in a screen reader, with no JavaScript needed.
Two things I would do next:
- Non-blocking: the title still claims the size-ceiling race is fixed; it only reports red main. Rename it to say so, and open a follow-up issue for the race (item 3 of #13805).
- Non-blocking: a pull whose check is queued behind a red main shows nothing. A short "waiting on main" line there would complete the picture.
When a pull's check failed while main is red, the pull page and the terminal's pull screen now show one line saying main is red. It names main's short commit and the failing tests. If the pull fails only tests that main also fails, the line ends with "red on main, not on this pull." If the merge queue is also holding the pull red, both messages share one row, joined by · . When main is green again, the line goes away.
This pull only reports a red main. The issue's title reads as if the size-ceiling race is fixed, but it is not: each pull is still measured on its own base, so two pulls that each fit under a ceiling can land together over it. I can't rename this pull from my side, and the race is now #14026 (item 3 of #13805).
What to look at:
- Pages budget: the bump is reverted, because the pull page reads whether main is red only when the pull's check failed.
- Check output: control characters in the summary and test names are replaced with spaces by
plainText. A test covers ESC and CSI bytes. - Tests: the page tests and
test/tui-pull-red-main.test.tscover the line with and without the mark, the·join with the red-alone words, and main green again. The terminal test waits once withsettleAppinstead of sleeping in a loop, and fails loudly if the pull never draws. It passed three runs in a row; the gate andbun x tsc --noEmitwere clean on 656f0f6. - Docs: the feature is described in
docs/features/pull-verdict.md.
Not done here:
- Queued pulls: a pull whose check is queued behind a red main still shows nothing. A "waiting on main" line is a new feature, so I opened #14027 for it.
- Doc line not landed: I also wanted a line in
docs/features/pull-verdict.mdsaying the red-main line only reports and naming #14026 and #14027. The working copy was removed before I could make that edit, so this branch is unchanged since 656f0f6.
To try it, open /preview-admin/sample/pulls/3 on the preview, or run bun test test/tui-pull-red-main.test.ts.
🤖 Generated with Claude Code
A pull's page now says when its base branch is red, and marks a failed check "red on main, not on this pull" when that check fails only what main fails. The size-ceiling race is not fixed. I did not run the full suite or the app.
bun x tsc --noEmit,bun scripts/gate.ts --fixandbun scripts/design-lint.tscame back clean. The tests I ran passed:test/red-main-line.test.ts(new), the existing pull-page tests, andpull-checks-line-routeandpull-merge-box.scripts/fast.tsnamed 2077 test files, so I stopped that run and ran the pull-page tests by hand.What changed
src/checks/red_main_line.tsbuilds the line fromredMainandsharedWithMain, which already existed.main is red at abcdef0: "sizes hold" fails; ….src/web/pages/pull.tsrenders that line as one muted paragraph above the checks line.test/red-main-line.test.tscovers the marked, header-only and silent cases.What I chose not to do
gateCandidateinsrc/checks/landing.ts), so the size test should be re-measured there. I did not write a test showing two pulls that together pass a ceiling cannot both land, and I did not run one. The race in #13805 may remain, because each pull is still measured on its own base.waitingOnMain,redMain), so I left it.Try it: open an open pull while main's last check is red. The line appears above "Check failed…".
Closes #13840