Skip to content

feat: migrate CI runner settings and seeded hooks safely - #1949

Merged
gerchowl merged 6 commits into
devfrom
feature/1929-upgrade-migration
Oct 29, 2026
Merged

gerchowl merged 6 commits into
devfrom
feature/1929-upgrade-migration

Conversation

@gerchowl

@gerchowl gerchowl commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

Devkit upgrades remove the legacy runner key only when the CI upgrade context provides valid variables for every required class. Local installs and gitflow adoptions still running an older workflow on main keep the key and report variables as unknown.

Seeded release hooks migrate historical stock runner values only with a valid SMALL variable in the CI upgrade context. Custom runners remain untouched and are reported by file and job; pending or drift findings prevent a legacy-variable deletion hint.

Type of Change

  • feat -- New feature
  • ci -- CI/CD pipeline changes
  • test -- Adding or updating tests
  • docs -- Documentation

Modifiers

  • Breaking change (!)

Changes Made

  • Forward the six migration environment names through both installer paths using one allow-list; document the environment contract in ADR §6.
  • Audit hook history across all tags and dev builds. One stock constant covers the hosted 22.04/24.04/26.04 values, the intermediate input expression, and the legacy resolve-variable expression. The current SMALL expression is already reconciled.
  • Preserve indentation, inline comments, CRLF/LF endings, and absent final newlines while reconciling stock values. Report customised or unclassified content explicitly.
  • Send reconciled, pending and drift findings through ci-runner-migration:. Current workflows lift them into the migration section; pre-N workflows drop them, as ADR §6 requires, instead of mislabelling them under unrelated preserved-hook headings.
  • Add MIGRATION.md#seeded-hook-runner-migration, correct decision (d)-1 and its amendment, and classify the feature under Added in the changelog.

Changelog Entry

