Skip to content

feat(tri census explain): name the file behind a moved census number - #5826

Merged
gHashTag merged 1 commit into
masterfrom
feat/tri-census-explain
Oct 4, 2026
Merged

gHashTag merged 1 commit into
masterfrom
feat/tri-census-explain

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 3, 2026

Copy link
Copy Markdown
Owner

What

tri census explain [--max N] is read-only. For each pinned census whose output differs from its ledger, it does four things:

  1. Lists every moved line. Rows are matched by their words with numbers folded, so you see run: steps 283->284. pin --gate shows only the first moved line.
  2. Finds the bless commit and the candidates. The bless commit is the one that last wrote tools/census/<name>.txt. The candidates are the files changed since then: git diff against it, plus untracked files, minus tools/census/.
  3. Puts each changed file back alone. Each file goes back to that commit by itself, in a scratch copy of the whole tree. The census runs again, and the lines that file moves are printed. Attribution is refused when the copy does not reproduce today's reading byte for byte.
  4. Puts all tried files back together and reports whether that reproduces the ledger.

Exit codes: 0 when nothing moved, 1 when something moved. The copy is dropped before process::exit. The first build skipped that and would have left a copy of the tree behind on every run that had something to report.

Why

On #5787 the gate's first line was files read 22 -> 23, and the cause sat further down. The PR read "open" for six cron ticks while cli-tri was red on it. On master today, the shell ledger's bless commit is 1057 changed files away from the tree.

Real output: this branch before its own bless (stderr included)

  shell    MOVED since blessed at 769f32521 (tools/census/shell.txt)
      run: steps 283->284
      the runner does 262->263 no container, so bash -eo pipefail
    which change moves it -- each changed file put back to 769f32521 alone, the census run again:
      .github/workflows/cli-tri.yml   moves 2 line(s)
          run: steps 283->284
          the runner does 262->263 no container, so bash -eo pipefail
    1057 file(s) changed since 769f32521: 1057 tried, 1 move this census, 1056 do not alone.
    All tried files put back together: reproduces the ledger -- yes.

That run used --max 5000 and took 101 s for 1057 files. The default --max 600 takes about a minute. After the bless, all three censuses read unchanged and the exit code is 0.

Test: scripts/ci/test_a_moved_census_names_its_file.py, a new step in cli-tri

The binary under test blesses scratch repositories. 36 checks:

  • Clean. Exit 0, and all three censuses read unchanged.
  • Moved. a.yml gains a step and b.yml is new; those two move shell 2->4. decoy.txt and notes.md also change. The test checks that:
    • the movers are exactly a.yml and b.yml;
    • the bystanders are not named;
    • quiet is moved by b.yml alone;
    • fetches is unchanged;
    • together reproduces the ledger.
  • --max 1. One file is tried, 3 are reported as NOT tried, and together says NO.
  • Ledger never committed. The output says so and nothing is attributed.
  • Every run must leave the repository byte-identical and TMPDIR empty. A negative control shows the comparison catches a one-byte edit.

Four mutations of census.rs, each seen red:

Mutation Checks that went red
put-back is a no-op 6
no drop before exit 2
only the first moved line 1
a tried file is not restored 5

cargo test -p tri census passes 29 tests, 4 of them new for row matching. rustfmt --check is clean, and tri gates tests --gate passes.

Census

shell run: steps 283 -> 284 and the runner does 262 -> 263. Both moves come from the one new step and are blessed in this commit.

Merge order: #5787 and #5824 also bless tools/census/shell.txt (283 -> 285 -> 286). Whichever of these merges second needs a re-bless. tri census explain names the file behind it.

Not established

  • A change that moves a number only together with another change reads as moving nothing alone. The together line shows that something remains, not which pair causes it.
  • The census code is this build. Putting back a census's own source changes what it reads, not how it counts.
  • Files beyond --max are counted, not tried.
  • gates shell reads 0 steps for a step written - run: x. No workflow uses that shape today, but a new one would not move the census, so explain would have nothing to explain.

Closes #5825
Refs #5786

🤖 Generated with Claude Code

`tri census pin --gate` prints the first differing line and stops: it says
a census moved, not what moved it. On #5787 the first line was `files read
22 -> 23` and the cause sat further down, and the PR read "open" for six
ticks while cli-tri was red on it.

`tri census explain` lists every moved line (rows matched by their words,
numbers folded), then puts each file changed since the ledger's commit
back to that commit ALONE in a scratch copy of the tree and runs the census
again. The copy must reproduce today's reading byte for byte or nothing is
attributed; all tried files put back together must reproduce the ledger or
it says NO. Read-only; the copy is dropped before `process::exit`.

On this branch before the bless it named .github/workflows/cli-tri.yml as
the only one of 1057 changed files that moves `shell` (101 s for all).

Census moved, blessed here: shell `run: steps` 283 -> 284 and `the runner
does` 262 -> 263 -- the one new cli-tri step that runs
scripts/ci/test_a_moved_census_names_its_file.py (4 mutations seen red).

Closes #5825
Refs #5786

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-03 21:35:27 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 42
PRs with All Checks Green 8
READY 7
FAILING 42
PENDING 0
NO CHECKS YET 0

These columns do not partition: 7 + 42 + 0 + 0 = 49, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=b45a356c2eb6 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

This was referenced Oct 4, 2026
@gHashTag
gHashTag merged commit b756a10 into master Oct 4, 2026
36 of 39 checks passed
gHashTag added a commit that referenced this pull request Oct 4, 2026
… it)

#5849 (tri harness --save-state / --storage-state) was merged into this
branch as 18a7212; this merge brings master in so #5828 can land both.
tools/census/shell.txt conflicted (master moved to 284 steps with #5826)
and was re-blessed with `tri census pin --bless`: jobs 85 -> 86, run: steps
284 -> 285, the +1/+1 this PR pinned. `tri census pin --gate` PASS;
scripts/ci/test_a_page_is_measured_at_both_widths.py 64 passed.

Refs #5827

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tri census explain: name the file behind a moved census number

1 participant