Skip to content

refactor(repo): move helper scripts into utils/ - #1094

Merged
dekobon merged 1 commit into
mainfrom
refactor/move-helper-scripts-to-utils
Jul 28, 2026
Merged

refactor(repo): move helper scripts into utils/#1094
dekobon merged 1 commit into
mainfrom
refactor/move-helper-scripts-to-utils

Conversation

@dekobon

@dekobon dekobon commented Jul 27, 2026

Copy link
Copy Markdown
Owner

What

Moves the twelve helper scripts that sat loose in the repository
root into utils/, where check-tools.sh and
deploy-book-to-gh-pages.sh already lived. The root now lists
project structure rather than maintenance tooling.

Moved to utils/ Purpose
check-versions.py + -test.py Lockstep version invariant across owned crates and doc pins
check-snapshot-anchors.py Blocks new bare insta::assert_json_snapshot! in src/metrics/
check-manpage-assets.py Every man/bca*.1 present in the deb+rpm asset lists
check-grammar-marker-sync.py + -test.py mozjs/mozcpp marker vs bundled parser.c (#400)
check-grammar-crate.py + -test.py + check-grammars-crates.sh Grammar-bump metric diff; the test guards EXTENSIONS against src/langs.rs
check-enums-codegen-drift.sh + -test.py enums codegen drift (#405)
verify-name-only-churn.py Proves a bulk snapshot regen is path-only churn

recreate-grammars.sh stays at the root — nothing moved is coupled
to it. The two shell scripts move rather than splitting each from
the test that exercises it (check-enums-codegen-drift.sh) and the
script it calls (check-grammars-crates.sh).

The parts that are not a rename

Three things a plain git mv plus a path rewrite would have broken
silently:

  • Repo-root anchoring. Every script derived its paths from
    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 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
    (check-grammar-marker-sync-test.py,
    check-enums-codegen-drift-test.py) relied on the same
    coincidence: 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 intermediate
    step, which is how this surfaced.
  • .pre-commit-config.yaml files: regexes, not just the
    entry: commands. Several are ^-anchored, so a hook such as
    grammar-marker-sync-test would have silently stopped firing on
    edits to its own script.

Callers updated

Makefile, .pre-commit-config.yaml, .github/workflows/ci.yml,
.github/workflows/release.yml, .taskcluster.yml, and
check-grammars-crates.sh's own call sites. Prose in AGENTS.md,
CONTRIBUTING.md, RELEASING.md, tests/README.md,
docs/development/output_name_normalization_design.md, the book's
recipes/exporting-data.md, and .claude/skills/add-lang/SKILL.md.
The --update hints the gates print to users carry the new prefix
too, as does the header written into
.grammar-marker-baseline.toml. CHANGELOG.md history is left
alone.

Reviewer note on .snapshot-anchor-baseline.txt

Regenerated 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:

  • a phantom src/metrics/exit.rs entry left behind by the rename to
    nexits.rs (count 0 either way);
  • src/metrics/npa.rs ratcheting 13 → 12, after an anchor landed
    without 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-commit green end-to-end, plus a targeted lint re-run for
the few edits that landed after that run started. Each gate and each
self-test was also run individually from the new location.

ja.po is untouched per the translation policy — the changed
exporting-data.md paragraph falls back to English on /ja/ until
the next make book-po-update.

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.
@dekobon
dekobon merged commit cca0df7 into main Jul 28, 2026
44 checks passed
@dekobon
dekobon deleted the refactor/move-helper-scripts-to-utils branch July 28, 2026 00:06
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.

1 participant