Repository navigation
fix: correct IN_CONTAINER guard in workspace githooks - #239
Merged
Merged
Conversation
The guard uses = "false" but IN_CONTAINER is unset (not "false") outside the devcontainer, so the guard never triggers on the host. Refs: #238
Outside the devcontainer IN_CONTAINER is unset, not "false". The = "false" check never matched, so host commits were not blocked. Changed to != "true" in all three hooks to fail closed. Refs: #238
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
Fix the inverted
IN_CONTAINERguard in workspace githooks that silently allowed host commits through.Issue #238 describes three defects (A, B, C) from #163. After analysing the current codebase, defects A and B were already resolved by the
vig-utilsmigration (#218):project_root): The oldPath(__file__).resolve().parent.parentwas replaced byfind_repo_root()which traverses up fromcwdlooking for.github/.vig_utilsdependency): The scripts now live insidevig-utilsand are invoked as entry points — no external import needed.Defect C was the only remaining bug: all three workspace githooks used
= "false"to checkIN_CONTAINER, but outside the devcontainer the variable is typically unset (empty string), not the literal"false". The guard never triggered, so host commits were not blocked. Changed to!= "true"to fail closed.Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
assets/workspace/.githooks/pre-commit— changed= "false"to!= "true"assets/workspace/.githooks/prepare-commit-msg— changed= "false"to!= "true"assets/workspace/.githooks/commit-msg— changed= "false"to!= "true"tests/bats/githooks.bats— new BATS test suite (12 tests: 3 hooks × 4 scenarios: unset, empty, "false", "true")CHANGELOG.md— added entry under### FixedChangelog Entry
Fixed
= "false"butIN_CONTAINERis unset (not"false") outside the devcontainer!= "true"inpre-commit,prepare-commit-msg, andcommit-msghooks to fail closedTesting
just test)Manual Testing Details
BATS test suite
tests/bats/githooks.bats— 12 tests, all pass:Checklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
The implementation plan with full triage analysis is posted as a comment on issue #238.
Refs: #238