fix: make hotfix finalize fully trunk-based (read and write)#206
Merged
Conversation
Hotfix finalize read the prior environment state from the checked-out manifest, which on the pull_request closed run is the env branch. Promote finalize writes env state only to trunk, so the env branch lags trunk and records a stale or absent state SHA, making finalize fail with 'environment has no recorded state SHA'. Finalize now reads the prior state from the trunk manifest, resolving trunk the same way the state write does. Reading goes through the Contents API on real GitHub and plain git under act, mirroring the existing write seam. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
Finalize read prior env state from trunk but still wrote the checked-out env-branch manifest to trunk. On the pull_request closed run the checked-out tree is the env branch, whose state lags trunk because promote writes env state only to trunk. Serializing that lagging manifest to trunk wiped the non-target envs' recorded state. Finalize now uses the trunk manifest as the write basis: it reads trunk once, mutates only state[targetEnv] with the hotfix result, and writes that manifest back to trunk. Every other env's trunk state is preserved. The single trunk read feeds both the prior-state lookup and the write basis. 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
Hotfix finalize was not trunk-based on either the read or the write side, and the write side caused data loss.
Fix
Finalize now treats the trunk manifest as the single source of truth for both halves:
Verification