Repository navigation
fix(workspace): never deploy template pre-commit YAML over flake-generated hooks - #1259
Merged
c-vigo merged 4 commits intoJul 23, 2026
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.
Summary
An
install.sh --forceupgrade on a flake-hooks consumer deployed the scaffoldtemplate
.pre-commit-config.yamlwhenever the file was absent from the tree.On such a consumer the config is flake-GENERATED (#1167/#883): a gitignored
/nix/storesymlink that only materializes on shell entry, so a freshcheckout/worktree legitimately has no file for the preserve list to protect.
The deployed template then SHADOWED the generated config — git-hooks.nix
refuses to overwrite an existing file — silently dropping the consumer's
hooks/hooksExcludescustomizations (observed on commit-action: typos ranagainst the committed
dist/bundle).Fix
The opt-in is detectable without the file: an ACTIVE (uncommented)
hooks/hooksExcludesargument in the preservedflake.nix— exactlymkProjectShell's generation trigger (hooks != null || hooksExcludes != [ ]);the template's commented opt-in block never matches.
.pre-commit-config.yamljoinsMODE_CONFIG_EXCLUDES(the init-workspace.sh --preview reports rsync-excluded files as ADDED #1196 SSoT), so the rsync copy and the--previewreport skip it consistently; the report says why..gitignorekeeps the.pre-commit-config.yamlentry (previously it wasdropped whenever neither the store symlink nor the direnv-mode scaffold ships hand-managed pre-commit config whose pymarkdown hook cannot run on host runners #1167 fresh-scaffold
default applied).
and a committed regular YAML (hand-managed or mid-migration) keeps today's
behavior, including no ignore seed.
Targeted at
release/1.4.1: pre-existing since 1.4.0, but it bites everyfresh-worktree upgrade of the direnv lanes, so it rides the patch train.
Verification
template YAML and keeps the gitignore entry;
hooksExcludes-only opt-in isdetected; a flake with only the COMMENTED template opt-in still receives the
template YAML;
--previewno longer advertises the file as ADDED.tests/bats/init-workspace.batssuite: 243/243 green.just precommit: all hooks green except the pre-existing, unrelatedcheck-expirationsfailure (curl 8.20.0 batch expired 2026-07-22 — filedseparately; it will also fail this PR's CI until resolved).
Closes #1255