Skip to content

Adopt Project boundary moves on devices - #3075

Open
kunickiaj wants to merge 9 commits into
mainfrom
feat/project-move-device
Open

kunickiaj wants to merge 9 commits into
mainfrom
feat/project-move-device

Conversation

@kunickiaj

@kunickiaj kunickiaj commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Description

Devices record coordinator Project moves for boundaries they can access, even when they have no local Project mapping. Snapshots and incremental updates can then reconcile the same memory across the old scope and the Project boundary using the stored origin and full clock.

With sync_boundary_migration=on, a device advertises support to the coordinator, remaps its Projects, and moves the memories it authored. It syncs a private SQLite backup to disk before moving any rows. codemem sync migration status reports the backup path and size and how many rows still carry the old scope.

This prevents duplicate copies when a snapshot or incremental update arrives before or after the device learns about a move. Memories with IDs that were already ambiguous can stay duplicated. codemem sync duplicates lists them. See the Project move trust model.

Type of Change

  • 🚀 Feature (new functionality)
  • 🐛 Bug fix (fixes an issue)
  • 📚 Documentation (docs-only change)
  • 🔧 Maintenance (refactor, chore, CI, etc.)
  • 🧪 Testing (test-only changes)

Testing

  • 852 tests passed in 21 isolated files, including device moves, snapshots and replication, membership proof, backup durability, and migration status.

  • Four new cases reproduced duplicate growth before the fix. They now match ordinary sync when two copies already exist.

  • pnpm run tsc and pnpm --silent lint:delta -- --base 6656ec22 passed.

  • Relevant checks pass locally

  • Added/updated tests for changes

  • Manually verified changes work as expected

Checklist

  • Code follows project style (lint ratchet passed)
  • Self-review completed
  • Documentation updated (if needed)
  • No new warnings introduced

@kunickiaj kunickiaj changed the title feat(sync): adopt per-Project moves on each device Adopt Project boundary moves on devices Nov 29, 2026
@kunickiaj
kunickiaj marked this pull request as ready for review November 29, 2026 04:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T15:37:52.659156Z a45b952 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 165bb0c512

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/src/sync-replication.ts Resolved
@kunickiaj
kunickiaj changed the base branch from feat/project-move-routes to graphite-base/3075 November 29, 2026 04:12
@kunickiaj
kunickiaj force-pushed the feat/project-move-device branch from 165bb0c to ba0d0af Compare November 29, 2026 04:15
@kunickiaj
kunickiaj changed the base branch from graphite-base/3075 to feat/project-move-routes November 29, 2026 04:15
Base automatically changed from feat/project-move-routes to main November 29, 2026 04:35
@kunickiaj
kunickiaj force-pushed the feat/project-move-device branch from ba0d0af to c960418 Compare November 29, 2026 04:40

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c960418bdf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/src/sync-replication.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f77702c7c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/src/sync-replication.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a45b9528a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +635 to +637
if (plan.keep) {
keepMoveCopy(target.db, plan);
return 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore live snapshots that match an old-side reassignment clock

If a receiver applies a reassign_scope old-side operation and then receives the boundary copy through a snapshot, both have the same clock because recordScopeReassignment() assigns one clock to both sides. The planner therefore returns keep, and this branch moves the inactive source tombstone into the boundary without restoring its content or active state. The snapshot baseline advances, and subsequent equal-clock arrivals keep the tombstone, leaving the memory unreadable. The fresh evidence beyond the earlier incremental finding is that applyMoveSnapshotItem() still unconditionally takes this branch; the exception added to keepInboundMove() does not cover either snapshot application path. Handle the matching reassignment tombstone before treating the live snapshot as a replay.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant