Repository navigation
feat(workflow): add scaffold-drift CI gate (DEVKIT_DRIFT_CHECK) - #1297
Merged
Merged
Conversation
Cover the #1295 scaffold-drift check before implementing it: - resolve-toolchain emits a `drift-check` output from DEVKIT_DRIFT_CHECK (default true; explicit false disables), emitted in every mode - ci.yml carries a `scaffold-drift` job gated PR-only + on the knob, that re-runs init-workspace.sh --force and diffs the managed tree, honors the runner override, and feeds the summary gate - init-workspace persists DEVKIT_DRIFT_CHECK across upgrades and rejects an invalid value loudly Refs: #1295
The scaffolded ci.yml gains a `scaffold-drift` job that re-runs the pinned devkit version's scaffold over the checkout and fails a PR whose managed files diverge from it — DEVKIT_VERSION bumped without re-scaffolding, or a managed file hand-edited. A pin-only bump otherwise merges green; nothing else re-runs the scaffold or diffs against it (init-workspace.sh #1093 skew warning fires only during an upgrade, not on the skewed PR). Mechanism is re-scaffold + `git diff`, NOT `install.sh --preview`: the preview report classifies OVERWRITTEN by path existence (`path_present`), not content, so an exit-code-on-overwrite flag would fire for every populated consumer and cannot distinguish drift from an up-to-date managed file. Re-running init-workspace.sh --force rewrites the managed files to exactly what the pin produces while preserving *.project files and persisted .vig-os values by construction; `git diff` (honoring .gitignore, so *.local is exempt too) then surfaces any real divergence. This needs no change to the scaffold's copy logic — init-workspace.sh already honors WORKSPACE_DIR/TEMPLATE_DIR and pins DEVKIT_VERSION from VIG_OS_VERSION. The job docker-runs the in-image scaffold on the host runner rather than via a job-level container: a direnv/bare consumer resolves an EMPTY image (its jobs run on the host) yet the scaffold assets live only inside the devcontainer image. resolve-toolchain gains a `drift-image` output (the image ref for every mode) so the ghcr.io/vig-os/devcontainer literal stays out of ci.yml (the #991 SSoT invariant), and VIG_OS_VERSION=<current pin> keeps the DEVKIT_VERSION line stable against the image's baked full version. Opt-out via the new .vig-os key DEVKIT_DRIFT_CHECK (true default / false disables), read at runtime through resolve-toolchain's `drift-check` output so flipping it needs no re-scaffold; the value round-trips across --force upgrades and an invalid literal fails the scaffold loudly. Runs on PRs only for cost control (the ~1.5 GiB image pull) — a single workflow cannot apply a per-job paths filter, so it rides the same pull_request-only gate as commit-checks/dependency-review. #1284 feature groups are unaffected: the job ships as part of ci.yml, needing no group of its own. Refs: #1295
c-vigo
added a commit
that referenced
this pull request
Jul 30, 2026
c-vigo
added a commit
that referenced
this pull request
Jul 30, 2026
Closes #1296 ## Summary Scaffolds a self-polling `devkit-upgrade.yml` workflow into consumers: weekly (Monday 06:00, aligned with the Renovate window) it queries devkit's `releases/latest`, and when the repo's `.vig-os` pin is behind it runs the full-fidelity `install.sh --force --version <X>` upgrade — pin + `flake.lock` `vigos` node + scaffold regeneration move together — commits inside the project shell so consumer hooks run (dist rebuild, trailer strip, commit-msg validation), and opens the adoption PR. `workflow_dispatch` with an explicit `version` input (final or rc) is the release-train / lane-re-bump path. Merging stays human. Depends on the #1295 drift gate (PR #1297) as its safety net. ## Design - **Feature group**: new `devkit-upgrade` group in the #1284 opt-out mechanism (never ship the file at all), composing with the runtime knobs: - **`DEVKIT_AUTO_UPGRADE`** (`.vig-os`, default enabled): gates the *schedule path only*; manual dispatch always runs. **`DEVKIT_UPGRADE_EXCLUDE`**: comma-separated paths reset before the adoption commit (e.g. vault's generated-doc churn). Both round-trip across `--force` upgrades. - **Version logic**: `releases/latest` excludes prereleases/drafts, so cron never proposes an rc; a prerelease-aware compare makes the schedule a no-op when the pin is current **or ahead** (an rc of a newer train is never downgraded). Resolved versions are strictly semver-validated before reaching any shell/gh sink. - **Train keying**: adoption issue/branch/PR key on the train (`chore/<issue>-devkit-1-5-0`, dots→dashes for the branch guard), so rc1→rc2→final reuse one issue/branch/PR force-updated; commit + PR title carry the exact version. - **Base branch**: ships `dev` literals, retargeted to `main` at scaffold time for trunk repos via `render_workflow_model` (the sync-issues.yml precedent). - **Token**: dedicated `DEVKIT_UPGRADE_TOKEN` secret (fail-fast with a clear error when absent) — the default `GITHUB_TOKEN` is used only for the read-only release query, since PRs it creates don't trigger CI. Commit identity configurable via `vars.DEVKIT_UPGRADE_AUTHOR_NAME/EMAIL`; the default avoids the agent-blocklist. - **Security**: every untrusted value (dispatch input, event fields, API responses) routed through `env:`; actions SHA-pinned; `permissions: {}` at workflow level, `contents: read` on the job. One deliberate zizmor `artipacked` baseline entry (the checkout persists the dedicated token because the branch push needs it), commented in `zizmor.yml`. ## Test evidence - `tests/test_workflow_devkit_upgrade.py` (new, 15 tests; RED-first) + workflow-model/sync-settings/scaffold-lint/zizmor-baseline/ci-runner suites: 121 passed - `tests/bats/init-workspace.bats` (feature-group assertions): 275/275 pass - `zizmor --offline` over the workspace templates: no findings - `prek run --all-files`: green (both hook layers) ## Reviewer notes - **Provisioning is deliberately out of code scope**: the `DEVKIT_UPGRADE_TOKEN` App/PAT identity (and optional `DEVKIT_UPGRADE_AUTHOR_*` variables) must be created per the #1296 checklist before the workflow can act; until then it fails fast with a pointer. The default author email is a placeholder — set the real identity at provisioning. - **Live proof requires a consumer**: this template never executes in devkit's own CI; first end-to-end validation comes with the first consumer adoption (worth exercising via `workflow_dispatch` on one lane during the 1.5.0 rollout). - The `nix develop -c git commit` step assumes a flake-bearing (direnv/both) consumer — true for all five current consumers; bare/devcontainer-only consumers are out of scope per the issue. - Untracked files matching `DEVKIT_UPGRADE_EXCLUDE` are not reset (`git checkout --` only restores tracked paths) — acceptable for the known use case (tracked generated PDFs). - Merge-order note: this PR and #1297 both touch `CHANGELOG.md`, `.vig-os`, and `init-workspace.sh`; whichever merges second needs a trivial conflict resolution (GitHub merges don't apply the changelog union driver). Refs: #1296
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.
Closes #1295
Summary
Adds a
scaffold-driftjob to the scaffolded consumerci.ymlthat re-runs the pinned devkit version's scaffold over the checkout and fails a PR whose managed files diverge from it —DEVKIT_VERSIONbumped without re-scaffolding, or a managed file hand-edited. Today a pin-only bump merges green; this closes the #1093 skew gap with an enforced gate. Prerequisite for #1296.Mechanism
Re-scaffold +
git diff, notinstall.sh --preview: the preview report classifies OVERWRITTEN by path existence, not content, so it cannot distinguish drift from an up-to-date file. The jobdocker runsinit-workspace.sh --force --no-promptsfrom the pinned image over the checkout (direnv/bare consumers resolve an emptycontainer:image, and the scaffold assets live only inside the image), thengit add -A && git diff --cachedsurfaces divergence.*.projectfiles and persisted.vig-osvalues are exempt by construction;.gitignored files (*.local) via git.VIG_OS_VERSION=<pin>keeps theDEVKIT_VERSIONline stable against the image's baked version.install.shneeded no changes.Knob
New
.vig-oskeyDEVKIT_DRIFT_CHECK(truedefault /false), a pure runtime gate read viaresolve-toolchain's newdrift-checkoutput — flipping it needs no re-scaffold; the value round-trips across--forceupgrades, and an invalid literal fails the scaffold loudly (mirrorsDEVKIT_REFS_POLICY). The ghcr image literal stays inresolve-toolchain(new all-modesdrift-imageoutput) per the #991 SSoT invariant.Cost control
Runs on PRs only (~1.5 GiB image pull), riding the same gate as
commit-checks/dependency-review— a per-jobpathsfilter isn't possible inside one workflow. Summary treats skip-as-OK, failure trips the gate.Test evidence
tests/test_scaffold_drift.py(new, 15 tests) +test_ci_runner.py+test_scaffold_lint.py: 70 passedtests/bats/init-workspace.bats(3 new tests): 278/278 passprek run --all-files: green (both hook layers)actionlinton the template: cleanReviewer notes
DEVKIT_CI_RUNNERself-hosted runner the job inheritsruns-onand needs adockerCLI on that host; hostedubuntu-24.04is unaffected. Worth checking on meatgrinder before a consumer with a self-hosted runner adopts..vig-os/flake.lock/managed files change) would need a dedicatedscaffold-drift.ymlwithon.pull_request.paths; kept as an in-ci.ymljob per the issue's wording.Refs: #1295