Repository navigation
fix(sync): auto-resolve post-release main->dev sync conflicts - #1406
Merged
Merged
Conversation
Smoke deploys must treat the consumer's root CHANGELOG.md as consumer state: preserved across deploys, bootstrapped from the scaffold skeleton only when absent, and never a copy of devkit's own changelog. The rewritten integration test replaces assertions that encoded the buggy copy-devkit-history behavior. Refs: #1403
…loys The smoke branch rsynced with --delete and no preserve excludes, then copied devkit's entire changelog (.devcontainer/CHANGELOG.md mirror) over the consumer's root CHANGELOG.md. The prepare-changelog unprepare safety valve no-ops since #590 (the first heading is always ## Unreleased), so devkit's dated/linked ## [X.Y.Z] headings replaced the consumer's frozen ## [X.Y.Z] - TBD heading — colliding with main's finalize rewrite of the same line and guaranteeing a main<->dev sync conflict whenever the versions coincide (structural for devkit-smoke-test). Root-anchor a /CHANGELOG.md exclude on the smoke rsync (consumer state, shielded from copy and --delete; .devcontainer/CHANGELOG.md still syncs), bootstrap the scaffold skeleton only when the file is absent, and drop the cp + unprepare block. prepare-changelog unprepare loses its only production caller; the vig-utils CLI surface is left untouched deliberately (removing a subcommand is out of scope for this bugfix). Refs: #1403
The deploy-entry seeding awk must be bounded at the next release heading and able to seed an Unreleased section that lacks a ### Changed subheading. Refs: #1403
The seeding awk never cleared in_unreleased at the next ## [X.Y.Z] heading, so with an empty Unreleased section the deploy bullet landed in the first ### Changed of a RELEASED section (the bounded verify awk then failed the job). Bound the insert scope at the release-heading boundary and synthesize a ### Changed subheading when Unreleased lacks one (defensive: prepare-changelog always emits the full skeleton). Refs: #1403
Pin the sync-main-to-dev auto-resolve pipeline shape in both decoupled copies: conflicted-path enumeration and snapshot allowlist, dev-side materialization, GitHub-signed commit via the pinned commit-action, merge re-verification against the updated sync branch, and the effective-conflict flag consumed by PR creation and auto-merge. Refs: #1403
… commit docs/issues and docs/pull-requests snapshots are generated independently on dev (nightly sync-issues) and on the release branch (release-time sync-issues), so every release produced add/add conflicts on paths absent at the merge base and the post-release main->dev sync PR opened conflicted every time. The signed-commits ruleset (all refs, no bypass actors) forbids a plain runner merge commit, so the resolution is a single-parent GitHub-signed commit-action commit that aligns the sync branch's copy of each conflicted snapshot with dev's content: with both merge sides identical the conflict vanishes. Dev's possibly-staler snapshot self-heals at the next nightly sync-issues run, whose updated-since cutoff predates anything the release-time sync captured. Only paths merge-tree reports as conflicted are aligned — a snapshot changed only on main still merges cleanly and is not touched. Any conflicted path outside the snapshot dirs (or a delete/modify conflict) keeps the existing manual merge-conflict path, preserved bit-for-bit via the falsy fallback in the effective-conflict expression. Note the issue text proposed taking main's side; that would require a merge commit the runner cannot sign, and snapshots are derived artifacts of live GitHub state, so the dev-side alignment loses nothing beyond a <=24h staleness window. Applied identically to the canonical workflow and the workspace template (intentionally decoupled copies, pinned by the new cross-copy test). Refs: #1403
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.
Summary
Fixes the deterministic conflicts that make the post-release
main → devsync PR open red on every train (devkit#1395, smoke-test#351). Both root causes from #1403 are addressed; themerge-conflictmanual path remains for genuine conflicts.Cause B — issue/PR snapshot add/add conflicts (every gitflow repo)
sync-main-to-dev.yml(both the canonical copy and the workspace template, kept byte-identical and pinned by a new cross-copy test) gains three steps between branch push and PR creation:git merge-tree --write-tree --name-only, parses the conflicted paths, and proceeds only when every conflicted path is a generated snapshot (docs/issues/,docs/pull-requests/) still present on dev (delete/modify stays manual). It materializes dev's side of exactly those paths in the working tree.vig-os/commit-action(COMMIT_APP token) commits them to the pushed sync branch.merge-treeagainst the updated branch; only a proven-clean result flips the effective conflict flag consumed byCreate PRandEnable auto-merge(falsy-fallback expression keeps today's manual path bit-for-bit when auto-resolve is skipped or ineligible).Why dev-side wins (deviation from the issue's "main side" suggestion): the
Signed commitsruleset (~ALLrefs, no bypass actors) means the runner can only produce single-parent GitHub-signed commits via GraphQL — a merge commit taking main's side is impossible. Aligning the sync branch to dev's content makes both merge sides identical, so the conflict vanishes; snapshots are derived artifacts of live GitHub state, and dev's next nightly sync-issues run re-captures anything main had (its updated-since cutoff predates the release-time sync), so nothing is lost beyond a ≤24 h staleness window. Only paths merge-tree reports as conflicted are touched — a snapshot changed only on main still merges cleanly.Cause A — smoke deploy clobbered the consumer changelog (smoke-test only)
The smoke branch of
init-workspace.shrsynced with--deleteand no preserve excludes, then copied devkit's entire changelog over the consumer's rootCHANGELOG.md; theprepare-changelog unpreparesafety valve no-ops since #590 (first heading is always## Unreleased). Devkit's dated## [X.Y.Z](…devkit…)heading replaced the consumer's frozen## [X.Y.Z] - TBD, colliding with main's finalize rewrite whenever versions coincide — structural for devkit-smoke-test.Now: root-anchored
--exclude='/CHANGELOG.md'(consumer state preserved;.devcontainer/CHANGELOG.mdstill syncs), scaffold skeleton bootstrapped only when the file is absent, cp+unprepare block deleted.prepare-changelog unprepareloses its only production caller; the vig-utils CLI surface is deliberately untouched (removing a subcommand is out of scope here).Also fixes the latent unbounded seeding awk in
repository-dispatch.yml: the deploy bullet is now bounded at the next## [heading and a### Changedsubheading is synthesized when## Unreleasedlacks one.Rollout timing (corrected)
An earlier draft of this PR claimed the fix only goes live one release late. That was wrong: push-triggered workflows execute the workflow file at the pushed commit, and devkit's own run history proves it — the 1.7.0 promote's sync run executed at
headSha bcb0a257, the promote merge commit itself. Since this fix flows dev →release/1.7.1→ main, the 1.7.1 merge commit on main contains the new workflow, so the very sync run fired by the 1.7.1 promote is already the auto-resolving version — full live proof arrives with the next ordinary release, no extra train needed. Cause A proves even earlier, at the first 1.7.1-rc smoke deploy (the installer runs from the tagged tree). The smoke-test's already-copied changelog history is preserved as-is and converges over subsequent releases.Zero-release proof: replay against the real 1.7.0 conflict
The pre-resolution state of devkit#1395 still exists in history (
dc25bfbb's parents:bcb0a257= main,665a0901= dev). Replaying the new auto-resolve pipeline against it:git merge-tree --write-tree --name-onlyexits 1 and the output matches the parser's format assumption exactly (tree OID, conflicted paths, blank line, informational messages).docs/issues/issue-1386.md,docs/issues/issue-1391.md,docs/issues/issue-529.md,docs/pull-requests/pr-1385.md— all inside the allowlist, andissue-529.mdis a content conflict (not add/add), confirming both classes are covered.dc25bfbb.Verification
tests/test_workflow_sync_autoresolve.py(new, parametrized over both workflow copies incl. cross-copy identity) — 9 passed.test_smoke_workspace_changelog_available_in_devcontainer_and_rootpassed against a freshly built dev image.## [9.9.9] - TBDsurvive) and bootstraps the scaffold when absent; seeding-awk shape pinned injust.bats. The new awk was additionally exercised against three fixtures (skeleton present / missing### Changedbefore a released section / Unreleased at EOF) — bullet lands inside Unreleased in all three.pre-commit run --all-filesgreen; fast pytest 510 passed; vig-utils 566 passed (untouched);just.bats54/54; rendered-template + smoke actionlint (Adopt actionlint for authored and per-mode rendered workflow templates #995) green; fullinit-workspace.batsgreen.Refs: #1403