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

A green pull that has sat unlanded for a day says on its page, in one line, what it waits for #15812

Merged opened this

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

Merged

When a pull's check has been green for more than six hours and it still hasn't landed, the pull now says in one line what it waits for and the one action that unblocks it. For example: "Green for 30 hours, not landed: it waits for review.

Notes

shipped production is serving it deploy 3fede26

opened this

When a pull's check has been green for more than six hours and it still hasn't landed, the pull now says in one line what it waits for and the one action that unblocks it. For example: "Green for 30 hours, not landed: it waits for review. To unblock: a reviewer reviews it on its current head."

The pure function waitsFor in src/core/landing.ts decides the cause, checking in this order:

  • held: someone has put a hold on the pull.
  • conflicted: it conflicts with its base.
  • chapter: a chapter holds it.
  • person: the access wall is waiting for a person to decide.
  • changes: a reviewer asked for changes on this head.
  • review: it is waiting for a review.
  • queue: it is waiting for the landing queue.

Every surface below calls pullWaitsFor in the new src/flow/waits_for.ts, which reads those facts from the database: the head's check, who acts next (nextOfPull), the hold and chapterHold. That keeps the words the same everywhere:

  • Pull page: a new line under the path and the landing estimate.
  • /flow: a new "Green, not landed" list in the waiting section, oldest first, at most 50. /flow reads no git, so a conflict only shows on the pull page and in the tools.
  • MCP pull tool: a new waitsFor field, { cause, says, action, line } or null.
  • MCP pulls tool: a new waitsFor field holding the line or null, in both the per-repository and the all-pulls form.

No new tool was added.

Not done:

  • GET …/pulls/:number does not carry the field, because the issue says not to touch src/http/api.ts. The pull's JSON is covered by the MCP pull answer for now. If the REST answer needs it, it is one line in that route calling pullWaitsFor.
  • The terminal's "Pulls to land" screen does not show the new list.

Tests: test/pull-waits-for.test.ts checks the exact line for each cause from plain facts. It also builds real green pulls for review, queue, held, conflicted and chapter, plus one that is too young to show a line. It then checks that /flow's list order and HTML and the pulls tool's answer carry the same line.

Changed test: I updated test/mcp-pulls.test.ts, because it compares the brief pull shape exactly and that shape now includes waitsFor: null. That test was right, not wrong; the shape grew on purpose.

Checks run: bun scripts/gate.ts --fix, bun x tsc --noEmit and bun scripts/design-lint.ts are clean, and test/mcp-size.test.ts passes with the ceilings unchanged. scripts/fast.ts named 2,999 test files (about 252 minutes), so instead I ran about 60 files I picked: MCP pull and pulls, /flow waiting and pictures, pull page and pull timing budgets, studio changes. All of them pass.

Not used: I did not record a plan with keep_plan or anything with estimate, because neither tool was available in this run.

To try it: open /flow as an admin, or a pull whose check has been green for more than six hours.

[
  {"go": "/flow", "look": "the waiting section", "expect": "a \"Green, not landed\" list: each row links the pull and says \"Green for N hours, not landed: … To unblock: ….\""},
  {"go": "/trevato/forge/pulls/15694", "look": "the line under the path and landing estimate", "expect": "one line naming the cause and the one action, when the pull has been green and unlanded for more than six hours", "ask": "Is the action the right one for this cause?"}
]

🤖 Generated with Claude Code

Closes #15803

Show 2 earlier items

7 earlier comments · 1 event
commented

When a pull's check has been green for more than six hours and it still hasn't landed, it now shows one line saying what it waits for and the one action that unblocks it. An example: "Green for 30 hours, not landed: it waits for review. To unblock: a reviewer reviews it on its current head."

The pure function waitsFor in src/core/landing.ts decides the cause, checking in this order:

  • held: someone has put a hold on the pull.
  • conflicted: it conflicts with its base.
  • chapter: a chapter holds it.
  • person: the access wall is waiting for a person to decide.
  • changes: a reviewer asked for changes on this head.
  • review: it is waiting for a review.
  • queue: it is waiting for the landing queue.

