refactor(repo): move helper scripts into utils/ - #1094
Merged
Conversation
The repository root held twelve loose helper scripts alongside the two that already lived in utils/. Move them all into utils/ so the root lists project structure rather than maintenance tooling. Every script anchored its paths at Path(__file__).resolve().parent, which was the repository root only by accident of where the file sat. That becomes parents[1], so each still resolves the repo root from its own location and runs correctly from any cwd. The two self-tests that stage a copy of their gate into a tempdir relied on the same coincidence; they now stage under <tmpdir>/utils/ so the tempdir keeps standing in for the repository root. Callers updated in lockstep: Makefile, .pre-commit-config.yaml (the entry: commands and the ^-anchored files: triggers, which would otherwise have silently stopped firing), ci.yml, release.yml, .taskcluster.yml, and check-grammars-crates.sh's own call sites. Docs and the user-facing --update hints printed by the gates carry the new prefix. check-enums-codegen-drift.sh and check-grammars-crates.sh move too rather than splitting each from the test that exercises it and the script it calls. recreate-grammars.sh stays at the root. .snapshot-anchor-baseline.txt is regenerated because its header embeds the script path. That regen also corrects two stale rows that predate this change: a phantom src/metrics/exit.rs entry left by the rename to nexits.rs, and src/metrics/npa.rs ratcheting 13 to 12 after an anchor landed without a baseline refresh. Verified with make pre-commit.
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.
What
Moves the twelve helper scripts that sat loose in the repository
root into
utils/, wherecheck-tools.shanddeploy-book-to-gh-pages.shalready lived. The root now listsproject structure rather than maintenance tooling.
utils/check-versions.py+-test.pycheck-snapshot-anchors.pyinsta::assert_json_snapshot!insrc/metrics/check-manpage-assets.pyman/bca*.1present in the deb+rpm asset listscheck-grammar-marker-sync.py+-test.pyparser.c(#400)check-grammar-crate.py+-test.py+check-grammars-crates.shEXTENSIONSagainstsrc/langs.rscheck-enums-codegen-drift.sh+-test.pyverify-name-only-churn.pyrecreate-grammars.shstays at the root — nothing moved is coupledto it. The two shell scripts move rather than splitting each from
the test that exercises it (
check-enums-codegen-drift.sh) and thescript it calls (
check-grammars-crates.sh).The parts that are not a rename
Three things a plain
git mvplus a path rewrite would have brokensilently:
Path(__file__).resolve().parent, which was the repository rootonly by accident of where the file sat. That becomes
parents[1],so each still resolves the root from its own location and runs
correctly from any cwd.
tempdir (
check-grammar-marker-sync-test.py,check-enums-codegen-drift-test.py) relied on the samecoincidence: the copy sat at the fixture root. Under
parents[1]that resolves to the tempdir's parent, so the copy now stages under
<tmpdir>/utils/. Both suites failed loudly at the intermediatestep, which is how this surfaced.
.pre-commit-config.yamlfiles:regexes, not just theentry:commands. Several are^-anchored, so a hook such asgrammar-marker-sync-testwould have silently stopped firing onedits to its own script.
Callers updated
Makefile,.pre-commit-config.yaml,.github/workflows/ci.yml,.github/workflows/release.yml,.taskcluster.yml, andcheck-grammars-crates.sh's own call sites. Prose inAGENTS.md,CONTRIBUTING.md,RELEASING.md,tests/README.md,docs/development/output_name_normalization_design.md, the book'srecipes/exporting-data.md, and.claude/skills/add-lang/SKILL.md.The
--updatehints the gates print to users carry the new prefixtoo, as does the header written into
.grammar-marker-baseline.toml.CHANGELOG.mdhistory is leftalone.
Reviewer note on
.snapshot-anchor-baseline.txtRegenerated because its header embeds the script path. The regen
also corrects two rows that were stale before this change, which is
the one non-rename content change in the diff:
src/metrics/exit.rsentry left behind by the rename tonexits.rs(count 0 either way);src/metrics/npa.rsratcheting 13 → 12, after an anchor landedwithout a baseline refresh.
Both are corrections toward the live measurement. Say the word if
you would rather the move commit be a pure path change and these
land separately.
Validation
make pre-commitgreen end-to-end, plus a targeted lint re-run forthe few edits that landed after that run started. Each gate and each
self-test was also run individually from the new location.
ja.pois untouched per the translation policy — the changedexporting-data.mdparagraph falls back to English on/ja/untilthe next
make book-po-update.