feat: populate per-environment deploy-history ring - #157
Merged
Merged
Conversation
Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
EnvState.Previous []EnvStateSnapshotis a reserved-shape ring that was declared but never populated on the promote and rollback state-write paths. Only an environment's currentSHA/Versionwas retained, so resolving a prior version for arbitrary-depth manual rollback had no in-state target list and depended on git archaeology.Fix
Populate the ring at every point an environment's state pointer transitions to a new SHA, capturing the outgoing
{SHA, Version, CommittedAt, CommittedBy}snapshot on the front (newest first) before the pointer advances.EnvState.PushPreviousSnapshot(newSHA)ininternal/config/history.go, bounded by the named constMaxPreviousSnapshots = 10. It skips no-op transitions (same SHA) and the initial write (no prior SHA), and caps the ring at N by dropping the oldest entries.updateState(before the env pointer is overwritten)Apply(env-scoped branch only)Finalize(converted from an unbounded manual prepend to the shared bounded helper)Purely additive: existing readers ignore
Previous; it is now simply populated. Bounded retention prevents unbounded manifest growth. No new struct fields, no manifest schema change.Verification
go build ./...,go test ./...(1251 pass),golangci-lint run ./...(clean)go test -raceon config/promote/rollback/hotfix (437 pass)generate-workflow --config .github/manifest.yaml --forceproduces no.github/workflows/.github/actionsdrift.e2emodule:go build ./...+go vet ./...clean.Scope note
This is the history-ring population only. The manual rollback-that-deploys path, divergence-marking of a rolled-back env, and an end-to-end scenario asserting accumulated ring contents are a follow-up: the e2e harness assertion surface does not yet expose ring-contents checks, and adding that belongs with the manual-rollback scenario in the follow-up. Coverage here is unit and integration across all three write paths, including bounded-ring and round-trip tests.