Repository navigation
feat: scan preserved configs for retired hook blocks - #1653
Merged
Merged
Conversation
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 hand-edited
.pre-commit-config.yamlis preserved on upgrade (#878), so template hook changes never reach it. That is right for hook-stack evolution and wrong for a hook fix: the repos carrying the broken block are exactly the ones the fix was written for.Concretely, a config scaffolded before #1170 keeps the upstream
jackdewinter/pymarkdownhook forever. It islanguage: python, so prek builds a venv on its own base interpreter while the flake toolchain'spymarkdownlnttargetsdefault_language_version— the C-extension import then fails (ModuleNotFoundError: No module named 'pyjson5.pyjson5'), breakingjust precommit, every local markdown commit, and thedevkit-upgrade.ymlcommit step. A stale consumer's auto-upgrade can never land, and nothing says why.This adds the missing signal: a table-driven scan of preserved files for blocks the template retired because they break.
Closes #1652.
Type of Change
feat-- New featureChanges Made
assets/init-workspace.shknown_bad_preserved_patterns()— the SSoT table, one<id>|<preserved rel-path>|<ERE>|<remedy>row per known-bad block. A row earns its place only when the template retired something that breaks; ordinary divergence stays with the fix(workspace): scaffold upgrade replaces .pre-commit-config.yaml, silently clobbering repo-specific hook config #878 diff.scan_known_bad_preserved()— warns withfile:line+ remedy on stderr (like the fix(image): pre-commit binary dropped without a compat path — preserved consumer recipes and .githooks calling it break #881 retired-pre-commitscan) and prints one machine-readablepreserved-hook-drift: <id> in <path>line on stdout per matching row. Non-fatal; comment lines are filtered; onlyPRESERVE_FILESrows are scanned.--previewreport (the preflight surface, side-effect-free) and the post-scaffold guard section.assets/workspace/.github/workflows/devkit-upgrade.yml— captures the marker lines out of the install log into ahook-driftstep output and surfaces them in the run summary and the adoption PR body, riding the same channel as theflake-bump:report (Upgrade staleness is unobservable on both axes: the auto-bump grep misses most consumers, and scaffold-drift compares the pin to itself #1497). A warning that only reaches a workflow log reaches nobody.docs/MIGRATION.md— "Fold the Package pymarkdown in the flake and promote it to a system hook (direnv consumers lose markdown lint) #1170 pymarkdown hook into a preserved config": why preservation blocks the fix, the failure signature, and the exactlanguage: systemreplacement block.Changelog Entry
(full entry with sub-bullets is in
CHANGELOG.mdunder## Unreleased)Testing
just test)tests/bats/init-workspace.bats(6 new, all green):file:line+ remedy + marker on the pre-Package pymarkdown in the flake and promote it to a system hook (direnv consumers lose markdown lint) #1170 block, and leaves the consumer file byte-for-byte alone;run --separate-stderr) — the contract the workflow's| tee install.logdepends on;repo:URL is still detected;--previewreports it without touching the tree.tests/test_workflow_devkit_upgrade.py(2 new): the step captures the marker intoGITHUB_OUTPUT, and the PR-body step routes it throughenv:(never${{ }}insiderun:).Full suites green locally: 276/276 bats in
init-workspace.bats, 760 pytest (image/integration excluded — they need a rebuilt image),prek run --all-filesclean, and theactionlint-over-rendered-workflows gates pass.Checklist
CHANGELOG.mdin the[Unreleased]sectionFollow-up (not in this PR)
A warning does not unstick a consumer that is already broken: their upgrade fails at the prek-gated commit step before any PR opens. The only thing that would is a surgical auto-fold of the block when it byte-matches the known old shape (precedent:
migrate_root_gitignore, #1145). That edits a consumer-owned file, so it deserves its own issue rather than riding along here — filed as #1654.