Skip to content

fix: sync-preview restores version instead of ignoring files#1203

Closed
notgitika wants to merge 1 commit into
aws:mainfrom
notgitika:fix/sync-preview-restore-version
Closed

fix: sync-preview restores version instead of ignoring files#1203
notgitika wants to merge 1 commit into
aws:mainfrom
notgitika:fix/sync-preview-restore-version

Conversation

@notgitika
Copy link
Copy Markdown
Contributor

Summary

Improves on #1078 — instead of git checkout --ours to discard main's entire package.json/package-lock.json (which throws away new deps, scripts, etc.), this approach:

  1. Saves preview's version before the merge
  2. Merges main's content normally (getting all changes)
  3. If there's a conflict on package.json/lock, accepts main's version then fixes the version field
  4. After merge, surgically replaces only the version field back to preview's value
  5. Commits that as a separate "restore preview version" commit for clarity

CHANGELOG.md and schemas merge normally from main — no special handling needed since they're autogenerated/diverge naturally.

Also keeps the structural improvements from #1078:

  • Always creates a PR (respects branch protection, never pushes directly)
  • Dedup check — skips if a sync PR is already open
  • Cleaner step separation

Test plan

  • Workflow YAML is valid (verified locally with yaml.safe_load)
  • Push to main triggers sync-preview workflow
  • Clean merge creates a PR against preview with version restored
  • Conflicts in package.json/lock are auto-resolved (accept main, restore version)
  • Other file conflicts produce a PR with conflict markers
  • Existing open PR prevents duplicate creation

Instead of keeping preview's entire package.json/package-lock.json
(which discards new deps, scripts, etc. from main), accept main's
content and surgically restore only the version field to preview's
value after merge.
@notgitika notgitika requested a review from a team May 11, 2026 20:47
@github-actions github-actions Bot added the size/m PR size: M label May 11, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label May 11, 2026
@notgitika notgitika closed this May 11, 2026
Copy link
Copy Markdown

@agentcore-cli-automation agentcore-cli-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the workflow changes end-to-end. The approach is a clear improvement over #1078 — surgically restoring only the version field preserves new deps/scripts from main instead of discarding them, and splitting branch-creation/merge/PR-creation into distinct steps reads much better.

Verified the tricky bits:

  • git add -A + git commit on conflicted files does stage and commit files with conflict markers as intended (confirmed locally), so the conflict-PR path produces a branch with markers for humans to resolve.
  • git checkout --theirs + git add correctly removes package.json/package-lock.json from the unmerged set, so the subsequent --diff-filter=U check only sees remaining real conflicts.
  • The version-restore node snippet reliably runs in both the clean-merge (main bumped version with no conflict) and conflict-resolved-by-theirs cases.
  • Concurrency group + pre-merge Check for existing PR step correctly gates against duplicate sync PRs.

No blocking issues. LGTM.

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants