Repository navigation
Merge duplicate people and companies - #81
Draft
Pallavikumarimdb wants to merge 1 commit into
Draft
Pallavikumarimdb wants to merge 1 commit into
Pallavikumarimdb wants to merge 1 commit into
Conversation
|
Thanks for your first pull request to Gravity.
A maintainer will review this soon. Ask anything on the thread. |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
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.
What changes
Introduces an atomic
merge_recordsbusiness operation and side-by-side review modal that allows users to merge duplicate person or company records into a canonical record while choosing which conflicting fields to keep. Relationships, conversations, meetings, deals/opportunities, actions, tasks, and notes are atomically moved to the canonical record within one transaction, private conversations remain private to their owner, and the merge is logged inchange_events.Closes #42
How you know it works
tests/merge-records.test.ts:person.merged/company.mergedis recorded inchange_events.(productId, purpose)combinations are deduplicated cleanly without index collision, stopping duplicate active sequence enrollments.ownerIdandvisibility: 'private', so non-owners in teammate context cannot view them after the merge.404 Not Found.companyIdrepointing and invalidation of pending outbound touch approvals.409 Conflictand self-merges are rejected with400 Bad Request.tests/operation-compatibility.test.ts(109 operations passing).tests/merge-ui.test.tsx:/api/crmwithmerge-records.Ctrl+Kcommand menu.Screenshots
(Attach screenshots of the side-by-side review dialog showing the canonical record on the left, the duplicate candidate on the right, and the conflict resolution options).
Checklist
bun run verifypasses (lint, licenses, types, tests, build, public smoke test)bun run test:filespasses if I touched the file librarypackages/operations/catalog.ts, so HTTP and MCP stay in steppackages/i18n/translations/en.jsonbun run db:generateand exercised locally (or none were needed)Limitations
None. Merging is locked at the organization level per transaction to prevent race conditions during repointing.