Skip to content

tri fmt: run the formatter and restore every file that was not yours - #3053

Merged
gHashTag merged 7 commits into
masterfrom
w48b-tri-fmt
Sep 3, 2026
Merged

tri fmt: run the formatter and restore every file that was not yours#3053
gHashTag merged 7 commits into
masterfrom
w48b-tri-fmt

Conversation

@gHashTag

@gHashTag gHashTag commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Closes #3042 · replaces #3044

Measured, in this repository

cargo fmt --all on a one-file change 165 tracked files dirty
of those, collateral 164
among the collateral bootstrap/src/compiler.rs, M5-frozen — the freeze gate goes red
cargo fmt -p t27c on a two-file change, earlier this week 155
workflows invoking cargo fmt or rustfmt none

Nothing keeps this tree formatted, which is why it is unformatted. Running the formatter is not a tidy-up — it is a 164-file diff authored on top of your own change, plus a broken content hash.

What the command does

Take the dirty set, run the formatter, restore every file that was clean before and is dirty after. Clean-before means identical to HEAD, so the restore loses nothing — and that is the whole reason the dirty set is taken first rather than derived from a base ref.

End-to-end: 165 dirty, 1 kept, 164 restored, FROZEN_HASH intact. Every restored path is printed. --dry-run reports the dirty count and whether any workflow formats, without running anything.

Why a command and not a note

It is already a note, four times: §72 (150 files, same frozen file, same grep), §381, §407, §447. It was recorded four times and the command was run anyway, this week. §471 says that plainly — when a rule has been written down repeatedly and broken anyway, the next unit of work is an executable, not another paragraph — and the count of prior sections is the evidence, taken with grep -c before appending.

§472 is the empty-population half of #3025, kept here because it is the same shape: a guard written for one way of producing no numbers did not cover the other.

Evidence

cargo test -p tri --bins 539 passed, 0 failed, 0 filtered
fmtmine filter 5 passed — the module's #[test] count
tri skill check 436 sections, no number used twice; master prefix asserted byte-identical

Mutation:

mutant result
restore everything dirty instead of the collateral 2 tests FAILED
drop the comment filter, so a commented-out step counts as a gate 1 test FAILED
restored 5 passed

Two limits, stated rather than left to be found

  • It cannot help with the file you are editing. That file is dirty before, so it is kept — correctly — and the formatter's rewrite of the rest of it is kept with it. Formatting the thirteen lines this PR adds to main.rs also sorted that file's mod declarations, and a 13-insertion diff was reported as 31 insertions and 18 deletions. This is §447 arriving inside the new tool; the tell is the shape, deletions on a pure addition. The diff here is 13 insertions, 0 deletions, because the file was checked out and the hunks re-applied by hand.
  • A concurrent process sharing the same worktree can dirty a file between the two git status calls and have it reverted. The window is the formatter's runtime; every restored path is printed for that reason. Separate worktrees are unaffected — git checkout is per-worktree, unlike git stash.

Why this replaces #3044

That branch carried a repair commit with no issue reference. Check L1 TRACEABILITY checks every commit in the PR, so a follow-up commit cannot clear it, and the only in-place fix is a force-push — which is not done in this repository. Same tree, one commit, properly referenced.

The branch it replaces is also where §471/§472 were renumbered three times (collisions six and seven), the last one resolved by tri skill renumber itself — see #3051 and #3052.

Closes #3042

`cargo fmt --all` on a one-file change leaves 165 files dirty, 164 of
them collateral, including bootstrap/src/compiler.rs -- M5-frozen, so
the freeze gate goes red as a side effect of tidying another crate.
`-p t27c` produced 155 earlier this week.

Nothing keeps this tree formatted: no workflow invokes cargo fmt or
rustfmt. An unformatted tree is this repository's normal state, so
running the formatter is not a fix, it is a 164-file diff on top of
your own.

`tri fmt` takes the dirty set, runs the formatter, and restores every
file that was clean before and is dirty after. Clean-before means
identical to HEAD, so the restore loses nothing -- which is why the
dirty set is taken first rather than derived from a base ref. Measured
on this repository: 165 dirty, 1 kept, 164 restored, FROZEN_HASH intact
afterwards. Every restored path is printed.

