Repository navigation
fix(setup): use portable env-bash shebang in host scripts - #690
Merged
c-vigo merged 2 commits intoJun 24, 2026
Merged
Conversation
c-vigo
added a commit
that referenced
this pull request
Jun 24, 2026
…git-hook shebangs) (#694) ## Summary Fixes the flaky `initialized_workspace` testinfra fixture that timed out during `uv sync`, cascading an `ERROR at setup` to every dependent test. Folds in a companion portability fix for the git hooks (same `#!/bin/bash`-on-NixOS class as #690), without which commits cannot run on a NixOS host. Sub-issue of the #625 Nix migration epic; targets the epic branch `feature/625-nix-claude-migration`. ## Changes ### `test(setup)` — init dep-sync timeout (Closes #692) - The fixture allowed only **30s** for the `Workspace initialized successfully` banner after `Syncing dependencies`. That window covers `just sync` (`uv sync --all-extras`) downloading the test-project's heavy scientific extras (`numpy`, `scipy`, `pandas`, `matplotlib`, `jupyter`) with **no warm uv cache**, so a cold/slow network times out mid-download. - Raise the completed-stage timeout to a generous **300s** default, overridable via `INIT_DEPS_SYNC_TIMEOUT` for fast-cache/CI tuning. ### `fix(setup)` — portable git-hook shebangs (Refs #690) - `.githooks/{pre-commit,commit-msg,prepare-commit-msg}` hardcoded `#!/bin/bash`. Like the host scripts fixed in #690, these run on the host and fail on NixOS (no `/bin/bash`): `fatal: cannot exec '.githooks/pre-commit': No such file or directory`. Switched to portable `#!/usr/bin/env bash`. ## Verification - Python syntax + `INIT_DEPS_SYNC_TIMEOUT` env override resolve correctly (verified via `uv run python`). - Longest added line = 80 chars (< the 88 `line-length`), so `ruff` is clean. - pre-commit ran green for every hook that can execute on the host (shellcheck, bandit, agent-identity, branch-name, commit-msg validation, sync-manifest). - `ruff`/`ruff-format`/`typos` cannot execute on this NixOS host (dynamically linked binaries — the very limitation #625 addresses) and were skipped locally via pre-commit `SKIP`; **CI enforces them on this PR**. No `--no-verify` used. ## Notes The durable fix (warming the uv cache in the Nix-built image so `uv sync` is offline-fast) belongs to the #634/#635 image track and is out of scope here. Closes #692
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
Three host-executed scripts hardcoded a non-portable
#!/bin/bashshebang. On NixOS (and other hosts that do not provide/bin/bash), the kernel cannot resolve the interpreter, so the scripts fail to execute — which is whyjust testaborts on NixOS hosts. Switched all three to the portable#!/usr/bin/env bashform already used byscripts/init.sh, which resolvesbashviaPATH.Root cause
A
#!/bin/bashshebang requiresbashto live at the absolute path/bin/bash. NixOS does not populate/binwith FHS binaries (only/bin/shexists), so any host-side script with that shebang is not directly executable.#!/usr/bin/env bashdefers interpreter lookup toPATH, working on both FHS and NixOS hosts.Files changed (shebang only)
install.shassets/workspace/.devcontainer/scripts/initialize.shassets/workspace/.devcontainer/scripts/version-check.shThe in-container script consistency sweep is intentionally out of scope (per the issue).
Tests
Added a reproducible portability test (
TestHostScriptShebangPortabilityintests/test_install_script.py) that parametrizes over the three host scripts and asserts each starts with#!/usr/bin/env bash. It is a pure content check (no container image needed). Confirmed RED before the fix (3 failures) and GREEN after (3 passed). The issue's original three failing tests are environment-specific (only reproduce on a NixOS host with no/bin/bash) and so are not reproducible in CI; this new test covers the regression deterministically.Closes #687