Skip to content

fix(testing): run integration tests against the freshly-built image - #702

Merged
c-vigo merged 5 commits into
feature/625-nix-claude-migrationfrom
bugfix/701-integration-image-under-test
Jun 25, 2026
Merged

c-vigo merged 5 commits into
feature/625-nix-claude-migrationfrom
bugfix/701-integration-image-under-test

Conversation

@c-vigo

@c-vigo c-vigo commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Description

The integration suite scaffolded a workspace from the freshly-built image (TEST_CONTAINER_TAG) but then ran devcontainer up from whatever DEVCONTAINER_VERSION resolved to — the published 0.3.9. So it validated fresh scaffolding inside a stale image, not the image under test. Pointing it at the fresh Nix image then surfaced real bring-up failures. This fixes all of it. Closes the gap tracked in #701.

Type of Change

  • fix -- Bug fix

Changes Made

  • Run the image under test. devcontainer_up/devcontainer_with_sidecar now export DEVCONTAINER_VERSION=TEST_CONTAINER_TAG. Compose resolves shell env over .env, so the scaffolded docker-compose.yml (image: …:${DEVCONTAINER_VERSION:-latest}) selects the build under test, and the in-test devcontainer exec calls inherit it. Added test_devcontainer_runs_image_under_test asserting the running container's image.
  • Bring the Nix image up cleanly. post-create.sh ran an unguarded sed on the venv activate script before just sync. The Debian image baked that venv at build time; the Nix image creates it during post-create, so the script didn't exist yet and post-create aborted (exit 2). Moved the prompt rewrite after just sync, guarded it, and rewrote the VIRTUAL_ENV_PROMPT assignment directly (uv sets the prompt to the venv parent's basename, so the old template-project literal is never present).
  • Scaffold ruff/ruff-format/typos as language: system. Reverted the [BUG] pre-commit: source binary hooks (ruff, ruff-format, typos) from the flake for NixOS compatibility #697 decoupling: those scaffolded hooks pulled upstream manylinux binaries, which the non-FHS Nix userland cannot execute (No such file or directory on the ELF interpreter), breaking the in-container git commit. They now resolve from the image's baked devTools, like the repo's own config. Removed the now-unused ReplacePrecommitRepoBlock sync-manifest transform and its tests.
  • Docs. Documented the image-selection behaviour in tests/README.md.

Changelog Entry

Fixed

  • Integration tests now exercise the freshly-built image, not the published DEVCONTAINER_VERSION (#701)
    • The fixtures export DEVCONTAINER_VERSION=TEST_CONTAINER_TAG so compose resolves the build under test; added test_devcontainer_runs_image_under_test
    • Guarded/moved the post-create.sh venv-prompt sed so the Nix image comes up cleanly under devcontainer up
    • Reverted the #697 scaffold decoupling: scaffolded ruff/ruff-format/typos are language: system again; removed the unused ReplacePrecommitRepoBlock transform

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

Run against the freshly-built Nix image (TEST_CONTAINER_TAG=dev, podman socket + standalone docker-compose as CI provides):

  • tests/test_integration.py: 123 passed, 7 skipped (skips are host-environmental: SSH signing config + sidecar compose), 0 failed
  • tests/test_image.py: 64 passed
  • tests/test_transforms.py + tests/test_flake_devshell.py: pass
  • test_devcontainer_runs_image_under_test confirmed RED against 0.3.9 → GREEN against dev
  • test_pre_commit_hook exercises the in-container ruff+typos run that previously failed on the Nix image — now passes. test_git_commit_ssh_signature skips locally (no host SSH signing config) but runs in CI's test-integration action.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes

Additional Notes

Sub-issue of the Nix migration epic #625; targets feature/625-nix-claude-migration. The install.sh host-side /etc/os-release probe mentioned in the issue is not exercised by devcontainer up (it has a linux fallback) and is left unchanged.

Refs: #701

c-vigo added 5 commits June 24, 2026 20:42
The integration suite scaffolds from the freshly-built image but
`devcontainer up` resolves the runtime image from DEVCONTAINER_VERSION,
so it validates fresh scaffolding inside the stale published image. Add
a regression test asserting the running devcontainer uses the image
under test (TEST_CONTAINER_TAG).

Refs: #701
The devcontainer_up/devcontainer_with_sidecar fixtures scaffolded a
workspace from the freshly-built image but let `devcontainer up` resolve
the runtime image from DEVCONTAINER_VERSION (the published release baked
into the scaffolded .vig-os/.env), so the suite validated fresh
scaffolding inside a stale image. Export DEVCONTAINER_VERSION =
TEST_CONTAINER_TAG; compose reads the shell environment over .env, so the
scaffolded docker-compose.yml resolves the build under test, and the
in-test `devcontainer exec` calls inherit it.

Refs: #701
post-create.sh ran an unguarded `sed` on the venv activate script before
`just sync`. The Debian image baked that venv at build time, but the Nix
image populates /root/assets/workspace/.venv during post-create, so the
script did not exist yet and post-create aborted (exit 2), failing
`devcontainer up`. Move the prompt rewrite after `just sync` and guard it
on the file's existence. uv writes the prompt as the venv parent's
basename, so rewrite the VIRTUAL_ENV_PROMPT assignment directly instead
of substituting the no-longer-present "template-project" literal.

Refs: #701
The #697 decoupling shipped the scaffolded ruff/ruff-format/typos hooks
as self-contained upstream (manylinux) hooks because the integration
suite still ran the published Debian image, whose PATH lacked those
tools. Now that the suite runs the freshly-built Nix image -- whose
non-FHS userland cannot execute those manylinux binaries -- the workaround
breaks the in-container `git commit`. Restore the repo's repo-local
language:system hooks in the scaffold (resolved from the image's baked
devTools), and drop the now-unused ReplacePrecommitRepoBlock transform
and its tests.

Refs: #701
Explain in tests/README.md how TEST_CONTAINER_TAG selects the image under
test and why the devcontainer fixtures override DEVCONTAINER_VERSION so
compose uses it. Record the fixes under CHANGELOG Unreleased.

Refs: #701
@c-vigo
c-vigo merged commit 3b1b1e0 into feature/625-nix-claude-migration Jun 25, 2026
2 checks passed
@c-vigo
c-vigo deleted the bugfix/701-integration-image-under-test branch June 25, 2026 09:09
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