Skip to content

feat(ci): add the scan-config sync lane for register-only changes to main - #1677

Closed
c-vigo wants to merge 2 commits into
devfrom
feature/1676-scan-config-sync-lane
Closed

c-vigo wants to merge 2 commits into
devfrom
feature/1676-scan-config-sync-lane

Conversation

@c-vigo

@c-vigo c-vigo commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Description

Implements the scan-config sync lane designed in #1676: carry register-only changes to main without cutting a release, gated by machine-checked proofs.

main and dev each scan their own closure against their own .vulnixignore, so a register amendment on dev leaves main's nightly lane red until the next release train. The lag is structural — the register moved 32 times in 90 days (~one per 3 days) against a roughly weekly release cadence — and a permanently-red security lane is the one failure mode a gate cannot afford, because it teaches you to ignore it.

Cutting a patch release was the wrong tool: .vulnixignore is not an image input, so the artifact would be identical but for the version string, while devkit-upgrade opened a no-op adoption PR in every consumer repo.

Type of Change

  • feat -- New feature

Modifiers

  • Breaking change (!)

Changes Made

.github/workflows/scan-config-sync.yml — opens the PR as the release App.

This is the crux, not ceremony. main requires one approving review, GitHub forbids authors approving their own PRs, and main's only bypass actor is OrganizationAdmin — no App holds bypass, and promote-release.yml merges with a plain gh pr merge --merge. So a human-authored PR to main is unapprovable by the only human there is, which is exactly why every release PR into main is already App-authored (#1672, #1648, #1620). The lane borrows that one mechanism and nothing else: which commits get cherry-picked, when the lane runs, and the final merge click all stay manual.

.github/workflows/scan-config-guard.yml — proves the PR is safe.

