Skip to content

Skip .copier-answers.yml in the scaffolded typos hook - #13

Merged
MattFisher merged 1 commit into
mainfrom
claude/pyright-migration-implications-rt3usr
Aug 7, 2026
Merged

MattFisher merged 1 commit into
mainfrom
claude/pyright-migration-implications-rt3usr

Conversation

@MattFisher

Copy link
Copy Markdown
Owner

Overview

Fixes the red Render and validate both variants job on main (run 31150433393):

error: `ba` should be `by`, `be`
  ╭▸ .copier-answers.yml:3:10
  │
3 │ _commit: ba338ef

Why it happens

Template CI renders each variant with --vcs-ref=HEAD and runs the rendered scaffold's own pre-commit stack. _commit is whatever git describe returns for that ref — a plain tag only when HEAD is exactly a release commit, otherwise a describe string carrying raw hex, or a bare short SHA.

A short hex run is a coin flip away from spelling something typos treats as a misspelled word. ba338ef tokenises to ba, which typos wants to correct to by/be. Nothing in the file is prose, so checking it can only ever produce false positives — and which commits trigger one is pure chance, so this recurs unpredictably.

Consumers are exposed too, though less often: their _commit is normally a tag, but any project updated with --vcs-ref pointing at a branch or SHA carries the same landmine.

What changed

  • template/.pre-commit-config.yaml.jinja: exclude: ^\.copier-answers\.yml$ on the typos hook.
  • CHANGELOG.md: entry under [Unreleased]Fixed.

Verification

  • Rendered both app and library variants at HEAD and ran each scaffold's complete pre-commit stack — all 14 hooks pass in both.
  • Decisive test, since the current describe string happens not to contain a trigger: on a rendered app with _commit forced back to the exact value that broke CI, typos passes with the exclude and fails without it (removed the line and re-ran as a control).

Notes

  • The comment on the new line deliberately doesn't quote a real example. My first draft did, and it failed the same hook — .pre-commit-config.yaml itself isn't excluded, so a SHA quoted there gets spell-checked. Worth preserving that constraint if anyone edits the comment.
  • Rendering at ba338ef today produces _commit: v1.8.1, because the annotated tag now sits on that commit. The original failure was transient in that sense — but it recurs for any merge to main that lands before the next release is tagged, which is most of them.
  • Separately confirmed the downgrade fix is working in production: copier update --defaults --trust --vcs-ref v1 against the real remote, in a consumer checkout at _commit: v1.7.0, now reports Updating to template version 1.8.1. git describe --tags at main's tip answers v1.8.1, so the annotate step did its job on the 1.8.1 release.

Generated by Claude Code

The file is generated, and its `_commit` is whatever ref the last update
resolved to. Between releases that is a git describe string rather than
a plain tag, so it carries a run of raw hex — and a short hex run is a
coin flip away from spelling something typos reads as a misspelling. One
duly landed on main and failed the render job of template CI.

Nothing in the file is prose, so checking it can only ever produce false
positives, on a schedule nobody controls.

Verified by rendering both variants at HEAD and running each scaffold's
full pre-commit stack: all hooks pass. Then, on a rendered app with
`_commit` forced to the exact value that broke CI, typos passes with the
exclude and fails without it.

The comment deliberately does not quote a real example, which would trip
the hook in this file.
@MattFisher
MattFisher merged commit 4ee2750 into main Aug 7, 2026
3 checks passed
@MattFisher
MattFisher deleted the claude/pyright-migration-implications-rt3usr branch August 7, 2026 05:31
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.

2 participants