feat(rollback): scope the git-history fallback to the component - #529
Merged
Merged
Conversation
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>
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
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,
newGitHistoryReaderread the flatstate.<env>history. A deep component rollback could recover a sibling component's prior deployment.Fix
gitHistoryReadergains acomponent; when set,extractEnvStateresolves each historical manifest throughconfig.ReadComponentState(blob, manifestKey, component)so recovery stays insidestate.components.<name>.<env>(the same overlay path rollback and finalize already use). The rollback flow threads its component into the reader.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.