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

A pull reads green and can land while its tests are still queued #17258

opened this

Merged 37h 24m ago, live in production

A head now reads green only when the newest run of every kind is ok. A preview deploy that finishes in seconds no longer covers a check that is still queued or running (#17256). I made no new commits for this review round, so there is nothing new to push.

Notes

opened this

A head now reads green only when the newest run of every kind is ok. A preview deploy that finishes in seconds no longer covers a check that is still queued or running (#17256).

I made no new commits for this review round, so there is nothing new to push. I ran each rule the feedback named against the existing commit:

  • Both doors: bun scripts/gate.ts --explain passes. The change is inside checkSummary, so the page, API, MCP and terminal all read the same value. No page, action, route or tool changed, so no src/tui/ file or docs/features/ how-to was needed.
  • Real input in tests: the test builds real runs with createRun, claimRun and finishRun. It has no as never, and bun x tsc --noEmit is clean.
  • Dead code: test/unused-exports.test.ts passes. checkSummary was already exported, and I added no exports.
  • Name the issue: the commit subject ends with (#17256), and the gate's "name the issue" rule passes.
  • Comment width: bun scripts/gate.ts --fix rewrapped nothing. It notes one comment line over 100 columns in src/core/runs.ts, which it says the nightly rewrap handles on main.

What changed: in src/core/runs.ts, checkSummary now picks the first uncut failed run, then the first run that is not ok, then the newest. An unfinished check therefore reads queued or running, and mergePull refuses with checks_required until it finishes ok. A cut check still reads "cancelled", as @trevato confirmed.

Test: test/check-summary-queued-under-deploy.test.ts records a check and then a deploy, finishes only the deploy, and expects "queued" and a refused merge. It then claims and finishes the check and expects "running" and then "ok". It fails without the fix.

What I ran:

  • tsc --noEmit is clean.
  • The new test and unused-exports pass.
  • check-summary-red-under-deploy, pull-verdict, queue-verdicts and pull-verdict-tui pass.
  • scripts/fast.ts named 3566 files, about 300 minutes of tests, so I did not run them all. The forge's full check does that on push.

The unused-exports run also printed a note that useWatchProbeByDefault and useReachByDefault are no longer dead. They are unrelated allow-list entries, so I left them.

I chose not to touch verdictForHead or the merge queue. They already read every kind.

Continues #17258

3 earlier comments
commented

Reviewed against main's src/core/runs.ts: the change is right. verdictForHead already keeps only the newest run per kind:env, so an older check cut by a restart and requeued never reaches the new find(state !== "ok"); only the newest check and newest deploy do. A head whose newest check was cut now reads "cancelled" instead of riding the deploy's green, which matches what the merge queue already requires (every verdict row ok). The new test covers the reported case. Land it once its own check passes.

commented

A head now reads green only when the newest run of every kind is ok. A preview deploy recorded after a queued check no longer covers it. The new test and the existing check-summary tests pass, along with checks, checks-restart, no_change_recheck and apps-adversarial-rules. tsc is clean and the gate reports no fails.

What changed

  • checkSummary in src/core/runs.ts picks the answering run in this order:
    1. The newest non-cut failure.
    2. Otherwise the first run of any kind that is not ok (queued or running).
    3. Otherwise the newest run.
  • A cut failure still reads cancelled. A runner-silent check becomes the answering run, so the admin waiver in checkAllows keeps working.
  • Because the check is now the answering run, checkStale reads its baseOid and the stale guard applies again.
  • This covers the pull API's check field, checkAllows, mergePull with requireChecks, and the stalled-green line. No limit, timeout or retry changed.
  • The restart-redeploy point trevato raised (#17250, #17246) needs no extra handling. The old read depended on which row was newer, and the new one doesn't, so any deploy order gives the same answer.

Test test/check-summary-queued-under-deploy.test.ts records the check first and the deploy after it, which is the failing order. It fails without the fix, where the state reads ok.

  • The check is queued: the state is queued and mergePull with requireChecks returns checks_required.
  • The check starts: the state is running.
  • The check finishes ok: the state is ok.

Not done

  • latestRunsForIssues takes the newest run across check kinds the same way, so list views still show the false green. The issue names this as a separate follow-up, and I left it for that.
  • gate.ts keeps one note about a comment line over 100 columns in src/core/runs.ts. It was there before my change and --fix did not rewrap it.
  • No page, action, route or MCP tool changed, so there is no terminal-side or docs/features/ change.

Try it bun test test/check-summary-queued-under-deploy.test.ts test/check-summary-red-under-deploy.test.ts

commented

A head now reads green only when the newest run of every kind (check, deploy) is ok. A deploy recorded after a queued check no longer covers it, whichever row is newer. This is pushed on the branch. The new test and the existing check-summary tests pass, along with checks, checks-restart, no_change_recheck and apps-adversarial-rules. tsc is clean and the gate reports no fails.

What changed

  • checkSummary in src/core/runs.ts now picks the answering run in this order:
    1. The newest non-cut failure.
    2. Otherwise the first run of any kind that is not ok (queued or running).
    3. Otherwise the newest run.
  • A cut failure still reads cancelled. A runner-silent check becomes the answering run, so the admin waiver in checkAllows keeps working.
  • This corrects the pull API's check field, checkAllows, mergePull with requireChecks, and the stalled-green line. No limit, timeout or retry changed.
  • The false green no longer depends on whether the deploy row is newer, so restart redeploys (#17250, #17246) read correctly too.

Test test/check-summary-queued-under-deploy.test.ts records the check first and the deploy after it, the failing order trevato asked for. It fails without the fix, where the state reads ok.

  • Check queued: the state is queued, and mergePull with requireChecks returns checks_required.
  • Check started: the state is running.
  • Check finished ok: the state is ok.

Gate rules

  • Both doors: no page, action, route or tool changed, so there is no terminal or docs/features/ change.
  • Test input: the test builds real records, with no as never.
  • Dead code: I added no exports.
  • Issue number: the commit line names #17256.

Not done

  • latestRunsForIssues takes the newest run across check kinds the same way, so list views still show the false green. The issue names this as a separate follow-up.
  • gate.ts notes one comment line over 100 columns in src/core/runs.ts. It was there before my change and --fix did not rewrap it.

Try it bun test test/check-summary-queued-under-deploy.test.ts test/check-summary-red-under-deploy.test.ts

commented

A head now reads green only when the newest run of every kind is ok. A preview deploy that finishes in seconds no longer covers a check that is still queued or running (#17256).

I made no new commits for this review round, so there is nothing new to push. I ran each rule the feedback named against the existing commit:

  • Both doors: bun scripts/gate.ts --explain passes. The change is inside checkSummary, so the page, API, MCP and terminal all read the same value. No page, action, route or tool changed, so no src/tui/ file or docs/features/ how-to was needed.
  • Real input in tests: the test builds real runs with createRun, claimRun and finishRun. It has no as never, and bun x tsc --noEmit is clean.
  • Dead code: test/unused-exports.test.ts passes. checkSummary was already exported, and I added no exports.
  • Name the issue: the commit subject ends with (#17256), and the gate's "name the issue" rule passes.
  • Comment width: bun scripts/gate.ts --fix rewrapped nothing. It notes one comment line over 100 columns in src/core/runs.ts, which it says the nightly rewrap handles on main.

What changed: in src/core/runs.ts, checkSummary now picks the first uncut failed run, then the first run that is not ok, then the newest. An unfinished check therefore reads queued or running, and mergePull refuses with checks_required until it finishes ok. A cut check still reads "cancelled", as @trevato confirmed.

Test: test/check-summary-queued-under-deploy.test.ts records a check and then a deploy, finishes only the deploy, and expects "queued" and a refused merge. It then claims and finishes the check and expects "running" and then "ok". It fails without the fix.

What I ran:

  • tsc --noEmit is clean.
  • The new test and unused-exports pass.
  • check-summary-red-under-deploy, pull-verdict, queue-verdicts and pull-verdict-tui pass.
  • scripts/fast.ts named 3566 files, about 300 minutes of tests, so I did not run them all. The forge's full check does that on push.

The unused-exports run also printed a note that useWatchProbeByDefault and useReachByDefault are no longer dead. They are unrelated allow-list entries, so I left them.

I chose not to touch verdictForHead or the merge queue. They already read every kind.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs