Repository navigation
tri pr preflight: land the glue net-zero, paid by deleting inflight's unused merge_outcome (Closes #11126) - #11207
Merged
Merged
Conversation
… by deleting inflight's unused merge_outcome (Closes #11126) WIP commit for the real runs; the final message replaces it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… and a failed mktemp ends the step with 3 (Closes #11126) On macOS mktemp -d with no template ignores TMPDIR. In a sandbox it fails, and git worktree add was handed an empty path: "BUG: builtin/worktree.c:464" and exit 134. With a finding in dupe_scan this read as UNREAD for a reason that is not the branch's. The step now makes its directory as the budget step does and exits 3 before git is called, so dupe_scan's own exit 1 is never mistaken for it. Test first: the_dupes_base_scratch_is_made_under_tmpdir failed 24 pass, 1 FAIL, then 25/25 with 0 vacuous. gen/rust regenerated with t27c gen-rust (two lines differ), seal re-saved and --verify prints all hashes MATCH. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
gHashTag
marked this pull request as ready for review
October 20, 2026 02:22
This was referenced Oct 20, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11126
What
tri pr preflight [--quick]exists now.tri pr --helplistslanded,readyandpreflight.The glue is
preflightincli/tri/src/prcheck.rs: 40 added lines in that file (the#[path]mount ofgen/rust/tri/pr/preflight.rsat lines 22-23, thePreflight { quick }subcommand at 125-130, one dispatch line at 135, the function at 166-194). It holds no rule:kover the spec'sSTEPSand keeps the stepsstep_runs(k, quick)says run, so the steps spec(tri/pr): preflight -- the own-language budget from the merge base and the developer-home-path scan (Closes #11070) #11125 added (STEP_DUPES_BASE,STEP_BUDGET,STEP_DEVHOME) run without a glue change; a per-target step runs once per entry of the CHANGES output thatis_target, withSPECset topath_start..path_endof that entry;sh -c step_cmd(k)withSPEC,T27C(defaultt27con PATH) andTRI(the running binary) in the environment, framed as@@ preflight <k> <n> <exit> <len>\n<output>\n(exit 255 when a signal ended it, 127 when the shell could not start);git diffis UNREAD (exit 2) and not a FAIL on an error message read as a diff;rule_name,nameand, for a rule that did not pass,rule_whyand theevidence_from..evidence_toslice ofevidence_step; the last line ispreflight_exit_why, and the process exits withpreflight_exit(0 every rule passed, 1 a rule FAILed, 2 evidence could not be read);git rev-parse --show-toplevel), and prints one progress line per run on stderr.tools/queen/publish.pyis not touched.What pays for it (own-language net-zero, no exception)
git diff --numstat --no-renames BASE...HEAD, counted foreign files only:cli/tri/src/prcheck.rs+40 / -0,cli/tri/src/inflight.rs+0 / -52. Net -12. Per-file cap 40, total cap 80, gate compiled from the merge basecf2d61eb1(theown-languagestep),rc=0.tools/policy/foreign-exceptions.txtis not touched.Deleted:
pub enum Merge,pub fn merge_outcome(rc: i32) -> Mergeand the test moduleoutcome_tests(3 tests) incli/tri/src/inflight.rs. Proof it is dead:cargo check -p trion mastercf2d61eb1listsenum Mergeandfunction merge_outcomeas never used (inflight.rs), andrunin that file, the only entry point oftri merging, never calls it;cli/tri/srcincluded) are the three tests deleted with it; the same-namedmerge_outcome(ran_ok, on_branch)inprcheck.rsis another function with another signature and its tests are untouched;gen/mount,#[cfg(test)]module, doc or script refers to it;inflight.rs.Honest limit: there is no item in
cli/tri/srcwith no caller at all.cargo check -p tri --testson master prints no never-used warning, so each of the 11 never-used warnings of the plain build is an item with a test caller. This deletes 2 of them (Merge,merge_outcome) because they and their three tests form one block that nothing else leans on: no other test, no doc, no gen file. I left the other nine warnings alone; deleting any of them means editing tests that exercise other code or a module doc that describes the design (merkle_rootandhash_pair_testare used by the depin proof tests,gf16_invby the full-rank test of the champion weights,mutable_sitesby eight gates tests,CONTROL_IS_ALSO_A_GATEby a gates test,PidPathis the first half of thepiddir.rsmodule doc,renum::planandvsim::labelby their modules' tests), and the pair above already covers the 40 lines. Open PRs deleting the same lines: none (no open PR touchescli/tri/src,specs/tri/pr/preflight.t27, its gen file or its seal; 43 non-port PRs checked by file list, the port PRs add specs underspecs/port/only).A spec defect found by running it, fixed in the spec
STEP_DUPES_BASEmade its scratch checkout with a baremktemp -d. On macOS that ignoresTMPDIR, so inside a sandbox it fails andgit worktree addwas handed an empty path:BUG: builtin/worktree.c:464: How come '' becomes empty after sanitization?, exit 134. With a finding indupe_scanthe dupes rule then read UNREAD for a reason that is not the branch's. The step now isd="$(mktemp -d "${TMPDIR:-/tmp}/dupes.XXXXXX")" || exit 3; ...like the budget step, so a failedmktempends with 3, never with the 1 thatdupe_scanitself exits.Test first:
the_dupes_base_scratch_is_made_under_tmpdirfailed (24 pass, 1 FAIL), then 25 tests, 25 pass, 0 vacuous.gen/rust/tri/pr/preflight.rsregenerated witht27c gen-rust(two lines differ: the test count in the header and that command), seal re-saved,t27c seal specs/tri/pr/preflight.t27 --verifyprintsall hashes MATCH.The real runs
triiscargo build --release -p triof this branch;t27cis the release build of mastercf2d61eb1. Every run setsT27C=<that t27c>,ZIG_GLOBAL_CACHE_DIRand a freshZIG_LOCAL_CACHE_DIR. Scratch branches were made in a separate worktree fromorigin/master, committed locally, never pushed.1. Clean branch (
t27o/preflight-glue-g2, head59fdc5128): every rule PASS, the corpus ratchet NOT RUN2. Dupes: a scratch branch from
origin/masterappendscut_at_copy, a copy of the body ofcut_at, tospecs/tri/pr/preflight.t27and re-saves its seal, so the only rule that should fail is dupes3. Budget: a scratch branch adds 9 hand-written lines to
cli/tri/src/main.rsand deletes none (the #10538 shape)4. Developer home: a scratch branch adds a doc under
docs/now/that names a developer home directory5a. Fail closed, output of the wrong shape: a scratch branch with a one-line spec edit;
python3on PATH is a stub that printshelloand exits 0,T27C=/usr/bin/trueexits 0 and prints nothing5b. Fail closed, a step that did not run: the same branch,
T27C=/nonexistent/t27c(the shell answers 127)5c. SPEC names a file that is missing: the same branch with
specs/tri/pr/preflight.t27deleted from the work tree (the diff still names it). The realt27cexits 1 on it, which is a FAIL, not an unreadable output, so the exit is 1;keptis the rule that reads UNREAD (catof the missing file). The exit is 2 only when no rule FAILs, as 5a and 5b show6. The full command once, on the clean branch at head
59fdc5128(started 08:54:43, ended 09:06:01), the corpus ratchet includedChecks before the push
cargo check -p tri: 28 warnings; master has 30; the diff of the two warning lists is exactly the twoinflight.rsnever-used items gone, 0 new.cargo check -p tri --tests: no never-used warning, no error.cargo test -p tri --bin tri -- inflight:: prcheck::: 70 passed, 0 failed.python3 -I tools/dupe_scan.py:duplicate bodies: 1632 of 17571 in 632 group(s) across 2481 spec(s)andok: no new duplicate body, the same as the merge base.python3 -I tools/check_devhome_paths.py:OK: 29 file(s), 37 occurrence(s), all pinned.tri types ratchet:RATCHET: CLEAN.T27_SEAL_SKIP_GEN=1 python3 tools/check_seal_coverage.py:OK: 2939 seals, 2826 hold, 113 known-broken.rc=0(numbers above).Not run
check_seal_currency.py(it recomputes the four gen hashes of all 2939 seals); replaced byt27c seal specs/tri/pr/preflight.t27 --verifyon the one seal this diff changes, andcheck_seal_coverage.pywith the gen recompute skipped.cargo test -p tri(879 tests, some of them build lake packages in the temp dir); only theinflight::andprcheck::tests ran.no tri binary is built; the commit-time gates did not run: they look fortarget/release/triin the worktree, which the shared target dir does not provide. The gates above were run by hand.tools/queen/publish.pydoes not call this command yet (the note says so under Open).tri pr preflighton Linux or in CI.🤖 Generated with Claude Code