pullWaitsFor in the new src/flow/waits_for.ts reads those facts from the database: the head's check, who acts next (nextOfPull), the hold and chapterHold. Every surface below calls it, so the words are the same everywhere:

  • Pull page: a new line under the path and the landing estimate.
  • /flow: a new "Green, not landed" list in the waiting section, oldest first, at most 50. /flow reads no git, so a conflict only shows on the pull page and in the tools.
  • MCP pull tool: a new waitsFor field, { cause, says, action, line } or null.
  • MCP pulls tool: a new waitsFor field holding the line or null, in both the per-repository and the all-pulls form.

No new tool was added.

Not done:

  • GET …/pulls/:number does not carry the field, because the issue says not to touch src/http/api.ts. Adding it later is one line in that route calling pullWaitsFor.
  • There is no terminal screen or how-to page. A "No door:" line in the commit says the line only appears on surfaces that already exist.

Tests: test/pull-waits-for.test.ts checks the exact line for each cause from plain facts. It also builds real green pulls for review, queue, held, conflicted and chapter, plus one that is too young to show a line. Then it checks that /flow's list order and HTML and the pulls tool's answer carry the same line. The first check run failed the gate's no-as never rule; the cause cases are now typed as WaitCause with no cast. test/mcp-pulls.test.ts compares the brief pull shape exactly, so it now expects the added waitsFor: null; that test was right, the shape grew on purpose.

Checks run:

  • After the fix, the gate and bun x tsc --noEmit are clean, and test/pull-waits-for.test.ts passes. I did not run the other tests again because the fix only touches that test file.
  • Before the first push, bun scripts/design-lint.ts was clean and test/mcp-size.test.ts passed with the ceilings unchanged.
  • scripts/fast.ts named 2,999 test files (about 252 minutes), so I picked about 60 files covering this change: MCP pull and pulls, /flow's waiting section and the page data behind it, pull page and timing budgets, studio changes. All of them passed.

I could not call keep_plan or estimate, because neither tool was available in this run.

[
  {"go": "/flow", "look": "the waiting section", "expect": "a \"Green, not landed\" list: each row links the pull and says \"Green for N hours, not landed: … To unblock: ….\""},
  {"go": "/trevato/forge/pulls/15694", "look": "the line under the path and landing estimate", "expect": "one line naming the cause and the one action, when the pull has been green and unlanded for more than six hours", "ask": "Is the action the right one for this cause?"}
]

🤖 Generated with Claude Code

commented

<!-- look-pages d626b0a575c1 --> Look pages for d626b0a, from the gate:

  • look pages (named): this pull changes src/web/pages/flow-waiting.ts, src/web/pages/flow.ts, src/web/studio/change.ts; a commit names /flow
commented

A green pull left unlanded for more than six hours now says, in one line, what it waits for and the one action that unblocks it. The cause is the first that applies: a hold, a conflict with its base, a chapter, or whoever acts next. The pull page, the "Green, not landed" list on /flow, and the pull and pulls MCP tools all read it from one function, so they all show the same line.

Why the last check failed:

  • /llms.txt byte budget: this pull's new waitsFor text in the pull and pulls tool docs pushed the signed-in /llms.txt over its 82,300-byte ceiling. The text is now shorter and the pulls doc points to pull's line, so test/llms-budget.test.ts passes on this branch.
  • needsYouCard statement-count test (test/surfaces-adversarial.test.ts, the only failure the check counted against this pull): it is flaky on the base commit as well, failing about one run in ten with 23 statements against 32. I couldn't reproduce it with logging on, so the source of the 9 extra statements is unknown. The test kept the fewest statements over only 2 measured runs, so stray background work landing in both runs failed it. It now takes 3 runs, which is a change to the test, not the code. That should make the flake rarer but doesn't remove its cause.
  • Page-budget tests and the blob page test: the check reported test/pages-budget.test.ts and test/page-budget.test.ts as red on main too and didn't count them against this pull. The blob page test wasn't covered by that comparison, and I didn't look into it.

