Skip to content

feat(rollback): scope the git-history fallback to the component - #529

Merged
joshua-temple merged 1 commit into
mainfrom
feat/rollback-history-scope
Jul 8, 2026
Merged

joshua-temple merged 1 commit into
mainfrom
feat/rollback-history-scope

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

Per-component rollback scopes the recorded previous-version ring and its state writes, but when it exhausts the ring and falls through to reading prior deployments from git history, newGitHistoryReader read the flat state.<env> history. A deep component rollback could recover a sibling component's prior deployment.

Fix

  • gitHistoryReader gains a component; when set, extractEnvState resolves each historical manifest through config.ReadComponentState(blob, manifestKey, component) so recovery stays inside state.components.<name>.<env> (the same overlay path rollback and finalize already use). The rollback flow threads its component into the reader.
  • An empty component reads the flat history unchanged, byte-identical.

Verification

go build ./..., go test ./... (2652 pass), go test ./... -race (2652 pass), golangci-lint run ./... clean; single-component byte-identical baseline gate green. Tests prove a component recovers only its own prior deployment and never a sibling's (asserted negatively), a full plan recovers from the component's history while a sibling-only version is unresolvable, and the single-component path is unchanged (red before the fix, green after).

Refs #294.

When a component rollback exhausts its recorded previous-version ring and falls through to reading prior deployments from git history, it now resolves each historical manifest through the component's own state.components.<name>.<env> rows instead of the flat state.<env> node. A component can no longer recover a sibling's prior deployment from deep history. An empty component reads the flat history exactly as before, byte-identical. This completes the read-side scoping the recorded ring and state writes already had.

Refs #294.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple merged commit 70a238f into main Jul 8, 2026
20 checks passed
@joshua-temple
joshua-temple deleted the feat/rollback-history-scope branch July 8, 2026 13:36
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