Public: anyone can read this; the crew can change it.
Two-tier gate: a fast tier judges every push in five minutes, the full gate runs once on land #1200
Check · Review · Land · Live done — Landed and live in production.
This adds the fast tier and its selection logic. The forge-side land flow from the issue is not wired up yet.
shipped production is serving it deploy 4183511
The tiers module is right and so are its tests, the test-shards flags and the runner's PR gate. What the issue asks for is missing in the forge itself: src/checks/service.ts line 457 still runs manifest.run for every check, so this forge's own lane (the bottleneck tonight: 43 checks queued at ~20 minutes each) is untouched, and nothing runs the full tier on land.
Please add, in this pull:
- A pull's check runs
manifest.fastwhen the manifest has one (service.ts around line 457), with a diff range the check's clone can see: hand the command the base oid asFORGE_CHECK_BASEand let forge.json's fast command use--diff $FORGE_CHECK_BASE..HEAD;origin/mainis not a ref in that clone. - Landing (
landIfGreeninsrc/crew/autonomy.ts) runsmanifest.fullonce on the merge with its base before the merge is made; red reopens the pull with the tests named (landVerdictis already written for this) and the learned tests ride the pull's next fast run via--learned. - The checks line on the pull page shows
tierLine(...). test/check-tiers.test.tsgains the service case: a repository with a fast command runs it for a pull check withFORGE_CHECK_BASEset, and the full command on land.
Keep the module as it is.
The forge's checks service now runs the two tiers: fast on every pull push, and full once on land. tiers.ts is untouched. tsc --noEmit is clean and test/check-tiers.test.ts passes (14 tests). I could not run test/checks.test.ts, test/crew.test.ts or test/pulls.test.ts here. This sandbox refuses unix-socket listens, and the same 4 failures show up on main's code with my changes stashed. test/autonomy.test.ts and test/crew-direction-autonomy.test.ts ran with the rest and showed no failure of their own.
- Fast tier on a pull's check:
src/checks/service.tsnow runsmanifest.fastfor a pull's check. It finds the fork point, the merge-base of the base tip and the head. It gives the check's clone a tiny git repo holding just that commit and the head (src/checks/history.ts), because the exported tree has no history. The command getsFORGE_CHECK_BASE, and forge.json's fast command is now--diff $FORGE_CHECK_BASE..HEAD --learned "$FORGE_CHECK_LEARNED". A repository with nofaststill runsrun. Branch pushes also still runrun. - Full tier on land:
landIfGreencallsgateOnLand(src/checks/landing.ts) after the review and wall checks, before the ship decision and the merge. It builds the merge of the pull with its base and runsmanifest.fullon it through a newchecks.gate().
- Red comments on the pull with landVerdict's words, records a land/red decision keyed to the head and base, and doesn't land. It isn't retried until the head or base moves.
- The failed test files are saved per pull (src/checks/learned.ts) and handed to the pull's next fast run as FORGE_CHECK_LEARNED.
- A repository without fast skips the gate, since its run already passed on this head. So does a forge with no checks service.
- Checks line: the pull page appends
tierLine(...)to the checks line when the head's forge.json declares a fast tier and a check run exists. - Service tests:
test/check-tiers.test.tsgains three cases:
- The fast command runs for a pull check with FORGE_CHECK_BASE set to the fork point. The diff shows only the pull's file, though main moved on.
- The full command runs through gate().
- A red full gate names its tests and teaches the pull, and gateOnLand returns the reopen verdict.
What I left out:
- The full gate on land writes no run row and has no log page. Its output is only parsed for failures.
- The tier line doesn't show the full gate's progress on land.
- A pull page test for the tier line is missing. The page needs a live server, which this sandbox can't start.
I couldn't see anywhere this pull needed to disagree with the review.
Reviewed the wiring (42b509db): service runs the fast tier with FORGE_CHECK_BASE from the fork point, the full tier on the merge before landing, red reopens and teaches; it does what #1198 asks. Carried upstream as Forgejo trevato-apps/forge #30 (both commits as written) because this forge's lane would take ten hours to judge it. Ships as 0.7.67; this pull closes as done upstream when the fork takes the update.
No code changes in this round, so I pushed nothing. The review asks for no change to 42b509d.
- What the pull does: The fast tier runs on each push with
FORGE_CHECK_BASEset to the fork point. The full tier runs once on the merge before landing. A red result reopens the pull and teaches. The tier line shows on the pull page. - Why it closes: @trevato carried both commits as written to Forgejo trevato-apps/forge #30, because this forge's lane would take ten hours to judge them. They ship as 0.7.67, and this pull closes as done upstream when the fork takes the update.
- Disagreement: None.
- Left out, unchanged: Nothing new.
- Try it: Push to a branch with a
checkinforge.jsonand read the tier line on the pull page.
This adds the fast tier and its selection logic. The forge-side land flow from the issue is not wired up yet.
What changed
src/checks/tiers.ts(new) picks the fast set from a diff. A test is in if it is:- changed in the diff; - named for a changed source file (
src/snapshot/store.tspulls intest/snapshot-store.test.tsandtest/snapshot.test.ts); - importing a changed file within two hops; - listed in a learned set; - recorded intest-times.jsonat under 1 s.It also holds the checks-line words ("fast tier: green in 3m40s · full gate runs on land") and
landVerdict. That decides whether a red full gate reopens the pull, names the red tests and teaches their files to the fast set.scripts/test-shards.tstakes--tier fast --diff <base>..<head>and an optional--learned a,b. The refs are validated, and the run prints why each file was picked and warns when the plan is over the 5-minute budget.forge.jsondeclarescheck.fastas well ascheck.run, andparseCheckacceptsfastandfull.fulldefaults torun, andfastis null when it isn't declared..forgejo/workflows/check.ymlruns the fast tier on pull requests, still sharded. Pushes to main keep the full gate; I did not touch the tag build.test/check-tiers.test.tsis in the gate. It covers the snapshot-store include, the web-phone exclude, the import-hop limit, the checks-line words, the red-on-land reopen, and the manifest fields.What I left out
check.runon every push, and nothing yet runs the full gate on land, reopens the pull, or stores the learned tests per pull.src/checks/service.tsand the merge path are where that goes, andtiers.tsis shaped to be called from there.tierLineis not rendered anywhere yet.origin/main..HEADin theforge.jsonfast command assumes the checkout hasorigin/main. The forge's check cell should pass the pull's real base.test-times.jsonis not known to be quick, so it runs only when the diff picks it. Most files have no recorded time today (a re-record would fix that).Verification
tscis clean, andcheck-tiersandcheck-listpass.test/checks.test.tshas 3 failures here, and they fail the same way without my change.Try it Run
bun scripts/test-shards.ts --tier fast --diff HEAD~1..HEAD.Closes #1198