Before pushing I ran the type check and these tests, which passed: test/surfaces-adversarial.test.ts, test/llms-budget.test.ts, test/mcp-pulls.test.ts and test/pull-waits-for.test.ts. scripts/fast.ts named about 3,000 files for this diff, so I chose those instead.

To try it: open /flow as an admin and read "Green, not landed". Then open a pull that has been green for over six hours and read the waits-for line under its path.

[{"go":"/flow","look":"the \"Green, not landed\" list","expect":"each row links its pull and says what it waits for and the one action"},{"go":"a pull green for over six hours","look":"the line under the path","expect":"\"Green for N hours, not landed: … To unblock: ….\""}]

🤖 Generated with Claude Code

commented

<!-- look-pages f3f9c2c4e86c --> Look pages for f3f9c2c, from the gate:

  • look pages (named): this pull changes src/web/pages/flow-waiting.ts, src/web/pages/flow.ts, src/web/studio/change.ts; a commit names /flow
commented

A pull whose check has been green for more than six hours and still hasn't landed now shows one line saying what it waits for and the one action that unblocks it. For example: "Green for 30 hours, not landed: it waits for review. To unblock: a reviewer reviews it on its current head."

The pure function waitsFor in src/core/landing.ts picks the first cause that applies, in this order:

  • held: someone has put a hold on the pull.
  • conflicted: it conflicts with its base.
  • chapter: a chapter holds it.
  • person: the access wall is waiting for a person to decide.
  • changes: a reviewer asked for changes on this head.
  • review: it waits for a review.
  • queue: it waits for the landing queue.

pullWaitsFor in the new src/flow/waits_for.ts reads those facts from the database: the head's check, who acts next (nextOfPull), the hold and chapterHold. Every surface calls it, so the words are the same everywhere:

  • Pull page: a new line under the path and the landing estimate.
  • /flow: a new "Green, not landed" list in the waiting section, oldest first, at most 50. /flow reads no git, so a conflict only shows on the pull page and in the tools.
  • MCP pull tool: a new waitsFor field, { cause, says, action, line } or null.
  • MCP pulls tool: a new waitsFor field holding the line or null, in both the per-repository and the all-pulls form.

No new tool was added.

Look pages: the latest gate note says look pages (named) … a commit names /flow. That is the result the look rule wants: a commit names a page of app.looks that shows the change, so the forge pictures /flow. The note is informational and never fails the check, so nothing changed and nothing new was pushed for it. The pull page's new line has no look of its own. The only pull page in app.looks is /preview-admin/sample/pulls/3, and that sample pull is never green and unlanded for six hours, so a picture of it would not show the line. Review it with the second step below.

Not done:

  • GET …/pulls/:number does not carry the field, because the issue says not to touch src/http/api.ts. The MCP pull answer carries it for now; adding it to the REST route is one line calling pullWaitsFor.
  • The terminal's "Pulls to land" screen does not show the new list.

Tests: test/pull-waits-for.test.ts checks the exact line for each cause from plain facts. It also builds real green pulls for review, queue, held, conflicted and chapter, plus one too young to show a line. It then checks that /flow's list order and HTML, and the pulls tool's answer, carry the same line.

Changed tests:

  • test/mcp-pulls.test.ts compares the short pull shape exactly, and that shape now includes waitsFor: null. The test was right; the shape grew on purpose.
  • The needsYouCard statement-count test in test/surfaces-adversarial.test.ts now takes the fewest statements over 3 runs instead of 2. It was flaky on the base too, and this makes the flake rarer but does not fix its cause.
  • The waitsFor text in the tool docs is shorter, so the signed-in /llms.txt fits its byte budget again.

Checks run: bun scripts/gate.ts --fix, bun x tsc --noEmit and bun scripts/design-lint.ts are clean. scripts/fast.ts named 2,999 test files, about 252 minutes, so I picked about 60 instead and all pass:

  • the MCP pull and pulls tools
  • /flow's waiting list and pictures
  • the pull page and its timing budgets
  • the studio changes
  • the /llms.txt budget and the MCP size ceilings
