Repository navigation
test(bats): unset IN_NIX_SHELL in githooks guard-blocking cases - #1384
Merged
Merged
Conversation
The nine cases asserting the workspace githook guard blocks outside a devcontainer sanitized only IN_CONTAINER; from a nix develop shell, IN_NIX_SHELL=impure legitimately satisfies the guard and the cases fail. Also unset IN_NIX_SHELL, mirroring the IN_CONTAINER handling, so the suite is deterministic regardless of the invoking shell. Test-only change: the guard behaves correctly, so there is no implementation commit to split out. Refs: #1381
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
The nine
githooks.batscases asserting the workspace githook guard blocks outside a devcontainer sanitized onlyIN_CONTAINER(env -u IN_CONTAINER/IN_CONTAINER=\"\"/IN_CONTAINER=\"false\"). The guard also legitimately passes whenIN_NIX_SHELLis set, so running the suite from anix developshell (IN_NIX_SHELL=impure) failed 9/12 cases even though the code under test is correct.This extends the env sanitization in those nine cases to also unset
IN_NIX_SHELL, mirroring the existingIN_CONTAINERhandling, making the suite deterministic regardless of the invoking shell.Test-only change in a single
test(...)commit: the guard implementation is correct, so the usual failing-test/implementation commit split does not apply — there is nothing to implement, only the test harness to fix. No changelog entry: no user-visible impact (CI never exportsIN_NIX_SHELL; this is a local-DX fix).Testing
origin/dev):IN_NIX_SHELL=impure bats tests/bats/githooks.bats→ 9/12 failed (all nine "blocks" cases:command succeeded, but it was expected to fail).IN_NIX_SHELL=impure bats tests/bats/githooks.bats→ 12/12 ok;env -u IN_NIX_SHELL bats tests/bats/githooks.bats→ 12/12 ok.just precommit(full suite, all files) green.Closes #1381