Repository navigation
Keep a secondary's setup copy going when both computers made a row with the same name - #241
Merged
Merged
Conversation
…s the primary's A project (or workspace, mod) a secondary created while standing in, with the same name as one the primary has, made every snapshot apply fail on the UNIQUE index and roll back as a whole. The secondary keeps its own row, skips the primary's with a warning and moves what the copy hangs on it to the local one.
This was referenced Oct 25, 2026
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
On a device-group secondary, every setup copy from the primary failed with
UNIQUE constraint failed: projects.workspace_id, projects.slugand rolled back as a whole.The secondary had created a project while standing in, and the primary has its own project
with the same slug in the same workspace (different id). The secondary keeps rows it made
itself, so the primary's row could never be inserted, and nothing else from the copy landed either.
Fix
applySnapshot(packages/core/src/remote/snapshot.ts), on a secondary only:Plain runners are unaffected (they own no rows, so no lookups run).
Tests
remote-snapshot.test.ts: a secondary with its own "earshot" project gets the primary's copy; the agent that pointed at the primary's project now points at the local one; the digest is recorded. Same for a workspace and project pair made on both sides.bun test test/remote-snapshot.test.ts test/replica.test.ts test/stand-in-waiting.test.ts test/remote-link.test.ts: 71 pass.pnpm -r typecheckclean.