Repository navigation
Resolve project slug clashes between device group computers - #243
Merged
Merged
Conversation
Both computers of a group could create a project with the same slug in the same workspace while apart. The setup copy then failed on every sync with a UNIQUE constraint error and the primary deferred the secondary's project (and everything hanging on it) forever. - Setup copy: local rows whose slug the copy claims step aside (placeholder when the copy rewrites them, a free slug as this computer's own change when they are kept) - Replica intake: a project or workspace whose slug is taken gets a free slug once the whole pull is in - A failed setup copy no longer blocks messages to a runner that already has a setup and the vault key
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
While the main Mac was away, the stand-in Mac created a project "Earshot" in a workspace where the main Mac had created one with the same slug a bit earlier (different ids). From then on:
UNIQUE constraint failed: projects.workspace_id, projects.slugFix
snapshot.ts): before upserting a table with a unique slug (projects,workspaces), local rows whose slug the copy claims step aside: a placeholder when the copy rewrites them anyway (also fixes slug swaps), or the next free slug (earshot-2) when the row was made on this computer and is kept. That rename is written as this computer's own change (asOwn), so it still replicates to the primary.replica.ts): a project or workspace whose slug another row holds gets the next free slug, but only on the retry pass after the whole pull is in, so a slug that a later change in the same pull frees doesn't cause a rename.runners.ts): when the setup copy fails before a chat starts or a message is sent, the work goes ahead on the runner's earlier setup (memory and browser sessions still sync, the runner card keeps the error). This does not apply if the runner never had a setup, is missing the vault key, or is unreachable.Tests
replica.test.ts: a project both computers made while apart lands asearshot-2on the retry pass instead of staying deferredremote-snapshot.test.ts: projects that swapped slugs on the controller swap on the runner too; a project a secondary made while apart yields its slug and stays pending for the primary