Skip to content

fix: validate reused release sync snapshots - #377

Merged
qiuethan merged 1 commit into
stagingfrom
fix/release-sync-snapshot-validation
Nov 5, 2026
Merged

qiuethan merged 1 commit into
stagingfrom
fix/release-sync-snapshot-validation

Conversation

@qiuethan

@qiuethan qiuethan commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

What this fixes

A precreated or replaced automation/sync-main-* branch could pass snapshot validation even when its tree did not represent the merge of its recorded parents. An older staging parent could roll back released files; a snapshot could also discard a production-only hotfix while recording main as merged. This addresses the P1 review on #374.

Snapshot validation now recomputes git merge-tree --write-tree <first-parent> <main> and requires that result to match the snapshot. Conflicts and mismatches stop before opening or merging a sync PR. It also verifies that merging the snapshot into current staging preserves staging's exact tree, catching a production-revert case even when the snapshot matches its own parents. The validation runs again immediately before a merge. Valid snapshots remain reusable after staging advances, preserving concurrent changes and intentional reverts.

Changed-file rationale

File Why needed
.github/scripts/promotion.cjs Validate the actual merge represented by every sync snapshot, including reused branches.
.github/scripts/promotion.test.cjs Reproduce rollback and omitted-hotfix failures with real disposable Git repositories, cover concealed conflicts, and preserve valid retries after staging advances.

Scope stays within .github. There are no configuration, migration or deployment changes. The workflow must receive this fix before promotion to main.

Validation

Fresh CI passed on 286ed790b0699dff7c5163a762dc0cfcb912f5d4.

  • The rollback and omitted-hotfix regressions failed against the original implementation. A further production-revert regression demonstrated why current staging must also be checked. All pass after the fix.
  • make test-release test-promotion passed, including conflict rejection and valid retry/concurrent-staging cases.
  • make check passed with locked dependencies and Python imports pinned to this worktree.
  • git diff --check passed. Tests use disposable local Git repositories and fake GitHub calls; no live sync or production promotion was performed.

@github-project-automation github-project-automation Bot moved this to Backlog in Misty Nov 3, 2026
@github-actions github-actions Bot added size/m < 200 lines changed zone: .github Owned by the .github zone (docs/CODE-OWNERSHIP.md) labels Nov 3, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to In review in Misty Nov 5, 2026
@qiuethan
qiuethan added this pull request to the merge queue Nov 5, 2026
Merged via the queue into staging with commit 032ab28 Nov 5, 2026
18 checks passed
@qiuethan
qiuethan deleted the fix/release-sync-snapshot-validation branch November 5, 2026 06:46
@github-project-automation github-project-automation Bot moved this from In review to Done in Misty Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m < 200 lines changed zone: .github Owned by the .github zone (docs/CODE-OWNERSHIP.md)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants