Skip to content

fix(init-workspace): warn on scaffold/flake-pin version skew - #1101

Merged
c-vigo merged 5 commits into
devfrom
bugfix/1093-flake-pin-skew-warning
Jul 15, 2026
Merged

c-vigo merged 5 commits into
devfrom
bugfix/1093-flake-pin-skew-warning

Conversation

@c-vigo

@c-vigo c-vigo commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Closes #1093. Part of #1096.

Problem

For direnv/flake consumers, two coupled halves of a change ship from different version vehicles: the scaffold (.vig-os DEVKIT_VERSION) writes files, while the pinned vigos flake input delivers the hook behavior in nix/hooks.nix that acts on them (e.g. the #1053 check-json exclude paired with a scaffold-written JSONC banner). A consumer who bumps only the scaffold but leaves the pinned flake ref behind gets, e.g., the banner without its exclude → every commit fails, with nothing warning about the skew.

Change (warn-only — no auto-edit of the preserved flake.nix)

  • install.sh --force now detects and warns when the pinned vigos.url = "…?ref=<X>" in flake.nix differs from the target DEVKIT_VERSION, telling the user to update the pin and run nix flake update vigos. Gated on force + direnv/both + a pin that exists and differs; a floating (unpinned) input and a matching pin are both silent. Non-fatal.
  • docs/MIGRATION.md: new subsection documenting the lockstep invariant (why the two must move together, and how).

Tests / verification

3 new bats cases (skew warns; match silent; floating silent) — RED before, GREEN after. Handles the set -euo pipefail grep-exit-1 trap. Full prek run --all-files green locally.

Merge note

Re-merged onto dev (conflict-free; its changelog Added entry auto-merged). Siblings #1092 and #1099 also touch CHANGELOG.md — a later merge may need "Update branch".

c-vigo added 4 commits July 15, 2026 09:38
Cover the direnv/flake lockstep invariant (#1093): a --force upgrade that
advances DEVKIT_VERSION while a pinned `vigos` flake ref lags behind must
warn. Matching pins and floating (unpinned) inputs stay silent.

Refs: #1093
During a --force direnv/both upgrade, compare the pinned `vigos` flake ref in
the consumer's flake.nix against the DEVKIT_VERSION being written. When a pin
exists and differs, print a non-fatal warning: the scaffold and the flake input
ship coupled halves of the same change (e.g. #1053's JSONC banner + its
check-json exclude), so update `vigos.url` to the target ref and run
`nix flake update vigos`. A floating (unpinned) input or a matching pin stays
silent. flake.nix is a PRESERVE_FILE, so we warn rather than rewrite it.

Refs: #1093
Add a MIGRATION.md subsection explaining that a pinned `vigos` flake `ref` and
the scaffold's `DEVKIT_VERSION` must move together (coupled halves, e.g. #1053),
how to realign them, and that floating inputs are exempt. Record the new skew
warning in the changelog.

Refs: #1093
@c-vigo c-vigo added bug Something isn't working priority:high Should be done in the current milestone area:workspace Workspace tooling, justfile, templates labels Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:workspace Workspace tooling, justfile, templates bug Something isn't working priority:high Should be done in the current milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant