Repository navigation
fix(hooks): exclude scaffold-copied CHANGELOG.md from large-file check - #1805
Merged
Merged
Conversation
…check A fresh devcontainer/both-mode consumer's first commit stages the scaffold-copied .devcontainer/CHANGELOG.md (528 KB+ on dev), which check-added-large-files rejects past its 500 KB default. The exclude lives in the hook's one shared yaml render: devkit's own repo has no .devcontainer/ directory at all, so the identical exclude on the runner's committed config is an inert no-op there, keeping a single render for both committed YAMLs. Refs: #1801
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.
Description
A fresh devcontainer/both-mode consumer's first commit fails
check-added-large-files: the scaffold copies devkit's own, growingCHANGELOG.mdto.devcontainer/CHANGELOG.md, and that file has crossed the hook's 500 KB default (514,976 bytes at 1.17.0; 528,063 ondev).Type of Change
fix-- Bug fixModifiers
!) -- This change breaks backward compatibilityChanges Made
nix/hooks.nix(the SSoT for the rendered.pre-commit-config.yaml):check-added-large-filesnow carriesexclude: ^\.devcontainer/CHANGELOG\.md$in its one sharedyamlblock..devcontainer/directory at all, so the identical exclude on the runner's committed.pre-commit-config.yamlmatches nothing there and is an inert no-op — one render, both committed YAMLs, no new SSoT concept, no weakening of the drift gate's hook-identity check..pre-commit-config.yamlandassets/workspace/.pre-commit-config.yaml) to match the new render, as there is no generator script — the drift gate (tests/test_flake_hooks.py) is what keepsnix/hooks.nixand the two committed YAMLs in lockstep..pre-commit-config.yamlis preserved on upgrade (not overwritten), and.devcontainer/CHANGELOG.mdis already present in its tree by the time this hook would ever see it there (the hook only rejects added files, per the issue's own "Additional Context"). Only a brand-new scaffold hits the failure, and a brand-new scaffold always renders the fixed config.no-commit-to-branchhook (a parallel branch, The branch-name rule exists only inline in ci.yml, so every consumer's local gate must duplicate it (and drifts) #1760, is rewriting it in the same files).Changelog Entry
Fixed
check-added-large-fileson.devcontainer/CHANGELOG.md(#1801)CHANGELOG.mdinto.devcontainer/CHANGELOG.md(528 KB+ ondev), which crossed the hook's 500 KB default.check-added-large-filesnow excludes that path; devkit's own repo has no.devcontainer/directory, so the exclude is an inert no-op on devkit's own commitsTesting
uv run pytest tests/test_flake_hooks.py -q-- 83 passed)Manual Testing Details
TDD: RED commit (9a15369) added
TestCheckAddedLargeFilesExcludesScaffoldChangelog, mirroring the existingTestCheckJsonExcludesJsoncBannerspattern -- asserts both committed YAMLs carry the exclude. Verified RED by stashing the implementation and confirming the new test failed (AssertionErroron.pre-commit-config.yaml, pre-fix). GREEN commit (4474157) is the fix;test_scaffold_render_is_subset_of_runner(the one-definition identity gate) is untouched and still passes in its original strict form.Live reproduction and fix proof (
nix eval --json .#lib.hooksPortableconfirms bothrunnerandscaffoldrenders carry the identical exclude):--mode devcontainerscaffold viaassets/init-workspace.sh,git init && git add -A, ran realprek run check-added-large-files --all-files:.devcontainer/CHANGELOG.md (515 KB) exceeds 500 KB.prek run check-added-large-files --all-filesin devkit's own repo (both.andassets/workspaceprek profiles): passes, confirming the no-op claim (no.devcontainer/directory exists at devkit's own repo root).just precommit(fullprek run --all-files, both profiles): all hooks passed, zero modifications.bats -j$(nproc) tests/bats/init-workspace.bats: 312/312 passed, 0 failures (never rantests/bats/worktree.batsor the whole bats directory, per this repo's worktree-safety convention).Checklist
docs/templates/, then runjust docs) -- not applicable, no user-facing docs describe this hook's exclude listCHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
A parallel branch (#1760) is rewriting the
no-commit-to-branchhook in the same two files (nix/hooks.nix, both committed.pre-commit-config.yamls); this PR's diff is kept to the one hook/one exclude to ease that merge.Refs: #1801