Repository navigation
feat(sync): merge upstream releases into main instead of rebasing - #59
Merged
Merged
Conversation
The scheduled sync rebased the fork's commits onto each new upstream release cut and force-pushed main. It stranded mid-replay three times (the agent gets one turn), replayed earlier cuts' release commits, and a force-push from a behind checkout can erase merged PRs. The host now starts the sync itself: it picks the target release, and scripts/sync-merge-release.mjs begins `git merge --no-ff --no-commit` and applies every mechanical resolution (upstream CI the fork does not keep, package.json version hunks, release-owned files, the lockfile, files only an earlier release cut changed, the root version pin). When main already contains the release, the agent never starts. The agent resolves the rest, commits the merge, and builds and checks it. The host publishes only a committed, clean merge that contains both the release and everything origin/main had, with a plain fast-forward push. Any failure parks the attempt on sync/attempt-<X.Y.Z>-<time> and puts main back on origin/main, so no run strands the checkout. Replayed on the real 2026.10.5 merge, the script's 175 mechanical resolutions match the hand resolution of #57 byte for byte and leave the same 21 files for judgment. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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
The scheduled upstream sync (
scripts/sync-and-deploy.sh→.sandcastle/sync.ts) rebased the fork's commits onto each new upstream release cut, then force-pushedmain:origin/maindrops whatever it lacks.2026.10.5 was synced by hand as a merge (#57). This PR makes the scheduled sync do the same.
Solution
The host starts the sync:
--target, or the newestrelease/X.Y.Z).scripts/sync-merge-release.mjsstartsgit merge --no-ff --no-commitand applies the mechanical resolutions:package.jsonversion hunks, which keep the fork's other changespnpm-lock.yamldeploy:globallymainalready contains the release, the agent never starts.The agent resolves the remaining conflicts, commits the merge (
git commit --no-edit), then installs, builds, checks, runs the tests and verifies fork features. The rules in.sandcastle/sync-prompt.mdcome from the 10.5 merge.The host publishes. It pushes only a committed, clean merge that contains both the release and everything
origin/mainhad, and no files the sync created and left uncommitted. The push is a plain fast-forward.On failure (a stop gate, an agent crash, a merge that didn't start, a failed check or a rejected push), the attempt is parked on
sync/attempt-<X.Y.Z>-<time>andmainis reset toorigin/main. The next run starts clean, and no stash is involved.docs/UPSTREAM-SYNC.mdandscripts/sync-and-deploy.shnow describe the merge flow, and the docs warn against squash-merging a sync (#57 and #58 lost their ancestry that way).Impact
mainalready recordsrelease/2026.10.5as merged, so the next run merges only what the next release changed since 10.5.Evidence
Replay on the real 10.5 merge: run on the pre-sync fork
main(936d08b) againstrelease/2026.10.5, the script resolved 195 of 216 conflicts. Its 175 content resolutions are byte-identical to chore(sync): merge upstream release/2026.10.5 #57's hand resolution (git diff --cached d226c4617d8is empty for those files). The same 21 files were left for judgment.Tests:
pnpm test test/scripts/sync-merge-release.test.ts --maxWorkers=1passes 4 tests in 3.1 s. Synthetic repositories cover:Three mutations each make a test fail: an "earlier cut" rule that takes every file, CI removal that ignores the fork's own files, and dropping the deletion guard.
.sandcastle/sync.tstypechecks against the installed sandcastle (tsc --noEmit).oxlintandoxfmtpass on the changed files.Review: an independent review found six defects in the first version, all fixed here: crash paths that left the merge in progress, uncommitted new files, a deleted file becoming an empty file, an unchecked merge start, fragile parking, and a rejected push leaving
mainahead.Not exercised end to end: the agent turn itself has not run. The first scheduled run after re-enabling the cron is that proof. A failure there parks and resets instead of stranding.
🤖 Generated with Claude Code