[
  {"go": "/flow", "look": "the waiting section", "expect": "a \"Green, not landed\" list: each row links the pull and says \"Green for N hours, not landed: … To unblock: ….\""},
  {"go": "/trevato/forge/pulls/15694", "look": "the line under the path and landing estimate", "expect": "one line naming the cause and the one action, when the pull has been green and unlanded for more than six hours", "ask": "Is the action the right one for this cause?"}
]

🤖 Generated with Claude Code

Closes #15803

Changes requested — before the latest push

Changes needed, first one first:

  1. HIGH, leak: stalledPulls reads every open pull in every repository, including private ones, with no visibility check, and /flow renders it to whoever may open /flow. Each row prints the repo name, pull number, the hold note text and the chapter text. A viewer who cannot read a private repo learns it exists and what its holder wrote. Filter to repos the viewer may read (or crew pulls only, like the stale list), and add a test with a private repo and a guest.
  2. Box 2: the pull's JSON (GET …/pulls/:number) does not carry the line. The issue asks for it there; the builder's reason (not touching src/http/api.ts) is not the issue's. Add waitsFor to that answer.
  3. Both doors: no terminal screen in src/tui/ shows the line, and there is no docs/features how-to (extend docs/features/flow-waiting.md). Add both.
  4. Design: the /flow row nests a hand-rolled span with a data attribute; use the named row/dl components, and keep copy plain (docs/WRITING.md): cut the 'Green for more than six hours; each says…' sentence that explains itself twice (principle 1).
  5. pulls without repo passes conflicts: 0 and /flow passes 0, so 'conflicted' never shows there while the pull page says it. Same pull, different lines; say so in the docs or compute it consistently.
  6. N+1: pullWaitsFor runs several queries per pull in the pulls tool (up to 200). Batch or bail out cheaply before the reads.
  7. Unrelated change: the flake fix in test/surfaces-adversarial.test.ts belongs in its own pull.

Box 3 and 4 are met in the tests and size test; the preview line only shows for pulls green over six hours.

commented

When a pull's check has been green for more than six hours and it still hasn't landed, the pull says in one line what it waits for and the one action that unblocks it. For example: "Green for 30 hours, not landed: it waits for review. To unblock: a reviewer reviews it on its current head."

waitsFor in src/core/landing.ts picks the first cause that applies: a hold, a conflict with its base, a chapter, then whoever acts next (a person, the builder after a reviewer asked for changes, a reviewer, the landing queue). pullWaitsFor in src/flow/waits_for.ts reads the facts from the database, and every surface calls it, so the words match everywhere:

  • Pull page: a line under the path and the landing estimate.
  • /flow: a "Green, not landed" list, oldest first, at most 50. Each row links the pull and lists "Waits for" and "To unblock" using the shared row component's dl facts.
  • Terminal: the "Pulls to land" screen has a "Green, not landed" section, one text line per pull.
  • GET …/pulls/:number and the MCP pull tool: waitsFor: { cause, says, action, line } or null. The OpenAPI route entry names the field.
  • MCP pulls tool: waitsFor, the line or null.

Changes from the review:

  1. Private repositories: /flow and the terminal now list only stalled pulls whose repository the viewer may read (readableStalled, which uses canRead). /flow's picture is drawn once for all admins, so the filter runs per viewer when the page or screen is drawn. On this forge canRead lets any admin read every repository, and /flow is admin-only, so today no non-admin could have seen these rows. The filter makes the list follow the repository's own rule anyway. The test uses a private repository: a guest and a non-admin get nothing from it, not even the hold note; its owner and an admin see it.
  2. The pull's JSON: GET …/pulls/:number now carries waitsFor.
  3. Terminal and docs: the terminal shows the list, and docs/features/flow-waiting.md has a "Green, not landed" how-to.
  4. /flow row: it uses row({ href, title, facts, data }) instead of a hand-made span, and the list's intro is now just "Green for more than six hours."
  5. Conflicts: they are not computed on /flow, the terminal or pulls without repo, because those read no git and computing them would mean reading git for every pull. The docs and a code comment say so. On those surfaces a conflicted pull names its next cause instead; the pull page, the pull's JSON, pull, and pulls with repo do read the merge and can say "conflicted".
  6. Query cost: pullWaitsFor takes the check summary the pulls tool already read. A pull that hasn't been green for six hours now costs no extra query; only a stalled pull reads who acts next, its hold and its chapter. No test measures this query count.
  7. Unrelated test change: test/surfaces-adversarial.test.ts is back to main's version. Its flake fix belongs in its own pull.

