Skip to content

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

Closed
gHashTag wants to merge 5 commits into
masterfrom
w48-tri-fmt
Closed

tri fmt: run the formatter and restore every file that was not yours#3044
gHashTag wants to merge 5 commits into
masterfrom
w48-tri-fmt

Conversation

@gHashTag

@gHashTag gHashTag commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Closes #3042

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. So 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 on this worktree: 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. §466 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.

§467 is the empty-population half of #3025, kept in this PR 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 522 passed, 0 failed, 0 filtered
fmtmine filter 5 passed, 517 filtered — 5 is the number of #[test] in the module
tri skill check 431 sections, no number used twice

Mutation:

mutant result
restore everything dirty instead of the collateral 2 tests FAILED, 3 passed
drop the comment filter, so a commented-out step counts as a gate 1 test FAILED, 4 passed
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 in this PR 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.

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 466 and 467. 466 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.
467 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.
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-03 18:40:45 UTC

Summary

Status Count
Total Open PRs 13
PRs with Failing Checks 11
PRs with All Checks Green 2
READY 0
FAILING 11
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.

Fifth section-number collision on .claude/skills/ci-gates/SKILL.md: master
took 466 and 467 in #3043 while this branch was open. Resolved by rebuilding
from origin/master and re-appending my two sections as 468 and 469 -- the
master prefix is byte-identical, and the file is 433 sections, all unique and
ascending.

468 is "A lesson written down four times, and the command run anyway".
469 is "The machine that could not answer, and the population nobody asked".
@gHashTag

gHashTag commented Sep 3, 2026

Copy link
Copy Markdown
Owner Author

Renumbered after a collision — §466/§467 are now §468/§469

Master took 466 and 467 in #3043 while this branch was open. That is the fifth number collision on this file for me. Resolved by rebuilding from origin/master and re-appending my two sections at the end:

  • §468A lesson written down four times, and the command run anyway
  • §469The machine that could not answer, and the population nobody asked

The master prefix is byte-identical (asserted, not eyeballed), and tri skill check reads 433 sections, no number used twice, ascending. cargo test -p tri --bins529 passed, 0 failed.

Everywhere the PR description above says §466 or §467, read §468 and §469.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-03 19:10:49 UTC

Summary

Status Count
Total Open PRs 13
PRs with Failing Checks 10
PRs with All Checks Green 3
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.

master took 468-470 while this branch was open. Mine move to 471 and 472.
The master prefix is asserted byte-identical, not eyeballed.
…ion)

The command's first real use, and it found its own gap: the byte-prefix test
refused because master had REWORDED an existing section while this branch was
open, so the file was an older base plus a tail rather than any commit's file
plus an append. Falls back to identifying the tail by shared section TITLES,
and says which method it used.

Numbers were already right (471, 472); the base region was stale, so the file
is rebuilt on origin/master with my two sections re-appended. Master prefix
asserted byte-identical.
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-03 19:55:50 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.

… last line

The first real use of `tri skill renumber` shipped a defect and this commit is
the repair. A tail identified by TITLE starts at its first `## ` heading with
no leading newline, and concatenating it onto a trimmed base put that heading
in the middle of a line -- so it stopped being a heading. 436 sections became
435, and the COUNT is what caught it, not reading the file.

Fixed in the tool with an explicit joiner plus a pre-write guard that refuses
unless the rebuilt file has exactly base + tail sections. Both are tested and
the joiner mutant is killed.

Here: 436 sections, master prefix asserted byte-identical, my two sections at
471 and 472.
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-03 19:58:21 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.

@gHashTag

gHashTag commented Sep 3, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #3053 — same tree, one commit, properly referenced.

Check L1 TRACEABILITY checks every commit in a PR, and this branch carries a repair commit whose message has no Closes/Refs. A follow-up commit cannot clear that, and the only in-place fix is a force-push, which is not done here. So the branch is replaced rather than rewritten.

Everything measured on this branch stands and is restated in #3053: 165 dirty / 1 kept / 164 restored, FROZEN_HASH intact, 539 tests, two mutants killed. The three renumberings this branch went through — collisions five, six and seven — are the evidence behind #3051, and the last of them was resolved by tri skill renumber itself in #3052.

@gHashTag gHashTag closed this Sep 3, 2026
gHashTag added a commit that referenced this pull request Sep 3, 2026
…3053)

* tri fmt: run the formatter and restore every file that was not yours

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.

* Renumber to 477/478 with the merged tri skill renumber

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.
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