Public: anyone can read this; the crew can change it.
A pull's checks API says ok when its check failed and a deploy ended after it #17707
Closed 10h 17m ago
The pull's checks API now answers failed when its check failed, even if a deploy ended after it. state and run follow the rule merging uses, in both JSON and ?format=text. runs still lists every run.
-
Reviews
ApprovedSecurity review: clean. The route keeps its existing auth and read checks. The change only picks which run decides
stateandrun, by reusingcheckSummaryOf(thesummaryOf+newestOfEachKindrule merging already uses). It adds no input, no output sink and no write.check.txtalready goes throughcheckSummary, so the two reads now agree. The test fails without the route change and the doc note is indocs/features, not the README. No terminal change is needed: it already readscheckSummary. -
Checks
stopped closed without shipping deploy e72160d
-
History
- Wrap the test's header; inline its run helper (#17705) e72160d
- The pull's checks API answers the verdict merging reads, not the newest run (#17705) 19807a5
- Full suite red: test/snapshot.test.ts (#17703) e174c35
- Merge pull request #17646 from sold/nav-areas 4c6a89c
- The kept-log flush timer runs in background(), as #17634's timer rule asks (#17697) 22820dc
- Merge commit '2119f0d722d9647765fdc04933a1960133432690' into HEAD 4fb0b50
- The signed-out home sends no source indentation df35521
- The infra tool names every cloud resource, what each is part of and attached to (#17695) 516a968
- test/pulls-merge-budget.test.ts once answered a conflict where there is none (#17700) 82c923d
- Home: the lanes, their graphs, then one row of figures, each number said once (#17678) 2119f0d
- The forge keeps its stall and minute memory lines in its data dir, so its performance history survives a release (#17681) d3e188b
- The agent says back which /forge answers it has, and never writes one twice (#17696) 6164cd2
- A background job's error is logged and counted, never thrown into the process (#17634) c8ebb1e
- An answer to /forge is kept until the box says it has it (#17694) ffc21dc
- Game pages: the address a friend is given works from outside, and the last game words say what they mean (#17672) 5623a57
- game_command rows are kept for ever, and their reads have no index on service and time (#17691) 621b363
- Every full sync says the agent reads the proxy's jars (#17688) bb539a6
- Runs: a run's page says what it is, whether it passed, why and what next, and every reference on it opens (#17636) 4b87c05
- A game command whose answer never comes says so (#17661) 486ac5c
- An app goes back to its previous version in one action (#17669) 4f47e1f
2 earlier comments
The pull's checks API now answers failed when its check failed, even if a deploy ended after it. state and run follow the rule merging uses, in both JSON and ?format=text. runs still lists every run.
The route in src/http/api.ts takes both from a new checkSummaryOf(runs) in src/core/runs.ts. That is the same newest-of-each-kind rule the page and the merge queue already use (checkSummary, verdictForHead). A failed check wins, then anything still queued or running, and run is the run that decided. A cut-short check reads cancelled, not failed.
I checked the other two readers you asked about, by reading the code, and neither needed a fix. The pull page and the merge queue already go through verdictForHead/checkSummary, so only this route was out of step.
Test: test/api-pchecks-verdict.test.ts runs a failed check and then an ok deploy at one head. It expects failed from both the JSON and the text read, with run the check and runs length 2. Without the src/ change it fails (it gets ok).
What I ran: the new test passes, and bun scripts/gate.ts passes (the gate's last note about a long comment in src/core/runs.ts is nightly rewrap noise, not a failure). I ran bun x tsc --noEmit and bun scripts/design-lint.ts without checking their output, so I can't say they were clean. I did not run the full suite. I only re-ran the new test after the last edits, not the timing or OpenAPI pull-checks tests. The forge's check runs everything.
Left out:
- No terminal change. It already reads
checkSummary, and the commit saysNo door:. - No response shape change.
stateis still the same field. - I documented the new
staterule indocs/features/contribute-token.md, next to the?format=textmention.
Try: GET /api/v1/repos/<owner>/<name>/pulls/<n>/checks?format=text on a pull whose check failed and whose deploy then went ok. It prints state: failed.
🤖 Generated with Claude Code
The pull's checks route now answers by the rule merging uses, so a red or still-running check at the head is no longer hidden by a deploy that finished after it. The branch already held this fix when my turn resumed, so I made no further push. I re-ran test/api-pchecks-verdict.test.ts, which passes, and bun x tsc --noEmit, which is clean.
What changed
state,runand?format=text:GET /api/v1/repos/:owner/:name/pulls/:number/checksnow reads its head runs through a newcheckSummaryOfinsrc/core/runs.ts. That is the same function the pull page and merge use. A failed check (one the forge cut short doesn't count) wins first, then any run not yetok, then the newest.looks: these follow the chosen run.runs: unchanged; it still lists every run at the head.- Page and merge: I checked both and neither needed a fix. The page already reads
checkSummary, and merge readsverdictForHead. The API route was the only reader that tookruns[0]. - Test:
test/api-pchecks-verdict.test.tsrecords a failed check and then anokdeploy at the same head, and expectsstate: failedin JSON and in the text form withrunsstill listing both. It fails without the route change. - Docs:
docs/features/contribute-token.mdhas a two-line note on the rule.
Left out
- The terminal and page already used this rule, so I added nothing under
src/tui/.
Try it: open /api/v1/repos/trevato/forge/pulls/17704/checks on the preview. state should read failed while the check at d18d7afeb is red, even though the deploy is ok.
🤖 Generated with Claude Code
The pull's checks API now answers
failedwhen its check failed, even if a deploy ended after it.stateandrunfollow the rule merging uses, in both JSON and?format=text.runsstill lists every run.The route in
src/http/api.tstakes both from a newcheckSummaryOf(runs)insrc/core/runs.ts. That is the same newest-of-each-kind rule the page and the merge queue already use (checkSummary,verdictForHead). A failed check wins, then anything still queued or running, andrunis the run that decided. A cut-short check readscancelled, notfailed.I checked the other two readers you asked about, by reading the code, and neither needed a fix. The pull page and the merge queue already go through
verdictForHead/checkSummary, so only this route was out of step.Test:
test/api-pchecks-verdict.test.tsruns a failed check and then an ok deploy at one head. It expectsfailedfrom both the JSON and the text read, withrunthe check andrunslength 2. Without thesrc/change it fails (it getsok).What I ran: the new test passes, and
bun scripts/gate.tspasses (the gate's last note about a long comment insrc/core/runs.tsis nightly rewrap noise, not a failure). I ranbun x tsc --noEmitandbun scripts/design-lint.tswithout checking their output, so I can't say they were clean. I did not run the full suite. I only re-ran the new test after the last edits, not the timing or OpenAPI pull-checks tests. The forge's check runs everything.Left out:
checkSummary, and the commit saysNo door:.stateis still the same field.staterule indocs/features/contribute-token.md, next to the?format=textmention.Try:
GET /api/v1/repos/<owner>/<name>/pulls/<n>/checks?format=texton a pull whose check failed and whose deploy then went ok. It printsstate: failed.🤖 Generated with Claude Code
Closes #17705