Skip to content

fix(reconcile): generate own self-heal companion with a stable-release install - #489

Merged
joshua-temple merged 2 commits into
mainfrom
feat/generate-own-selfheal-companion
Jul 6, 2026
Merged

joshua-temple merged 2 commits into
mainfrom
feat/generate-own-selfheal-companion

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

Cascade's own self-heal companion (.github/workflows/pin-reconcile.yaml) was hand-authored separately from the generator that emits the equivalent companion for users, so the two drifted. Its install step resolved the newest release with gh release list -R stablekernel/cascade -L 1, which includes prereleases, letting cascade's own CI self-install an rc. Cascade's own repo must only self-update to a stable, non-prerelease release.

Fix

  • Extend the reconcile companion generator with an own-repo variant (WithOwnRepo() functional option, existing two-arg NewReconcileGenerator and its caller untouched). The own-repo companion is emitted from the same template as the user emission and differs only where it must: it installs the latest non-prerelease release, scans both .github/workflows/ and .github/actions/ for governed refs, and stages plus commits the regenerated workflows and the pin manifest.
  • Replace .github/workflows/pin-reconcile.yaml with the generator output. The only behavioral change versus the prior committed file is the release selector, now gh release list -R stablekernel/cascade --exclude-pre-releases --exclude-drafts -L 1 --json tagName -q '.[0].tagName'. The versioned asset glob cascade_*_linux_amd64.tar.gz is preserved.
  • Add a drift-lock test that regenerates the own-repo companion and asserts byte-equality with the committed file, mirroring the existing pin-consistency lint, so a future hand-edit is caught in CI.
  • Lock the pr.yaml reconcile-detector invariants (both-tree scan, reconcile --check --check-output pin-reconcile-result.json, --changed-file wiring, result upload) with a shape test. The detector lives inside pr.yaml's multi-purpose workflow-drift job, which builds the binary from source and shares an advisory frame with the non-reconcile verify step, so its shape is locked in place rather than regenerated into the required gate.
  • Codify the standard in CONTRIBUTING.md: cascade's own self-heal companion is generated from the same template as the user emission, installs a stable release, and is drift-locked.

Verification

  • go build ./..., go test ./..., go test ./... -race, and golangci-lint run ./... all clean.
  • Intentional-trip proof, run locally against the built binary: bumping a governed action ref in internal/generate/action_pins.yaml turned the consistency lint red; running the exact command the generated companion emits (cascade reconcile --own-repo --action-pins internal/generate/action_pins.yaml --changed-file ...) re-adopted the real ref and regenerated, turning the lint green again. Scratch edits restored.
  • The generated companion and the pr.yaml detector shape are both locked by tests.

…e install

Cascade's own pin-reconcile companion was hand-authored and installed the
newest release tag unfiltered, so its CI could self-install an rc or a draft.
Generate the companion from the same reconcile generator that emits a user's
companion, in a new own-repo variant, and install the latest non-prerelease
release instead. The own-repo variant scans both the workflow and
composite-action trees, runs reconcile in own-repo mode, and commits the
regenerated workflows with the updated action_pins.yaml. A drift-lock test
holds the file byte-for-byte against the generator.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@github-actions

github-actions Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

All PR Validation checks passed.

The own-repo self-heal companion (.github/workflows/pin-reconcile.yaml) is
cascade-generated and drift-locked but lives outside cascade's own manifest
workflow plan, so verify's orphan scan wrongly claimed it as manifest drift once
it began carrying the shared GeneratedFileMarker.

Give the own-repo emission a distinct provenance marker
(OwnRepoGeneratedFileMarker) and teach findOrphans to skip files carrying it,
while a file bearing the plain GeneratedFileMarker that is not planned is still
flagged. Regenerate pin-reconcile.yaml with the new marker and lock it in tests.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple merged commit 8ec4e06 into main Jul 6, 2026
19 checks passed
@joshua-temple
joshua-temple deleted the feat/generate-own-selfheal-companion branch July 6, 2026 14:39
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