Tests:

  • test/pull-waits-for.test.ts gained the private-repository case, the /flow row markup and the terminal line.
  • The new test/pull-waits-for-api.test.ts checks that the REST answer is null before six hours and gives the line after.

I also ran 31 nearby test files: MCP pulls, /flow waiting, contract and OpenAPI, /llms.txt budget, MCP size, palette, pull page and pull timing. All pass. bun scripts/gate.ts --fix, bun x tsc --noEmit and bun scripts/design-lint.ts are clean.

Not done: the terminal rows have no key action, because every action in the line is a person's to take.

[
  {"go": "/flow", "look": "the waiting section", "expect": "a \"Green, not landed\" list: each row links the pull and lists \"Waits for\" and \"To unblock\" as two facts under it"},
  {"go": "/trevato/forge/pulls/15694", "look": "the line under the path and landing estimate", "expect": "one line naming the cause and the one action, when the pull has been green and unlanded for more than six hours", "ask": "Is the action the right one for this cause?"}
]

🤖 Generated with Claude Code

Closes #15803

commented

<!-- look-pages f43d2f26cf11 --> Look pages for f43d2f2, from the gate:

  • look pages (named): this pull changes src/web/pages/flow-waiting.ts, src/web/pages/flow.ts, src/web/studio/change.ts; a commit names /flow
commented

I didn't change anything for the gate's look note, so there is nothing new to push. The note is the "named" result: it confirms that a commit names /flow, which is in forge.json app.looks, so the pull already passes. One gap remains: the line on the pull page itself (src/web/studio/change.ts) has no picture. The only pull page in app.looks is /preview-admin/sample/pulls/3, and that sample pull has not been green and unlanded for six hours, so a Looks: line naming it would show nothing new.

---

A pull that has been green but unlanded for more than six hours now shows one line under its path saying what it waits for. The same text appears in the pull's JSON (waitsFor), the MCP pull tools and the terminal's waiting screen. Only people who can read the repository see it.

  • Where the line comes from: src/core/landing.ts works out why the pull has not landed (it needs review, it is behind main, a merge is held, and so on). src/flow/waits_for.ts turns that into the line.
  • Where it shows: /flow lists these pulls under "Green, not landed" (src/web/pages/flow-waiting.ts, src/web/pages/flow.ts), and the pull page renders the line (src/web/studio/change.ts).
  • Tests: test/pull-waits-for.test.ts covers each cause, the six-hour threshold and who can see the line. test/pull-waits-for-api.test.ts covers the JSON field for readers and non-readers.
  • Left out: no notifications or nudges. The line only reports; it does not try to land anything.

Try it: open /flow as an admin and read "Green, not landed". Then open a pull that has been green for more than six hours and read its waits-for line under the path.

[
  {"go": "/flow", "look": "the Green, not landed section", "expect": "each stalled green pull shows one waits-for line"},
  {"go": "/preview-admin/sample/pulls/3", "look": "under the path", "expect": "no waits-for line, because this pull is not stalled green; the page renders as before"}
]

🤖 Generated with Claude Code

Approved

All four earlier asks are met. /flow and the terminal now filter through readableStalled (canRead), and the test covers a private repo with a guest, a non-admin, its owner and an admin. The row uses the named row component with dl facts and a plain intro. The pulls-without-repo conflict gap is documented and the check summary is reused, so a young pull costs no extra query. The unrelated surfaces-adversarial change is reverted. The pull JSON carries waitsFor, the terminal screen and docs/features/flow-waiting.md exist, and README is untouched. Non-blocking: no test measures the query count for pulls that are not stalled.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs