feat(tools): a ratchet against writing the same function body again - #4291
Merged
Merged
Conversation
Measured over specs/ with comments and whitespace normalised away: 576 of 4021 function bodies are byte-identical copies, in 165 groups. magadd is written 30 times, magsub 30, sadd 29, magmul 21, smul 19. They were not refactored into one place - they were written again, because nothing could answer "does this function already exist?". tools/dupe_scan.py answers it with a file and a line (--name, --like), and gates the corpus against new copies with a ledger that moves down only: gf4..gf64 are parallel formats whose validate_format reads the same by design, so a gate demanding zero would be switched off rather than obeyed. The ledger maps a name to a LIST of group sizes. Keyed by name alone, magmul - two different bodies, one copied 21 times and one twice - made --bless and the gate disagree about the file --bless had just written. Closes #4290 Gates: python3 tools/dupe_scan.py --self-test -> ok (4 shapes, including a comment-only difference that IS a duplicate and a one-liner that is not); --bless then the gate exits 0; a planted copy of magadd makes it exit 1 naming the group that grew, and removing it exits 0; python3 scripts/ci/check_pr_branch_filters.py exits 0 with the new workflow classified and the ceiling lowered 25 -> 24. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
September 20, 2026 06:54
Contributor
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
This was referenced Sep 20, 2026
gHashTag
added a commit
that referenced
this pull request
Sep 20, 2026
… path (#4304) Three checks are red on master. Two are this loop's. CENSUS. tools/census/quiet.txt pinned `workflow files read 51`; the tree holds 57. The six added since the pin are #4277, #4279, #4281, #4283, #4291 and #4300, all merged by this loop, and cli-tri has been red since 2026-09-17. What moved, explicitly: quiet 51 -> 57 workflow files and 123 -> 135 "named a path but not quiet"; shell 51 -> 57 files, 72 -> 78 jobs, 249 -> 267 run-steps, 228 -> 246 steps the runner runs with `bash -eo pipefail`. The gates did not change; the population grew. HOME PATH. feed_defects.py carries a comment explaining that an absolute `/Users/<name>/t27/target/release/t27c` once went into 137 open issues -- and spells it out to say so, which is what the scan catches. It now reads `.../t27/target/release/t27c`, same meaning, no home directory. WORKTREES. That gate also failed in every worktree on a path no commit contains: it excludes the `.git` DIRECTORY, and a worktree's `.git` is a FILE holding `gitdir: /Users/...`. `--exclude=.git` joins `--exclude-dir=.git`. The reviewer measures in a detached worktree and every bee works in one. NOT FIXED HERE: `coverage` reports 544 stale seals and has no successful run in its last 60 on master, reaching back past 2026-09-18. Re-sealing 544 specs records what the compiler now produces -- a decision about the ledger, not a repair. Closes #4303 Co-authored-by: Claude <noreply@anthropic.com>
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 #4290
576 of 4021 function bodies in
specs/are byte-identical copies (165 groups;magadd30 times,sadd29). The tool answers the question that was never asked —--name <fn>and--like <file>print the file and line to reuse — and the gate stops the number growing, with a ledger that moves down only.Verified: self-test over four shapes; bless-then-check agrees; a planted copy exits 1 naming the group that grew; removing it exits 0.
🤖 Generated with Claude Code