Repository navigation
Conversation
Every device that opens a source with no layers creates a "Notes" layer, and each one got a random id. Once the same work meets itself, through an imported file today or sync later, that becomes two "Notes" layers with the annotations split between them. Deriving the id from the source makes the two layers one by construction. Only new default layers get the derived id. An existing layer keeps its id, because every annotation in it points there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Foundation fix F6 from
PHASE_6_OVERVIEW.md(#17).The bug
ensureDefaultLayercreates a "Notes" layer withcrypto.randomUUID()for any source that has no layers. Every device that opens the same source therefore creates its own default layer. Once one person's work from two devices meets, through an imported.annotatecodefile soon and sync later, they get two "Notes" layers with their annotations split between them.The fix
New default layers get the id
${sourceId}::layer:default(defaultLayerId). The same source on any device arrives at the same layer by construction.Existing layers are untouched.
ensureDefaultLayerstill returns the first existing layer whenever there is one, and a layer that already exists keeps its id, because every annotation in it points to that id. No migration is needed.Tested
New
src/ink/store.test.ts, using fake-indexeddb:npm run typecheck,npm test(271 tests),npm run buildandnpm run test:e2e(29 tests, Chromium) all pass locally.🤖 Generated with Claude Code