Gate Proves
A Diff touches only .vulnixignore, .trivyignore, .github/dependency-review-allow.txt
B devkitImage/devkitImageEnv .drv paths identical to main's — the artifact cannot differ
C main's closure is green under the proposed register
D Nothing already expired
E Reports added/removed CVE IDs as a comment (never blocks)
F No release/* in flight — moving main mid-train dismisses its approval
G main's ## Unreleased still empty (prepare-release/prepare-hotfix require it)

Why the lane is additive-only, and why Gate C exists. The register is not append-only: a pin advance on dev clears exceptions (6 of those 32 commits), and dev's pin advances first. So there is always a window where dev has correctly deleted an exception that main's older, still-vulnerable closure depends on — mirroring the file would strand that finding and turn main red. Gate C therefore doesn't reason about whether a removal is safe; it runs the real gate against main's real closure and reads the exit code, making a stranding deletion unmergeable rather than merely discouraged.

Gate B is a proof rather than an argument about which files are image inputs, which is what keeps Gate A a cheap fast-fail instead of carrying the whole safety case.

.github/label-taxonomy.local.toml (new) — the lane's label. It goes in the repo-local extension, not the shared taxonomy: the shared file syncs into assets/workspace/ and would scatter this label across consumers that have none of this machinery. Verified it does not appear under assets/workspace/ after sync-manifest.

docs/CONTAINER_SECURITY.md — new "### 6. Scan-config sync lane" defence-layer section.

Changelog Entry

### Added

- **Scan-config sync lane: carry register changes to `main` without a release**
  ([#1676](https://github.com/vig-os/devkit/issues/1676))
  - `main` and `dev` each scan their own closure against their own
    `.vulnixignore`, so a register amendment on `dev` left `main`'s nightly lane
    red until the next release train. The register moved 32 times in 90 days
    against a roughly weekly release cadence, so the lag was structural
  - Two workflows: `scan-config-sync.yml` opens the PR **as the release App**
    (`main` requires one approving review and GitHub forbids authors approving
    their own PRs, so a human-authored PR there is unapprovable), and
    `scan-config-guard.yml` proves it is safe to merge
  - Gates: the diff is confined to the scan registers, the image derivation is
    byte-identical to `main`, **`main`'s closure is green under the proposed
    register**, nothing is expired, no release train is in flight, and `main`'s
    `## Unreleased` is still empty. The register delta is posted as a comment
  - The green-closure gate is what makes the lane safe to use additively: a pin
    advance on `dev` *clears* exceptions that `main`'s older closure still needs,
    so the lane runs the real gate against `main`'s real closure rather than
    reasoning about whether a removal is safe
  - Cutting a patch release for this would have been a no-op — `.vulnixignore`
    is not an image input — while opening an adoption PR in every consumer repo

Testing

  • Tests pass locally (just test) — 21 new assertions; full suite 1120 passed, 1 skipped, unchanged
  • Manual testing performed (below)

Manual Testing Details

TDD, two commits: afc092ae (21 assertions, all red — PYTEST EXIT: 1) → 6f73f652 (implementation, 21 passed).

The tests pin the invariants whose failure modes are silent or catastrophic rather than merely wrong:

  • Guard job carries no job-level if. A job-level condition yields a skipped job; were the guard ever promoted to a required status check, a skipped job on a release PR would leave that PR waiting forever on a check that never reports. "Inactive" must mean ran and passed.
  • Gates are label-scoped, not diff-scoped. A release PR legitimately changes CHANGELOG.md, .vig-os and .vulnixignore (via the dev merge), so a diff-keyed guard would fail every release.
  • Guard never writes. main sets dismiss_stale_reviews_on_push, so a guard that pushed would discard the very approval the lane depends on. Asserted via job-level contents: read plus no git push/git commit/gh pr merge anywhere in the job.
  • Opener mints an App token, so the PR is App-authored and the approval is legal.

just precommit green (exit 0, 53 hooks) — including actionlint + shellcheck over both new workflows.

Not yet exercised end-to-end. These are shape and lint proofs; the runtime behaviour of gates B and C (nix drvPath comparison across two revisions, and the nightly-artifact fast path) has not run in CI, because workflow_dispatch only registers from the default branch. That is the rehearsal in the next step.

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

Additional Notes

Bootstrap, and it needs your admin bypass. workflow_dispatch only registers from the default branch, so the opener cannot be dispatched until it exists on main. After this merges to dev:

  1. Cherry-pick 6f73f652 onto a branch off main.
  2. Open a PR and merge it with OrganizationAdmin bypass — one time only.

That keeps both refs byte-identical so the next release merge is clean. Worth noting the bootstrap PR itself will trip Gate A if the guard is already on main (it changes workflows and docs, not registers) — but it won't be labelled scan-config-sync, so the guard stays inactive-and-passing, which is precisely the label-scoping behaviour above.

Still unverified, flagged in #1676 and worth watching during the rehearsal: main sets require_extra_approval_for_unattributed_changes: true. App-authored commits should be attributed to the app rather than counting as unattributed, but that has not been proven. If it bites, a sync PR would silently demand a second approval that cannot be supplied.

Refs: #1676

Covers the two workflows that carry register-only changes to main without
cutting a release, before either exists. 21 assertions, all red.

The invariants chosen are the ones whose failure modes are silent or
catastrophic rather than merely wrong:

- The guard must ALWAYS report. A job-level `if` yields a skipped job, and
  were the guard ever promoted to a required status check, a skipped job
  on a release PR would leave that PR waiting on a check that never
  arrives. "Skip" has to mean "ran and passed", so the label scoping
  belongs on the steps, not the job.
- The guard must NEVER write. main carries dismiss_stale_reviews_on_push,
  so a guard that pushed would discard the very approval the lane exists
  to enable.
- The gates must be LABEL-scoped, not diff-scoped. A release PR
  legitimately changes CHANGELOG.md, .vig-os and often .vulnixignore via
  the dev merge, so a guard keyed on the diff would fail every release.
- The opener must author the PR as the App. main requires one approving
  review, GitHub forbids authors approving their own PRs, and no App
  holds bypass on main -- so a human-authored PR there is unapprovable by
  the only human there is. Every release PR to main is App-authored for
  exactly this reason.

Gate C is asserted to run the real vulnix-gate rather than inspect the
diff, because the register is not append-only: a pin advance on dev
clears exceptions that main's older closure still needs, so the lane
cannot reason about whether a removal is safe and must read the exit
code instead.

Refs: #1676
…main

main and dev each scan their own closure against their own
.vulnixignore, so a register amendment on dev left main's nightly lane
red until the next release train. The lag is structural, not occasional:
the register moved 32 times in the 90 days to 2026-09-24 (~one per 3
days) against a roughly weekly release cadence, so main's lane was
stale more often than current -- and a permanently-red security lane is
the one failure mode a gate cannot afford, because it teaches the
maintainer to ignore it.

Cutting a patch release was the wrong tool. .vulnixignore is not an image
input: the image bakes ./docs/MIGRATION.md, ./.vig-os and
assets/workspace/, the register is in none of them, and it is not a
scaffold asset -- so the artifact would be identical but for the version
string, while devkit-upgrade opened a no-op adoption PR in every consumer
repo. The gap never blocked releasing either, since release.yml's gate
scans the release branch cut from dev.

Two workflows. scan-config-sync.yml opens the PR as the release App;
scan-config-guard.yml proves it safe. The App authorship is the crux, not
ceremony: main requires one approving review, GitHub forbids authors
approving their own PRs, and main's only bypass actor is
OrganizationAdmin -- no App holds bypass, and promote-release.yml merges
with a plain `gh pr merge --merge`. A human-authored PR to main is
therefore unapprovable by the only human there is, which is why every
release PR into main is already App-authored. Everything else stays
manual: which commits are cherry-picked, when the lane runs, the merge.

The lane is ADDITIVE-ONLY because the register is not append-only. A pin
advance on dev CLEARS exceptions (6 of those 32 commits) and dev's pin
advances first, so there is always a window where dev has correctly
deleted an exception that main's older, still-vulnerable closure depends
on. Mirroring the file would strand that finding. Gate C therefore does
not reason about whether a removal is safe -- it runs the real gate
against main's real closure and reads the exit code, so a stranding
deletion is unmergeable rather than merely discouraged.

Gates: A path allowlist, B derivation identity (equal .drv paths prove
the artifact cannot differ, which keeps A a cheap fast-fail rather than
the whole safety case), C main-goes-green, D expiry hygiene, E register
delta as a comment, F release-train interlock, G main's Unreleased still
empty. Gate C reuses the newest nightly artifact when it scanned main's
current head, falling back to a rebuild.

Two shape rules are load-bearing and covered by the tests: the guard job
carries no job-level `if` (a skipped job would, if the guard were ever
made a required check, leave release PRs waiting forever on a check that
never reports), and the gates are label-scoped rather than diff-scoped (a
release PR legitimately touches CHANGELOG.md, .vig-os AND .vulnixignore).
The guard also never writes, since main sets
dismiss_stale_reviews_on_push and a push would discard the approval the
lane depends on.

The lane's label goes in .github/label-taxonomy.local.toml rather than
the shared taxonomy: the shared file syncs into assets/workspace/ and
would scatter the label across consumers that have none of this
machinery.

21 shape assertions green; full suite 1120 passed, unchanged.

Refs: #1676
@c-vigo

c-vigo commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #1678.

This version baked scan-config into the lane's identity and used a path allowlist as its primary gate — which encodes a guess about what is published rather than proving it, and would need extending for every new kind of release-neutral change.

#1678 generalises it: the contract is now derivation identity (devShells.default, devkitImage, devkitImageEnv .drv paths equal to main's), which proves the published artifacts cannot differ whatever the diff touched. Scan registers become just one thing the lane carries, alongside devkit's own workflows, tests/** and most of docs/**.

The scan-register safety check survives there as a content-triggered extra rather than the lane's purpose.

@c-vigo c-vigo closed this Sep 24, 2026
@c-vigo
c-vigo deleted the feature/1676-scan-config-sync-lane branch September 24, 2026 12:40
c-vigo added a commit that referenced this pull request Sep 24, 2026
…lease (#1678)

## Description

Implements the release-neutral lane from #1676: **merge to `main`
without cutting a release**, admitted only when a machine proof shows no
published artifact changes.

`main` can only be written by a release — `prepare-release` and
`prepare-hotfix` are the only lanes, and both cut a tag, publish a GHCR
image and trigger `devkit-upgrade` adoption PRs across every consumer
repo. But plenty of changes belong on `main` while altering **nothing a
consumer receives**: devkit's own `.github/workflows/**` (not the
scaffolded copy under `assets/workspace/`), `tests/**`, most of
`docs/**`, the scan-time registers.

Two cases motivated it:

1. A `workflow_dispatch` workflow must exist on the **default branch**
to be dispatchable at all — so a new workflow cannot reach `main`
without a release or an admin bypass.
2. `main` and `dev` each scan their own closure against their own
`.vulnixignore`, so an amendment on `dev` leaves `main`'s nightly lane
red until the next train (32 register commits in 90 days vs a weekly
cadence).

> Supersedes #1677, which solved only case 2 and baked "scan config"
into the lane's identity. This generalises it: scan registers are now
just one thing the lane carries.

## Type of Change

- [x] `feat` -- New feature

### Modifiers

- [ ] Breaking change (`!`)

## Changes Made

**`release-neutral-open.yml`** — opens the PR **as the release App**.

Not ceremony. `main` requires one approving review, GitHub forbids
authors approving their own PRs, and `main`'s only bypass actor is
`OrganizationAdmin` — no App holds bypass, and `promote-release.yml`
merges with a plain `gh pr merge --merge`. So a human-authored PR to
`main` is **unapprovable by the only human there is**, which is exactly
why every release PR into `main` is already App-authored (#1672, #1648,
#1620). Nothing else is automated: which commits get carried, when the
lane runs, and the merge all stay manual.

**`release-neutral-guard.yml`** — proves release-neutrality.

| Gate | Proves |
|------|--------|
| **1** | No release content (`CHANGELOG.md`, its mirror, `.vig-os`) in
the diff |
| **2** | `devShells.default`, `devkitImage`, `devkitImageEnv` `.drv`
paths **identical** to `main`'s |
| **3** | Consumer scaffold under `assets/` byte-identical |
| **4** | `main`'s `## Unreleased` still empty |
| **5** | No `release/*` train in flight |
| **6** | Verdict comment listing the files carried |

**Gate 2 is the contract.** Equal derivation paths mean the published
artifacts *cannot* differ, whatever the diff touched — a proof, not an
argument about which files happen to be inputs. It is deliberately
**not** a path allowlist: an allowlist encodes a guess about what is
published and would need extending for every new kind of release-neutral
change. It compares `devShells.default` as well as the image because a
`direnv`/`bare` consumer never pulls the image — it evaluates the dev
shell straight from the flake — so an image-only check would wave
through a change that alters every such consumer's toolchain.

**Content-triggered extra.** When the diff touches `.vulnixignore`, the
guard also replays `main`'s own nightly gate and requires exit 0. Not
part of the contract — it exists because the register is not
append-only: a pin advance on `dev` *clears* exceptions and `dev`'s pin
advances first, so there is always a window where `dev` has correctly
deleted an exception `main`'s older closure still needs.

**Docs** go to `docs/RELEASE_CYCLE.md`, beside the hotfix lane (its
sibling concept). `docs/CONTAINER_SECURITY.md` carries only a pointer
plus the two register-specific notes — the procedure has one home.

**Label** lives in `.github/label-taxonomy.local.toml` (new), not the
shared taxonomy: the shared file syncs into `assets/workspace/` and
would scatter this label across consumers that have none of this
machinery. Verified it does *not* appear under `assets/workspace/` after
`sync-manifest`.

## Changelog Entry

See `5ca1764c` — deliberately its own commit (explained under Testing).

```
### Added

- **Release-neutral lane: change `main` without cutting a release**
  ([#1676](#1676))
  - `main` could only be written by a release, so a change that alters nothing a
    consumer receives — devkit's own `.github/workflows/**`, `tests/**`, most of
    `docs/**`, the scan-time registers — either waited for the next train or
    inflated the version for a no-op that handed every consumer an adoption PR
  - `release-neutral-open.yml` opens the PR **as the release App** (`main`
    requires one approving review and GitHub forbids authors approving their own
    PRs, so a human-authored PR there is unapprovable), and
    `release-neutral-guard.yml` proves the change is release-neutral
  - The contract is **derivation identity**: `devShells.default`,
    `devkitImage` and `devkitImageEnv` `.drv` paths must equal `main`'s, which
    proves the published artifacts cannot differ whatever the diff touched. It
    covers `direnv`/`bare` consumers too, who never pull the image
  - Also gated: no release content in the diff, the `assets/` scaffold
    untouched, `main`'s `## Unreleased` still empty, and no release train in
    flight. A verdict comment lists the files carried
  - A changelog entry makes a change **non**-release-neutral (it is mirrored
    into the scaffold and baked into the image), so keep changelog edits in
    their own commit to leave the rest cherry-pickable
  - When a lane PR touches `.vulnixignore` the guard additionally replays
    `main`'s own nightly gate, since a pin advance on `dev` clears exceptions
    that `main`'s older closure may still need
```

## Testing

- [x] Tests pass locally (`just test`) — 23 new assertions; full suite
**1122 passed, 1 skipped**
- [x] Manual testing performed (below)

### Manual Testing Details

**TDD**, three commits: `b18329f6` (23 assertions, red) → `3669c3b2`
(implementation, green) → `5ca1764c` (changelog, separate — see below).

**Gate 2 was measured, not assumed.** `nix eval …drvPath` against `main`
and against this branch:

| Tree | `devShells` | `devkitImage` | `devkitImageEnv` | Verdict |
|------|-------------|---------------|------------------|---------|
| `main` | `464904d9…` | `d6ikbz96…` | `262sli4a…` | — |
| workflows + label + docs + tests | `464904d9…` | `d6ikbz96…` |
`262sli4a…` | **admitted** |
| the same **plus a `CHANGELOG.md` entry** | `464904d9…` | `ffbgni7c…` |
`262sli4a…` | **refused** |

Two things follow, and both are load-bearing:

1. **The lane's own implementation is release-neutral by its own
contract** — so it can travel by the very lane it adds, once
bootstrapped.
2. **A changelog entry makes a change non-neutral.** The changelog is
mirrored into `assets/workspace/.devcontainer/CHANGELOG.md` and baked
into the image. That is why gate 1 refuses it, why it is barred a second
time by gate 4 (an entry on `main` leaves `## Unreleased` non-empty,
which `prepare-release` and `prepare-hotfix` refuse to start on), and
why the changelog is a **separate commit** here rather than folded into
the feature. `RELEASE_CYCLE.md` records this as a runbook rule.

`just precommit` green (exit 0) including `actionlint` + `shellcheck`
over both workflows.

**Not yet exercised end-to-end.** These are shape, lint and eval proofs.
The guard has never *run* — `workflow_dispatch` only registers from the
default branch, so the first live exercise is the bootstrap.

## 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 (`RELEASE_CYCLE.md` +
pointer; not template-generated)
- [x] I have updated `CHANGELOG.md` in the `[Unreleased]` section (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

**Bootstrap — needs one admin bypass.** The lane cannot deliver itself:
`workflow_dispatch` only registers from the default branch. After this
merges to `dev`:

```bash
git switch -c chore/1676-bootstrap-release-neutral origin/main
git cherry-pick b18329f 3669c3b      # NOT 5ca1764 (the changelog)
git push -u origin HEAD
```

Then open a PR and merge with **`OrganizationAdmin` bypass**, one time
only. Both refs then hold identical content so the next release merge is
clean, and the lane carries its own future changes from then on.

Dropping the changelog commit from that cherry-pick is required, not
tidiness — carrying it would leave `main`'s `## Unreleased` non-empty
and **break `prepare-release` and `prepare-hotfix`**.

**Still unverified, flagged in #1676:** `main` sets
`require_extra_approval_for_unattributed_changes: true`. App-authored
commits *should* be attributed to the app rather than counting as
unattributed, but that is unproven. If it bites, a lane PR would
silently demand a second approval that cannot be supplied — worth
watching on the first live run.

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