Added

  • Safe CI runner migration during devkit upgrades (#1929)
    • Remove the legacy runner key only when visible variables cover every required class; preserve local and older-workflow installs with actionable migration text.
    • Reconcile stock seeded release-hook runner lines and report customised content for review.

Testing

  • Relevant local tests pass.
  • Manual testing performed (describe below).

Manual Testing Details

All commands run inside nix develop, with pytest basetemp outside the checkout:

  • RED: uv run --with pytest-xdist pytest tests/test_seeded_hook_runner_migration.py -n 4 --basetemp=$HOME/.cache/devkit-pytest/1929-r3-red — 25 failed, 1 passed; exit 1. Tests committed before fixes.
  • Missing-final-newline assertion: temporarily removing the truncation line makes that test fail; mutant exit 1, original source restored.
  • GREEN: uv run --with pytest-xdist pytest tests/test_seeded_hook_runner_migration.py tests/test_workflow_devkit_upgrade.py -n 4 --basetemp=$HOME/.cache/devkit-pytest/1929-r3-focused — 62 passed; exit 0.
  • uv run pytest tests/test_install_direnv_host.py --basetemp=$HOME/.cache/devkit-pytest/1929-r3-installer — 14 passed; exit 0. Sequential because an existing test asserts the process-wide scratch directory is empty, which races another installer test under xdist.
  • bats -j 2 --filter 'runner migration|lane sizes|upgrade writes back every persisted' tests/bats/init-workspace.bats — 10 passed; exit 0.
  • Real scaffold execution covers every historical stock value, context gating, mixed jobs, the four requested layout variants, inline comments, idempotency, and missing final newline. PR-body tests execute both the current shell and the body builder shipped in 1.18.0.
  • Commit hooks check shell, workflows, docs, and generated manifest content. Full CI is watched on the pushed head.

Checklist

  • My code follows the project's style guidelines.
  • I have performed a self-review of my code.
  • I have commented the migration boundaries and stock history source.
  • I have updated the migration documentation and ADR.
  • I have updated CHANGELOG.md and its generated consumer copy.
  • I have added tests proving the behavior and regressions.
  • New and relevant existing tests pass locally.
  • Dependent implementation changes are merged into dev.

Additional Notes

Per-run CI warnings remain the primary migration channel. Cleanup does not depend on when a gitflow consumer releases N to main. N+2 tombstones and their companion tests remain S9 scope. The older blank-duplicate manifest parser issue (#1953) is outside this change.

Refs: #1929

@gerchowl
gerchowl force-pushed the feature/1929-upgrade-migration branch from dacc400 to ed36a5b Compare October 29, 2026 01:17
@gerchowl gerchowl changed the title feat: migrate inert CI runner settings during upgrades feat: migrate CI runner settings and seeded hooks safely Oct 29, 2026
@gerchowl
gerchowl force-pushed the feature/1929-upgrade-migration branch from ed36a5b to 0fb7d5a Compare October 29, 2026 01:36
@gerchowl
gerchowl merged commit 907f700 into dev Oct 29, 2026
16 checks passed
@gerchowl
gerchowl deleted the feature/1929-upgrade-migration branch October 29, 2026 01:44
gerchowl added a commit that referenced this pull request Oct 29, 2026
## Description

Rewrites `docs/MIGRATION.md`'s "Run CI on self-hosted runners" section
to document the shipped site-agnostic runner mechanism
(`CI_RUNNER_SMALL`/`LARGE`/`XLARGE` variables, the fork predicate, size
classes and the `DEVKIT_CI_LANE_SIZES` lane override, and the N/N+1/N+2
deprecation timeline) in place of the stale, pre-migration
`DEVKIT_CI_RUNNER`-comma-list description. Source of truth:
`docs/rfcs/ADR-site-agnostic-projects.md`, cross-checked against the
merged S1/S1b/S1d/S2/S3 code (`resolve-toolchain/action.yml`, `ci.yml`,
`devkit-upgrade.yml`, `init-workspace.sh`).

## Type of Change

- [x] `docs` -- Documentation only

### Modifiers

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

## Changes Made

- Rewrote the variable-selection, fork-safety and deprecation-timeline
content of "Run CI on self-hosted runners", replacing the removed
comma-separated `DEVKIT_CI_RUNNER` mechanism and the site-specific
example label/`gh variable set` value (both replaced with `<label>`)
- Added `####` subsections: Size classes and the lane override, Fork
safety (including decision (f)'s remedy for forks of a private repo, and
the owner-confirmed wording that the fork predicate is
accident-prevention, not the security boundary), Deprecation timeline,
and Known symptoms (the "CI never starts on a private repo" §3 notice
limit, and the whitespace-only/malformed `CI_RUNNER_SMALL` symptom)
- Updated the `.vig-os` manifest key table: rewrote the now-deprecated
`DEVKIT_CI_RUNNER` row and added the missing `DEVKIT_CI_LANE_SIZES` row
- Fixed one stale cross-reference to the old mechanism in the adjacent
"Keep the dev-shell gcroot" section
- Left the already-correct "Seeded hook runner migration" subsection
(S3, #1949) untouched, including its anchor

## Changelog Entry

### Changed

- **Rewrite the self-hosted CI runner migration guide**
([#1933](#1933))
- `docs/MIGRATION.md`'s "Run CI on self-hosted runners" section now
documents the shipped `CI_RUNNER_SMALL`/`LARGE`/`XLARGE` variables, the
per-lane `DEVKIT_CI_LANE_SIZES` override, fork safety (including the
private-fork remedy) and the full N/N+1/N+2 deprecation timeline,
replacing the stale description of the removed `DEVKIT_CI_RUNNER`-only
mechanism
- Add "CI never starts on a private repo" and whitespace-only
`CI_RUNNER_SMALL` symptom entries, and scrub the site-specific example
label from the section and the manifest key table

## Testing

- [x] Tests pass locally (targeted subset, not full `just test` per the
shared-host rule)
- [x] Manual testing performed (describe below)

### Manual Testing Details

- `nix develop --command prek run pymarkdown --files docs/MIGRATION.md
CHANGELOG.md --show-diff-on-failure --color=always` → **Passed**, exit 0
(the repo's actual docs/markdown lint; `fix` mode made no further
changes)
- A one-off script (not committed) extracted every `MIGRATION.md#…`
anchor referenced anywhere in the repo outside
`docs/issues/`/`docs/pull-requests/` (`git grep -n 'MIGRATION.md#'`) and
compared it against the GitHub-slugified headings in the rewritten
`docs/MIGRATION.md`: 16 distinct anchors, all resolve
- `nix develop --command uv run --with pytest-xdist pytest
tests/test_seeded_hook_runner_migration.py::test_migration_docs_and_changelog_match_the_new_contract
tests/test_rust_scaffold.py::test_bypass_notice_links_to_a_real_migration_heading
tests/test_ci_runner.py -n 4` → **280 passed**
- `git diff` scanned for the scrubbed site-specific label — only present
in removed (`-`) lines
- Checked the section contains no site label, hostname, org-specific
runner name, `/mnt/...` path or real IP

## Checklist

- [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`) -- N/A, no template change
- [x] I have updated `CHANGELOG.md` in the `[Unreleased]` section (and
pasted the entry above)
- [x] My changes generate no new warnings or errors
- [ ] I have added tests that prove my fix is effective or that my
feature works -- N/A, docs-only change
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published

## Additional Notes

No code changes. S6 (#1950, leak-check hook) is still open and may also
touch `MIGRATION.md`; rebasing onto it if it lands first is on me per
the brief.

Refs: #1933
gerchowl added a commit that referenced this pull request Oct 29, 2026
## Description

Add the ADR §10 default-on site leak-check hook. A clone without private
patterns exits silently; configured clones scan staged changes or
selected working-tree files through gitleaks and publish only file, line
and rule ID.

## Type of Change

- [x] `feat` -- New feature
- [x] `fix` -- Bug fix
- [ ] `docs` -- Documentation only
- [ ] `chore` -- Maintenance task
- [ ] `refactor` -- Code restructuring
- [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

### Modifiers

- [ ] Breaking change (`!`)

## Changes Made

- Resolve `DEVKIT_LEAK_PATTERNS` before `.site/leak-patterns.toml`. Use
merged S4's public `vig_utils.site_config.validate_patterns` and
preserve its safe error messages with exit 2. The S4 ADR amendment
defines the single pattern-file contract; a missing selected file is a
silent no-check without fallback.
- Materialize raw blobs from the index for added, copied, modified,
renamed and type-changed paths. Use Git's NUL-delimited metadata only
for path selection, with no external diff or textconv; stream raw blobs
through one `git cat-file --batch` process, avoiding checkout filters
and per-blob process creation. Staged, filename and all-files modes then
share one gitleaks directory scanner.
- Cover full index content at changed paths, including pure renames;
skip deleted and untouched paths. Filename mode skips NUL-containing
inputs to enforce the text-hook contract, while direct staged and
all-files scans include those bytes.
- Scan selected site bindings and repository ignore files as data.
Isolate gitleaks 8.30.1's automatic source-ignore loading by scanning a
root `.gitleaksignore` separately; the private config remains explicit.
- Define the default-on text/symlink hook once in `nix/hooks.nix` and
mirror both portable configs. Pin gitleaks in Nix-generated hooks, and
publish only file, line and rule ID. Document scan boundaries, printed
paths, linked worktrees and intentional exceptions.

- Pass `--` in every hook definition before filenames; reject
help-looking CLI options and disable option abbreviation. Real
installed-hook commits cover `-h`, `--help`, `--he` and `--all-files`
filenames.
- Own private snapshots in one cleanup routine on success, findings,
errors and signals. Block SIGINT/SIGTERM/SIGHUP before deleting, restore
the previous mask/handlers, and honour pending signals only after
deletion with a conventional exit code and no traceback. Identify
unreadable pattern files and report input read/materialization errors
using only safe path metadata.
- Scan symlink link text as regular snapshot content in staged, filename
and all-files modes, without following targets. Select links through
`types: []` plus `types_or: [text, symlink]`, clearing the hook runner's
default file-only filter. Preserve raw link text, including repeated
separators, and apply path rules to link names.

## Changelog Entry

### Added

- **Site leak-check hook**
([#1932](#1932))
- Enable private gitleaks rules for staged and working-tree scans, with
silent
success when no site patterns exist and redacted finding diagnostics.
- Prevent repository ignore/config bypasses, scan force-added site
bindings,
    and reject present pattern files without usable rules.
- Stream raw index snapshots, including type changes, through one Git
batch
    reader despite Git attributes; share S4's safe pattern validation.
- Block option-looking filename bypasses, clean private snapshots on
termination,
and report filesystem failures with paths and OS reasons without file
contents.
- Scan symlink link text without reading targets and finish snapshot
cleanup
    despite repeated termination signals.

## Testing

- [x] Targeted tests pass locally; the brief reserves full-suite
execution for CI.
- [x] Manual testing performed (describe below)

### Manual Testing Details

- Round-six RED: `pytest tests/test_site_leak_check.py -n 4
--basetemp=$HOME/.cache/devkit-pytest/1932-r6 -q` inside the Nix
environment with worktree `PYTHONPATH` first exited 1: 9 failed / 112
passed. Tests were committed before implementation.
- GREEN inside `nix develop`: `PYTHONPATH="$PWD/packages/vig-utils/src"
uv run --with pytest-xdist pytest tests/test_site_leak_check.py
tests/test_hardcoded_endpoints.py
packages/vig-utils/tests/test_site_config.py -n 4
--basetemp=$HOME/.cache/devkit-pytest/1932-r6 -q` exited 0: 379 passed.
- Both regular-file ↔ symlink type changes are staged as Git status T
and must flag the new raw index blob. A 256-file test verifies exact
binary content and exactly one batch reader, preventing per-blob process
regressions.
- Cleanup tests pause deterministically after the scanner has exited and
before deletion. They deliver SIGTERM followed 10 ms later by SIGHUP in
staged and all-files modes, across clean, findings and scanner-error
exits. Deletion must complete before a conventional signal exit; no
private tree or traceback remains.
- Cleanup mask mutation: querying the mask instead of blocking
termination signals makes the strengthened test fail (exit 1). After
restoring production code, all 6 cleanup cases passed (exit 0),
explicitly asserting SIGINT/SIGTERM/SIGHUP are blocked inside deletion.
- Earlier validator, symlink target-isolation, installed-hook option
filename, attributes/textconv/smudge, redaction, ignore/config bypass,
gitlink/stage/path guard, rename and NUL-boundary regressions remain
covered.
- Commits run inside `nix develop` with hooks enabled. Container and Nix
evaluation suites are reserved for CI.

## 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 (tool README and
migration guidance)
- [x] I have updated `CHANGELOG.md` in the `Unreleased` section
- [x] My changes generate no new warnings or errors
- [x] I have added tests that prove my feature works
- [x] New and existing targeted unit tests pass locally with my changes
- [x] Any dependent changes have been merged and published (S4 #1938)

## Additional Notes

Rebased onto S3 (#1949) and S4 (#1938). Conflict resolution preserved
both S3 and S6 changelog entries in `CHANGELOG.md` and
`assets/workspace/.devcontainer/CHANGELOG.md`, and preserved all
S3/S4/S6 amendments in `docs/rfcs/ADR-site-agnostic-projects.md`.

S6 consumes S4's public pattern validator; the S4 ADR amendment remains
the single rule definition. Rule IDs and matching file paths must be
safe for public logs. The snapshot scanner never follows symlink
targets; independently selected regular files are scanned normally.

Refs: #1932
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