Skip to content

feat(tools): a ratchet against writing the same function body again - #4291

Merged
gHashTag merged 1 commit into
masterfrom
feat/dupe-ratchet
Sep 20, 2026
Merged

gHashTag merged 1 commit into
masterfrom
feat/dupe-ratchet

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

Closes #4290

576 of 4021 function bodies in specs/ are byte-identical copies (165 groups; magadd 30 times, sadd 29). 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

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
gHashTag enabled auto-merge (squash) September 20, 2026 06:54
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-20 06:54:17 UTC

Summary

Status Count
Total Open PRs 20
PRs with Failing Checks 17
PRs with All Checks Green 3
READY 2
FAILING 17
PENDING 0
NO CHECKS YET 0

These columns do not partition: 2 + 17 + 0 + 0 = 19, and there are 20 open PRs. A PR is being counted twice or not at all.

Seal Status

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

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 ba53d3a into master Sep 20, 2026
27 of 30 checks passed
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>
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.

576 of 4021 function bodies are copies, and nothing asks whether the function already exists

1 participant