Skip to content

fix(ci): run scaffold drift through nix in direnv mode - #1870

Merged
gerchowl merged 3 commits into
devfrom
bugfix/1861-direnv-drift-nix
Oct 12, 2026
Merged

gerchowl merged 3 commits into
devfrom
bugfix/1861-direnv-drift-nix

Conversation

@gerchowl

@gerchowl gerchowl commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

In DEVKIT_MODE=direnv, Scaffold Drift did docker login/pull/run, so a strictly direnv-only repo still needed a container runtime. Now the job (direnv only) provisions nix via the shared toolchain preamble, fetches the pinned devkit flake source (nix flake metadata), replays the image's two bake steps ({{IMAGE_TAG}} stamp, VERSION file), runs bash init-workspace.sh --force --no-prompts against a scratch clone under RUNNER_TEMP (removed on exit; no container, no root-owned files) and diffs exactly as before. devcontainer/both/bare keep the container path unchanged. rsync is added to the dev-shell tools.

Deviation from the brief: nix run …#install cannot be used — install.sh itself docker|podman runs the image, so it is not container-free. The scaffold is run directly from the flake source instead.

Parity (local, darwin, GNU tools): scratch clone of gerchowl/claude-config @ dev (6d6ef67, devkit 1.18.0, direnv): exit 0 "No scaffold drift detected"; after committing a hand edit to SECURITY.md: exit 1 "Scaffold drift detected" with the diff; scratch dir removed both times.

Docker/container audit of rendered workflows: container: jobs use the resolved image (empty in direnv, so inert); resolve-toolchain's docker login/manifest probe only runs when an image is resolved (container modes); setup-devkit-toolchain only filters podman out of PATH. Still docker in direnv mode: devkit-upgrade.yml (install.sh --docker) — not changed here, needs its own issue.

Type of Change

  • fix

Changelog Entry

Fixed

  • Scaffold Drift no longer needs Docker in direnv mode (#1861)

Testing

tests/test_scaffold_drift.py: gating/no-docker pins plus an executed clean→drift behavior test (nix stubbed to this repo); 17 passed.

Refs: #1861

Known limitation: the drift step relies on rsync from the consumer's dev shell; a consumer whose flake.lock predates this change on a NixOS runner gets rsync: not found until it upgrades.

@gerchowl
gerchowl merged commit 8f238a6 into dev Oct 12, 2026
18 checks passed
@gerchowl
gerchowl deleted the bugfix/1861-direnv-drift-nix branch October 12, 2026 11:24
gerchowl added a commit that referenced this pull request Oct 12, 2026
…1873)

## Summary
In direnv mode `install.sh` (fresh scaffold and `--force` upgrade) and
`devkit-upgrade.yml` no longer need docker/podman. `install.sh` skips
runtime detection and runs the pinned `init-workspace.sh` on the host
from the devkit flake source (`nix flake metadata` -> `assets/`, image
bake steps replayed, scratch dir removed) — the same replay as the #1870
drift check. `devkit-upgrade.yml` drops `--docker` when `.vig-os` says
`DEVKIT_MODE=direnv`. devcontainer/both/bare keep the image path
unchanged.

- direnv mode is taken from `--mode direnv` or the persisted
`DEVKIT_MODE`; it requires an exact `--version <tag>` (`latest` is
refused) and nix, jq and rsync on PATH.
- Files are created as the invoking user, so the ownership-repair
container step is skipped.
- Known limitation: the installer comes from the target release tag, so
a repo's automated upgrade becomes container-free once its target
release ships this `install.sh`.

## Proof
Container-free run with docker/podman absent from PATH, in a scratch
repo with `DEVKIT_MODE=direnv`: `install.sh --version 1.18.0` scaffolded
the workspace; after committing, `--force` left `git status` clean.
Tests: `tests/test_install_direnv_host.py` (dry-run plans, container
modes unchanged, executed scaffold + upgrade with docker/podman stubs
that fail on any call, `latest` refusal) and
`tests/test_workflow_devkit_upgrade.py`.

Refs: #1871

## Cost and coverage notes
- `nix develop` of the pinned release adds about 3.8 s warm (1.18.0,
store populated; measured once). A cold run additionally fetches the
dev-shell closure from the binary cache and was not measured.
- The direnv smoke lane now installs Nix before the scaffold, so the
release gate no longer runs the toolchain composite's install-nix
branch; consumer CI on hosted runners still does.
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