Sections 471 and 472. 471 is the reason this is a command and not a
note: the skill already recorded this four times -- 72, 381, 407, 447
-- and the command was run anyway. When a rule has been written down
repeatedly and broken anyway, the next unit of work is an executable.
472 is the empty-population half of #3025, kept here because it is the
same shape: a guard written for one way of producing no numbers did not
cover the other.

Two limits, both stated in the module and the section rather than left
to be found. It cannot help with the file you are editing: formatting
the thirteen lines added to main.rs also sorted that file's mod
declarations, 13 insertions reported as 31 insertions and 18 deletions.
And a concurrent process sharing the worktree can dirty a file between
the two git status calls and have it reverted; separate worktrees are
unaffected, git checkout being per-worktree unlike git stash.

Replaces the branch behind #3044, which carried a repair commit with no
issue reference. L1 checks every commit and there is no way to fix a
pushed commit message without a force-push, which is not done here.
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-03 20:03:15 UTC

Summary

Status Count
Total Open PRs 15
PRs with Failing Checks 10
PRs with All Checks Green 5
READY 0
FAILING 10
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=9b8875f1c9d4 != 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).

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

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

Refs #3042

Eighth collision. master took 471 and 472 in #3049 -- and not only the numbers:
that PR's own 472 is "Cannot check is not absent", the same class this branch's
sections are about. Numbers moved by the command from #3052; the subject overlap
is noted rather than resolved by renaming.
gHashTag added a commit that referenced this pull request Sep 3, 2026
…r than master

Refs #3051

Eighth collision, and the first one BETWEEN two of my own open branches rather
than with master: #3053 and this one both claimed 471. Resolved with the
command's own --base flag pointed at the sibling branch instead of master, which
is what that flag is for and had not been used in anger before.

Note for the tool: it can only see one base at a time, so N open branches still
need N-1 sequential renumbers in a chosen order. It does not discover siblings.
@github-actions

github-actions Bot commented Sep 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 Sep 3, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-03 20:24:13 UTC

Summary

Status Count
Total Open PRs 15
PRs with Failing Checks 10
PRs with All Checks Green 5
READY 0
FAILING 10
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=9b8875f1c9d4 != 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).

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-03 20:57:06 UTC

Summary

Status Count
Total Open PRs 17
PRs with Failing Checks 10
PRs with All Checks Green 7
READY 1
FAILING 10
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=9b8875f1c9d4 != 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).

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

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

Refs #3042

Ninth collision. Resolved by tri skill renumber against origin/master.
gHashTag added a commit that referenced this pull request Sep 3, 2026
Refs #3051

Ninth collision, and the first use of --first in anger. #3053 is open with two
sections that will land at 476/477, so this one starts at 478 -- numbered
against the SHARED base, which is the whole point of the flag: --base pointed
at that sibling would have rebuilt this file on it and carried its sections
into this PR.
Refs #3042

Eleventh collision. Two process notes from this one.

The renumber ran twice against a STALE binary before this: the merge was left
uncommitted (conflicts resolved but not concluded), so renum.rs was not in the
tree and `tri skill renumber` answered with its usage text. The check printed
OK=False and prefix-identical False, and this time I stopped on it instead of
pushing -- which is the whole difference from the repair two commits earlier.

And master moved between the fetch and the merge, so the first completed merge
still did not have origin/master as an ancestor. Loop until it does, then build,
then renumber, then verify -- in that order, each step read.
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

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

@gHashTag
gHashTag merged commit fa590f7 into master Sep 3, 2026
28 of 29 checks passed
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-03 22:01:08 UTC

Summary

Status Count
Total Open PRs 12
PRs with Failing Checks 10
PRs with All Checks Green 2
READY 0
FAILING 10
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=9b8875f1c9d4 != 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).

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.

cargo fmt here rewrites 164 files including the frozen one, and four skill sections did not stop it

1 participant