Skip to content

test(bats): unset IN_NIX_SHELL in githooks guard-blocking cases - #1384

Merged
c-vigo merged 1 commit into
devfrom
bugfix/1381-githooks-bats-nix-shell-isolation
Aug 7, 2026
Merged

c-vigo merged 1 commit into
devfrom
bugfix/1381-githooks-bats-nix-shell-isolation

Conversation

@c-vigo

@c-vigo c-vigo commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

The nine githooks.bats cases asserting the workspace githook guard blocks outside a devcontainer sanitized only IN_CONTAINER (env -u IN_CONTAINER / IN_CONTAINER=\"\" / IN_CONTAINER=\"false\"). The guard also legitimately passes when IN_NIX_SHELL is set, so running the suite from a nix develop shell (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 existing IN_CONTAINER handling, 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 exports IN_NIX_SHELL; this is a local-DX fix).

Testing

  • Before (on 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).
  • After: 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

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
@c-vigo
c-vigo merged commit f7a9379 into dev Aug 7, 2026
13 checks passed
@c-vigo
c-vigo deleted the bugfix/1381-githooks-bats-nix-shell-isolation branch August 7, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant