Skip to content

fix: advance lockstep release pins during upgrades - #1988

Merged
gerchowl merged 4 commits into
devfrom
bugfix/1856-upgrade-lockstep-pin
Nov 3, 2026
Merged

gerchowl merged 4 commits into
devfrom
bugfix/1856-upgrade-lockstep-pin

Conversation

@gerchowl

@gerchowl gerchowl commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

A consumer upgrading a release-pinned devkit input could receive new scaffold hooks while retaining the old dev shell, preventing the adoption commit and PR. The target installer now advances release pins that matched the pre-upgrade DEVKIT_VERSION by default, using the existing atomic pin/lock update.

Type of Change

  • fix -- Bug fix
  • test -- Adding or updating tests

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • Capture the pre-upgrade version. Empty DEVKIT_FLAKE_PIN_ADVANCE advances lockstep release pins; true advances any release pin; false opts out and is preserved.
  • Normalize refs/tags/ and a leading v for comparisons. Preserve refs/tags/ and the URL form; remove v when advancing and report the spelling change in the single flake-bump line. Devkit publishes bare version tags.
  • Check the actual retained pin after every outcome, including skipped updates, missing Nix, internal failures, and atomic rollback. Explicitly report an incomplete upgrade and lead with manual alignment and nix flake update, honoring an explicit false.
  • Keep the warning rather than add another preflight detector: this preserves the opt-out and existing non-fatal installer contract while making the hook/CI failure and remedy explicit.
  • The functional fix lives in the TARGET install.sh, which older consumer upgrade workflows already execute. It has no workflow-adoption prerequisite. The scaffold CI change only updates the error advice consumers see after adoption; the root CI has no corresponding gate.
  • Update the default-change migration note, release guide, template comments, and Changed/Fixed changelog entries. Document the existing CI limitation: bare release refs are checked for equality; qualified refs receive the gate's warning. The installer recognizes both spellings.

Changelog Entry

Changed

  • Default lockstep pin advancement (#1856): lockstep release pins advance unless DEVKIT_FLAKE_PIN_ADVANCE=false.

Fixed

  • Advance lockstep release pins during upgrades (#1856)
    • The target installer advances release pins matching the pre-upgrade version by default, keeping the scaffold and dev shell aligned even through older upgrade workflows.
    • Recognize qualified release refs, preserve refs/tags/, and report removal of a leading v to use published bare tags.
    • Preserve explicit pin-advance settings; report every retained-pin mismatch, including failed updates and missing Nix, with manual-alignment advice that honors an explicit opt-out.
    • Migration: affected direnv/both consumers can set DEVKIT_FLAKE_PIN_ADVANCE=false to opt out and align pins manually; see the migration note.

Testing

  • Tests pass locally (focused suites; container and Nix-eval suites left to CI per repository guidance)
  • Manual testing performed (describe below)

Manual Testing Details

  • RED round one: regression command exited 1 (4 failed, 1 passed), committed before implementation. The real scaffold moved to 1.2.3 while the default lockstep pin stayed at 1.2.2.
  • RED round two: uv run --with pytest-xdist pytest tests/test_install_direnv_host.py -k release_pin_upgrade_policy -n 4 --basetemp=$HOME/.cache/devkit-pytest/1856-r2 --tb=short exited 1 (10 failed, 8 passed). BATS missing-warning checks exited 1 (2 failed). Committed failing tests before implementation.
  • GREEN: uv run --with pytest-xdist pytest tests/test_install_direnv_host.py tests/test_vig_os_manifest.py -n 4 --basetemp=$HOME/.cache/devkit-pytest/1856-r2 --tb=short exited 0 (64 passed). bats --jobs 2 --filter 'flake|pin|knob|advance' tests/bats/install.bats exited 0 (23 passed).
  • Fixtures run the real scaffold with external Nix/runtime calls stubbed. They check normalized release spellings, both URL forms, tri-state settings, preserved knob values, one report per run, manual advice for false, missing Nix and rollback warnings, and version alignment.
  • Verified real tags with git ls-remote --tags origin refs/tags/1.17.0 refs/tags/1.18.0 refs/tags/v1.17.0 refs/tags/v1.18.0: both bare tags exist and neither v-prefixed tag exists. No local v1.* tags exist either.
  • Commit hooks run inside nix develop without bypasses. CI validates the scaffold gate's updated message; its Nix-eval test suite was not run locally.

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 Unreleased and pasted the entries above
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective
  • New and existing focused unit tests pass locally
  • Any dependent changes have been merged and published (none required)

Additional Notes

Migration: direnv/both consumers with a lockstep release pin and an empty knob now advance automatically. Set DEVKIT_FLAKE_PIN_ADVANCE=false to opt out, then align the release pin and lock manually before committing. Branch/revision refs and atomic rollback remain unchanged. No merge or release dispatch.

Refs: #1856

@gerchowl
gerchowl merged commit f96ee95 into dev Nov 3, 2026
16 checks passed
@gerchowl
gerchowl deleted the bugfix/1856-upgrade-lockstep-pin branch November 3, 2026 00:19
gerchowl added a commit that referenced this pull request Nov 3, 2026
## Description

Carry #1856 / PR #1988 into the 1.18.2 hotfix. A target installer now
advances release pins that matched the consumer's previous version,
recognizes qualified and v-prefixed refs, and reports retained-pin
mismatches with advice that respects opt-out.

Targets `release/1.18.2`; no merge or release dispatch is requested.

## Type of Change

<!-- Mark the relevant option(s) with an 'x' -->

- [ ] `feat` -- New feature
- [x] `fix` -- Bug fix
- [ ] `docs` -- Documentation only
- [ ] `chore` -- Maintenance task (deps, config, etc.)
- [ ] `refactor` -- Code restructuring (no behavior change)
- [x] `test` -- Adding or updating tests
- [ ] `ci` -- CI/CD pipeline changes
- [ ] `build` -- Build system or dependency changes
- [ ] `revert` -- Reverts a previous commit
- [ ] `style` -- Code style (formatting, whitespace)

### Modifiers

- [ ] Breaking change (`!`) -- This change breaks backward compatibility

## Changes Made

- Cherry-picked all four PR #1988 commits in order with provenance
retained before the final Refs line.
- Adapted the missing dev-only test harness to the 1.18.1 container
installer boundary: a minimal test-only runtime stand-in executes the
real scaffold. All 18 policy cases and assertions remain AST-identical
to dev.
- The hotfix used `seed`; Fixed, Changed and migration entries are under
`[1.18.2] - TBD`. The sync-manifest hook regenerates the workspace
mirror.

## Changelog Entry

### Changed

- **Default lockstep pin advancement**
([#1856](#1856)): lockstep
release pins advance unless `DEVKIT_FLAKE_PIN_ADVANCE=false`.

### Fixed

- **Advance lockstep release pins during upgrades**
([#1856](#1856))
- The target installer advances release pins matching the pre-upgrade
version by default, keeping the scaffold and dev shell aligned even
through older upgrade workflows.
- Recognize qualified release refs, preserve `refs/tags/`, and report
removal of a leading `v` to use published bare tags.
- Preserve explicit pin-advance settings; report every retained-pin
mismatch, including failed updates and missing Nix, with
manual-alignment advice that honors an explicit opt-out.
- Migration: affected direnv/both consumers can set
`DEVKIT_FLAKE_PIN_ADVANCE=false` to opt out and align pins manually; see
[the migration
note](docs/MIGRATION.md#lockstep-flake-pins-during-upgrades).

## Testing

Commands ran inside `nix develop`:
- `uv run --with pytest-xdist pytest tests/test_install_direnv_host.py
tests/test_flake_pin_lockstep.py -n 2
--basetemp=$HOME/.cache/devkit-pytest/1856-carry-final`: 35 passed, exit
0.
- `uv run --with pytest-xdist pytest
tests/test_utils.py::TestInstallScriptUnit -n 2
--basetemp=$HOME/.cache/devkit-pytest/1856-carry-unit`: 3 passed, exit
0.
- `bats tests/bats/install.bats`: 107 passed, exit 0.
- RED evidence: initial policy tests had 4 failures / 1 pass, exit 1;
round-two tests against the initial implementation had 10 failures / 8
passes, exit 1.
- Commit hooks passed; `git diff --check` passed. Full suites are
delegated to PR CI.
- [ ] Tests pass locally (`just test`)
- [ ] Manual testing performed (describe below)

### Manual Testing Details

Compared every carried file with `origin/dev` using `git diff`:
- `install.sh`: the entire post-initialization section, including
policy, normalization, rollback and warnings, is byte-identical. Earlier
differences retain 1.18.1 container scaffolding, version resolution,
preflight and environment forwarding rather than importing #1871/#1826
and runner migrations.
- `assets/init-workspace.sh`: the pin-knob preservation change matches
dev; remaining differences are existing Rust config seeding / pack
support, untracked-file preflight, gitignore rendering, runner lane
validation/migration and extension-hook reconciliation.
- `assets/workspace/.github/workflows/ci.yml`: lockstep normalization
matches dev; existing runner selection, checkout paths and
container-based drift checks stay on the release baseline.
- `assets/workspace/.vig-os`: pin-policy documentation matches dev;
existing runner documentation and absence of lane-size settings remain
from the release baseline.
- `docs/DOWNSTREAM_RELEASE.md` and its workspace mirror: upgrade-policy
prose matches dev; only the existing runner-json contract differs.
- `docs/MIGRATION.md`: the #1856 migration section is byte-identical;
remaining differences retain release-baseline runner contracts/migration
guidance, manifest and language descriptions, shell/env guidance,
preflight behavior, and absence of the dev-only site-leak hook.
- `tests/test_flake_pin_lockstep.py`: byte-identical to dev.
- `tests/bats/install.bats`: carried assertions match dev; existing
preflight tests remain, fixture modes use direnv through the hotfix
container path rather than dev's both mode, and dry-run targets retain
the baseline behavior.
- `tests/test_install_direnv_host.py`: all policy decorators, function
code and assertions match dev as an AST. Only minimal harness helpers
are carried; unrelated dev host-scaffolding and migration tests are
absent. The runtime stand-in replaces dev's Nix metadata/develop replay
and records unexpected calls.
- Root and mirrored changelogs retain hotfix/released history instead of
unrelated dev Unreleased entries; #1856 entries are relocated to 1.18.2.
The mirror uses the repository's manifest transforms.

## Checklist

<!-- Mark completed items with an 'x' -->
- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [x] I have updated the documentation accordingly (edit
`docs/templates/`, then run `just docs`)
- [x] I have updated `CHANGELOG.md` in `[1.18.2] - TBD` per the hotfix
brief (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

The brief explicitly overrides the generic dev-base and Unreleased
instructions for this hotfix carry.

Refs: #1856

<!--
Please include GitHub issue references in the "Refs:" line above (e.g.,
`Refs: #42`).
Every change must be traceable to an issue, per project rules.
If not related to a specific issue, explain why (chore/documentation
only).
See [commit-messages.mdc](../../rules/commit-messages.mdc) for more
details.
-->
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