Repository navigation
fix: realise direnv scaffold sources with flake prefetch - #2040
Merged
Merged
Conversation
gerchowl
added a commit
that referenced
this pull request
Nov 4, 2026
Since #2040 the direnv Scaffold Drift step fetches the pin with nix flake prefetch, so direnv needs no docker at all; only bare's Scaffold Drift and upgrade need a docker CLI and daemon. Gated devcontainer/both repos still run resolve-toolchain on the direct runner expression, which needs a docker CLI for the image probe. Correct the ADR known limit and the migration guide, describe the stronger runner scan, and say the opt-in key is still validated in direnv/bare. Refs: #2045
13 of 15 tasks
gerchowl
added a commit
that referenced
this pull request
Nov 4, 2026
## Description Implements the owner decision on #2045: container-mode consumers (`devcontainer`, `both`) use `CI_RUNNER_*` runners only after they opt in with the new `.vig-os` key `DEVKIT_CI_CONTAINER_RUNNERS=true`. Without the key, every lane stays on hosted `ubuntu-26.04`, as in 1.18.x. `vars.CI_RUNNER_*` also resolves organization variables, and an expression cannot tell an inherited org variable from a repo one. An org that sets them for a pool with no container runtime therefore broke every container-mode repo in it on adoption: the 1.19.0-rc3 smoke test failed at `Initialize containers` and at Scaffold Drift's `docker run`. Into `release/1.19.0`, because this blocks release 1.19.0 (#2033). ## Type of Change - [x] `fix` -- Bug fix - [x] `test` -- Adding or updating tests - [x] `docs` -- Documentation only ### Modifiers - [ ] Breaking change (`!`) -- This change breaks backward compatibility ## Changes Made **One gate, in `resolve-toolchain`** (`assets/workspace/.github/actions/resolve-toolchain/action.yml`) - Parses `DEVKIT_CI_CONTAINER_RUNNERS` with the shared `KEY=VALUE` reader. The file is never sourced. Any value other than `true`, `false` or empty is an `::error::` and exit 1, in every mode, before any runner output is written. - In `devcontainer`/`both` without `true`, the variable arm is skipped for every class. Each lane then gets the hosted default, so `DEVKIT_CI_LANE_SIZES` is ignored for placement, though it is still validated. The fork predicate still wins. The repo's own legacy `DEVKIT_CI_RUNNER` key keeps its 1.18.x meaning (see Notes). - When the gate ignores a visible variable on a non-foreign run, the resolver prints one `::notice::` that names `CI_RUNNER_*`, the mode and `DEVKIT_CI_CONTAINER_RUNNERS=true`, and gives the reason. The partial-setup notice and the opted-in-class warning do not fire, because nothing is placed. The private-repo notice and the legacy-key migration warning also name the key. Under the gate, the migration warning lists only variables that are really unset, and it no longer says "delete the key once the variables are set": the key keeps deciding every class until the repo opts in. Labels are never printed. - `direnv`/`bare`: unchanged. **`devkit-upgrade.yml`**: its `upgrade` job runs `install.sh --docker` in every mode but direnv, so it needs a docker daemon. It now gets its runner from a new `resolve-toolchain` job (the same shape as `sync-issues`), not from `vars.CI_RUNNER_SMALL` directly. That job checks out the same `ref:` the upgrade rewrites (`dev`, or `main` after the trunk retarget), so the gate reads that branch's `DEVKIT_MODE` and opt-in key, not the default branch's. As with the key, a legacy `DEVKIT_CI_RUNNER` now places the upgrade job too; the consumer-matrix contract was updated to match. `report` also fires when `resolve-toolchain` fails (for example, an invalid key), because that failure skips `upgrade`. **`init-workspace.sh`**: validates the key at the write path and writes it back on every upgrade. The legacy-key strip, decision (c)-1, now judges whether the key is inert with the gate applied. In a container mode without the opt-in, the variables place nothing, so the key is kept and a `ci-runner-migration:` line names the opt-in. **Template `.vig-os`**: ships `DEVKIT_CI_CONTAINER_RUNNERS=` with a comment. **Consumer matrix**: the `ci-runner` cell runs mode `both`, so it now seeds `DEVKIT_CI_CONTAINER_RUNNERS=true`. That keeps it on the opted-in path and also exercises the write-back from start to finish. **Docs**: ADR-site-agnostic-projects updates: - TL;DR. - §3 algorithm (gate `G`). - §4 inventory row. - §5: the old "already container-capable" assumption is replaced with the decision, why it was taken (org vars are inherited and indistinguishable), a placement table, and the known limit. - §6: a migration subsection and a PR-body row. - A dated amendment and the Consequences list. `docs/MIGRATION.md` gets a new "Container-mode CI runners" section and a row for the key in the `.vig-os` key table (the SSoT). CHANGELOG has an entry under `## [1.19.0] - TBD` → `### Fixed`, and the mirror is synced. ### Audit: jobs under `assets/workspace/` that place on `CI_RUNNER_*`, `DEVKIT_CI_RESOLVE_RUNNER` or the resolver's `runners`/`runner-json` | Workflow | Job | Needs a container runtime in container mode? | Runner after this PR | |---|---|---|---| | `ci.yml` | `resolve-toolchain` | No daemon: the image probe is `docker login` + `docker manifest inspect`, both client-side registry calls (they ran on a daemon-less pool in the rc3 smoke). It still needs a `docker` CLI | direct expression (cannot use its own output) | | `ci.yml` | `lint`, `test`, `commit-checks` | **yes**, `container:` | gated `runners.lint` / `.test` / `.small` | | `ci.yml` | `scaffold-drift` | **yes**, `docker login/pull/run` on the host | gated `runners.small` | | `ci.yml` | `devkit-staleness`, `summary` | no (shell/gh) | gated `runners.small` (already on the output) | | `ci.yml` → `ci-extension.yml` | `extension` | stock hook: no; a consumer's hook may | gated `runners.extension` via `runner-json` input | | `ci.yml` | `dependency-review` | — | hosted literal | | `sync-issues.yml` | `resolve-toolchain` / `sync` | probe only / **yes** `container:` | direct / gated | | `sync-main-to-dev.yml` | `resolve-toolchain` / `check`, `sync` | probe only / **yes** `container:` | direct / gated | | `prepare-release.yml` | `validate` (the resolver) / `prepare`, `open-pr`, `rollback` | probe only / **yes** `container:` | direct / gated `needs.validate.outputs.runners` | | `prepare-hotfix.yml` | `resolve-toolchain` / `validate`, `prepare`, `open-pr`, `rollback` | probe only / **yes** `container:` | direct / gated | | `release.yml` | `resolve-toolchain` / `rollback` | probe only / **yes** `container:` | direct / gated | | `release-core.yml` (via `release.yml`) | `validate`, `finalize`, `test` | **yes** `container:` | gated `inputs.runners` (caller passes the resolver's `runners`) | | `release-publish.yml` (via `release.yml`) | `publish` | **yes** `container:` | gated `inputs.runners` | | `promote-release.yml` | `resolve-toolchain` / `validate`, `promote`, `merge`, `cleanup`, `floating-tags` | probe only / **yes** `container:` | direct / gated | | `abandon-release.yml` | `resolve-toolchain` / `validate`, `abandon`, `unfreeze` | probe only / no (shell/gh, host toolchain) | direct / gated (already on the output) | | `devkit-upgrade.yml` | `resolve-toolchain` (new) | probe only | direct | | `devkit-upgrade.yml` | `upgrade` | **yes**, `install.sh --docker` (all modes but direnv) | **moved**: gated `runners.small` | | `devkit-upgrade.yml` | `report` | no (gh only) | direct expression | | `prepare-release-extension.yml`, `release-extension.yml` (seeded) | `extension` | no, stock no-op shell. The file is consumer-owned, so a consumer whose hook needs a runtime routes it itself | direct expression | | `publish-release-extension.yml` (seeded) | `resolve`, `publish` | no (gh / shell) | direct expression | | `codeql.yml`, `scorecard.yml` | — | — | hosted literal | Composite actions: only `resolve-toolchain` touches docker (the client-side probe above). `setup-devkit-toolchain` and `build-bundle` run inside the job's own container or on the host, and do not drive a daemon themselves. devkit's own `.github/` uses literal hosted labels and has no copy of the resolver, so there is nothing to keep in lockstep there. `tests/test_ci_container_runners.py::test_container_jobs_take_the_gated_runner` derives the container-needing set from the workflows themselves: `container:` or `services:`, a `docker://` or `docker/*` action, any `docker`/`podman` CLI subcommand (full-line shell comments excluded), compose, `install.sh`, or a local composite action (`uses: ./…`, resolved one level, including through a sub-path checkout such as `./.devkit-resolve/…`) whose steps do any of these. It fails any such job whose `runs-on` is not the resolver's `runners` output, whether read directly from a resolver it `needs:` or through an `inputs.runners` that every caller fills from one. A future lane therefore cannot bypass the gate. The only exception is an explicit, commented allowlist of the nine resolver jobs (client-side registry probe, documented in ADR §5); a pinned test keeps each entry a resolver whose own definition needs no runtime besides that probe. ## Changelog Entry ### Fixed (under `## [1.19.0] - TBD`) - **Container-mode consumers opt in to `CI_RUNNER_*` runners** ([#2045](#2045)) - New `.vig-os` key `DEVKIT_CI_CONTAINER_RUNNERS` (`true` | `false`, default `false`). In `devcontainer`/`both` mode, every lane stays on hosted `ubuntu-26.04`, as in 1.18.x, unless it is `true`; organization-level `CI_RUNNER_*` variables no longer move container lanes onto pools without a container runtime. - `resolve-toolchain` prints a notice naming the key when it ignores a visible variable, and rejects any other value; `direnv`/`bare` and fork PRs are unchanged. - `devkit-upgrade` resolves its installer runner through the same gate, and keeps a legacy `DEVKIT_CI_RUNNER` key until a container-mode repo opts in. ## Testing - [x] Tests pass locally (the touched suites; full suite in CI) - [ ] Manual testing performed ### Manual Testing Details - The resolver matrix runs the action's real Bash over mode {devcontainer, both, direnv, bare} × key {absent, true, false} × vars {set, unset} × fork. A separate invalid-value matrix covers every mode × fork × vars. Further tests cover the notice text, quoting and whitespace parsing, the gated diagnostics, the private-repo notice, legacy-key parity and the static scan. - Bats (CI): the key persists across `--force` upgrades, invalid values are refused before any write, and the legacy key is kept in a gated container mode but stripped once the repo opts in. - Round 2 RED, before the stronger detector: 9 failed (`services`, `buildx`, `docker info`, `docker push`, `podman image`, three local-composite shapes, plus the shell-only-composite negative), e.g. `assert _needs_runtime({'services': ...})` false and `TypeError: _needs_runtime() got an unexpected keyword argument 'root'`. - RED, before the implementation: `120 failed, 430 passed` across `test_ci_container_runners.py`, `test_ci_runner.py`, `test_vig_os_manifest.py` and `test_workflow_devkit_upgrade.py`. Examples: `assert ['self-hosted-small'] == ['ubuntu-26.04']`, and `devkit-upgrade.yml job 'upgrade' needs a container runtime but runs on "${{ … || vars.CI_RUNNER_SMALL || 'ubuntu-26.04' }}", not on the gated resolve-toolchain runners output (#2045)`. ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have updated the documentation accordingly - [x] I have updated `CHANGELOG.md` (the `[1.19.0]` section, because this targets the release branch) and pasted the entry above - [x] My changes generate no new warnings or errors - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged and published ## Additional Notes - **Legacy `DEVKIT_CI_RUNNER` under the gate.** The decision says "otherwise every lane runs on hosted `ubuntu-26.04`, as in 1.18.x", with the goal that no consumer breaks on upgrade. In 1.18.x the repo's own legacy key routed container-mode lanes on purpose. Honouring it is the 1.18.x behaviour, and it is the kind of explicit repo statement the decision asks for. Dropping it would silently move a self-hosted container-mode repo onto hosted runners, which fails on a billing-blocked org. So the gate ignores the inherited `CI_RUNNER_*` variables, not the legacy key. The legacy migration text and the upgrade strip both account for this, so following the migration never drops a repo onto hosted runners. - **Known limit: what a self-hosted `CI_RUNNER_*` pool must provide, per mode.** The gate is keyed on the delivery mode, as decided. - `direnv`: no docker at all. Since #2040 the direnv Scaffold Drift step fetches the pin with `nix flake prefetch`, and the upgrade runs `install.sh` without a runtime; the pool needs `nix`, `jq` and `rsync`. - `bare`: `ci.yml`'s Scaffold Drift (`docker login`/`pull`/`run`) and `devkit-upgrade`'s `upgrade` (`install.sh --docker`) need a docker CLI and daemon. The gate does not apply in `bare`, so a `bare` repo whose pool has no container runtime still fails those two lanes. This needs its own issue (reported to the architect, not filed here). - `devcontainer`/`both`, gated: every lane is hosted, but the `resolve-toolchain` jobs still run on the direct `vars.CI_RUNNER_SMALL || vars.DEVKIT_CI_RESOLVE_RUNNER` expression and need a docker CLI (no daemon) for `docker login` / `docker manifest inspect`. - Documented in ADR §5 (Known limit) and MIGRATION.md (Container-mode CI runners). - In container modes, `devkit-upgrade`'s new resolve job probes the image of the *current* pin, as every other resolve job in that repo does. The image cleanup deletes only untagged versions, so a pinned tag stays resolvable. Refs: #2045
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.
Description
On Nix 2.35, metadata can report an unrealised source path, so direnv installs fail when copying assets. Use
nix flake prefetch --json <ref> | jq -er .storePathto realise the source before reading it. Targetsrelease/1.19.0.Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
git grep -nE 'flake metadata': leave freshness.sh unchanged because it reads locked input metadata only; the provisioning example does not read source files. Historical changelog text stays unchanged.Changelog Entry
Fixed
nix flake prefetchso their assets exist before copying; show the same command in the installer dry-run plan.Testing
Manual Testing Details
uv run --with pytest-xdist pytest tests/test_install_direnv_host.py tests/test_scaffold_drift.py -n 4 --basetemp=$HOME/.cache/devkit-pytest/prefetch-redexited 1 (25 failed, 55 passed).bats tests/bats/install.bats --filter "direnv install points"exited 1 with missing source assets. Failing tests committed before implementation.uv run --with pytest-xdist pytest tests/test_install_direnv_host.py tests/test_scaffold_drift.py tests/test_seed_changelog.py -n 4 --basetemp=$HOME/.cache/devkit-pytest/prefetch-green2exited 0 (81 passed).bats tests/bats/install.batsexited 0.nix developwith hooks enabled.Checklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
No merge or workflow dispatch. No dependent changes. Documentation impact is the command comment and changelog.
Refs: #2039