Skip to content

Keep items' roots when a cloud strategy is duplicated - #273

Open
SunkenInTime wants to merge 2 commits into
mainfrom
t3/duplicate-keeps-roots
Open

SunkenInTime wants to merge 2 commits into
mainfrom
t3/duplicate-keeps-roots

Conversation

@SunkenInTime

Copy link
Copy Markdown
Owner

Turning from page 1 to page 2 of a duplicated cloud strategy: the agents glide

"Duplicate strategy" on a cloud strategy gave every item and lineup in the copy a fresh random id. In a play animated across pages, an item and its copy on the next page are paired by the root their ids share (#267), so in the duplicate they no longer paired: every page turn faded them instead of gliding. This makes the duplicate keep those roots.

What changes

  • strategies:duplicate gives each copied item and lineup id a copy id that keeps its root (<root>~cp1~<uuid>), instead of a plain uuid. Items that were copies of each other in the source are still copies of each other in the duplicate.
  • New convex/lib/pageCopyId.ts mirrors the app's page_copy_id.dart: the same parser (only a mark followed by a canonical lowercase uuid counts as a copy) and the same no-nesting rule.
  • A root too long for the app to store a change under keeps a plain id. The app's outbox key is about 120 characters plus the item's URL-encoded id, and Hive refuses keys over 255, so roots over 80 encoded characters get a plain id. Only items imported with unusually long ids are affected, and they fade as before.
  • Everything else about duplicating is unchanged: pages, settings, images (still copied under the copy's id), lineup images, the budget, and the one-transaction rollback.

Rollout

This is server-only, with no schema change, no protocol bump and no change to any function's arguments or results. Merging deploys it to production. Clients that predate #267 treat the new ids as ordinary strings: items in a duplicate fade there, as they do today.

Ground truth

Dev was running this code together with #267–#272.

  • In the web build in Edge, I duplicated "Copy to page GT 4" from the library card menu. Its Jett was copied from page 1 to page 2 and moved there.
  • In the duplicate, the two Jetts are gt-jett-h-01~cp1~ef3765a9… and gt-jett-h-01~cp1~27f9e82d…: one root, new ids. The second agent pairs the same way.
  • Turning from page 1 to page 2 of the duplicate, the first frame (top left above) caught both agents fully opaque at in-between positions. They glide; nothing fades.

Tests:

  • convex/pageCopyId.test.ts covers roots, look-alike ids, copies of copies, and the long-root fallback measured URL-encoded.
  • convex/strategyDuplicate.test.ts has a new test: an agent copied between pages in the source gives two agents in the duplicate with the same root and new ids, and the image and lineup keep their roots too. The existing 27 duplicate tests still pass.
  • npm run test:convex: all pass. npx tsc --noEmit passes.

ci: convex

🤖 Generated with Claude Code

A duplicate gave every item and lineup a fresh random id, so items the
source had copied between pages were no longer copies of each other in
the duplicate: its page transitions faded them instead of gliding. Each
now gets a copy id that keeps its root (lib/pageCopyId.ts, mirroring the
app's page_copy_id.dart), unless the root is too long for the app to
store a change under.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4355efa3-4ddd-434b-bf02-dc833cd8f637

📥 Commits

Reviewing files that changed from the base of the PR and between 830f3b4 and 3a96d05.


⛔ Files ignored due to path filters (1)
  • convex/_generated/api.d.ts is excluded by !**/_generated/**

📒 Files selected for processing (4)
  • convex/lib/pageCopyId.ts
  • convex/pageCopyId.test.ts
  • convex/strategies.ts
  • convex/strategyDuplicate.test.ts

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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