Repository navigation
🏷️ fix: Preserve Conversation Tag Identity - #15748
dustinhealy wants to merge 15 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are correctness and tenant-isolation risks in the updated tag mutation paths (see stored PR comments) that should be addressed before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR refactors conversation tag catalog handling to reduce rename-related inconsistencies by introducing rename-reservation metadata (renameTo / reservedNames), tenant-aware tag operations, and authoritative tag counts derived from committed conversation membership rather than cached deltas.
Changes:
- Add schema support for in-progress renames and reserved tag-name claims with a supporting unique partial index.
- Update tag methods to be tenant-aware, ensure required indexes exist even when auto-indexing is disabled, and derive public tag counts from conversations.
- Update the legacy
/api/tagsroutes to pass tenant context and to reject combined rename + reorder requests early with a 400.
File summaries
| File | Description |
|---|---|
| packages/data-schemas/src/schema/conversationTag.ts | Adds renameTo/reservedNames fields and a unique partial index to reserve tag names across rename flows. |
| packages/data-schemas/src/methods/conversationTag.ts | Implements tenant-scoped tag operations, derived counts, rename reservation, and index-provisioning with retry. |
| packages/data-schemas/src/methods/conversationTag.methods.spec.ts | Expands coverage for derived counts, rename recovery, tenant boundaries, and index provisioning behavior. |
| api/server/routes/tags.js | Passes tenantId through to tag methods and adds early 400 validation for rename+position requests. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8404dc23e1
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 85d15eed4d
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1927bd87fb
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8168cbec31
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 08ec4ffcb4
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 08ec4ffcb4
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 929ff88bfa
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e543f892ee
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11165278e0
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b69b0cabce
ℹ️ 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".
|
@dustinhealy merge conflicts |
Summary
Conversation membership currently uses mutable bookmark names: an assignment racing with a rename can retain the old name and disconnect the conversation from its bookmark. Membership now references the existing
ConversationTag._id, so renaming changes the catalog label while preserving membership and conversation timestamps.How it works
The catalog owns labels; conversations store stable IDs. Browser mutations use IDs, existing name-based routes resolve labels once, and public reads project current labels from the owned catalog. Counts come from committed membership, and deleted or foreign identities cannot become valid membership.
Portable imports resolve names locally and ignore source IDs; local copies preserve identities, and exports carry names. Failed imports compensate their conversations and messages but retain shared catalog entries, including empty bookmarks. Failed create-and-attach requests return 404 for unavailable conversations and may also retain the catalog entry. Retries reuse those identities; users can explicitly delete unneeded bookmarks. Successful membership changes refresh parameterized conversation lists.
A separate Meilisearch catalog index preserves label search without rewriting every conversation on rename. MongoDB revalidates search results against ownership and current membership. Enabled startup index sync audits the tag index in paced background batches to recover interrupted deletions. This does not gate readiness, but total maintenance work grows with catalog size on every rollout.
Upgrade: back up MongoDB, stop every old writer, run the migration, then start only upgraded writers:
Preflight rejects malformed records, including missing or invalid catalog positions, before writing. Catalog and membership writes use bounded batches; retries preserve committed identities and metadata. Startup checks a completion marker, and every existing unmarked database requires migration. Mixed-version writers are unsupported. Rollback requires restoring the complete pre-upgrade backup and rebuilding search indexes; subsequent writes are lost.
See the implementation and cutover guide and the companion documentation PR.
Change Type
Testing
Focused validation includes real MongoDB race, tenant, migration/retry, HTTP error, and import-retention tests; real QueryClient membership/cache tests; and Meilisearch indexing, deletion, and recovery tests. Current focused suites passed: 48 migration/membership tests, 28 HTTP/import tests, 43 client tests, 93 indexing tests, and 154 shared-search/DocumentDB compatibility tests.
Schema and frontend typechecks/builds, scoped import sorting/checks, ESLint, and formatting passed. Tagged Lighthouse passed with median LCP 3.46 seconds, CLS 0.039, and TBT 119 ms. The full monorepo suite has not been run locally; CI results are attached to the PR.
Representative reproduction commands:
Test Configuration:
mongodb-memory-serverfor database tests.Checklist