Skip to content

CAP-CRM-DQ-001Detect duplicate records after changes

Markdown

CAP-CRM-DQ-001

Detect duplicate records after changes

Markdown
  • DocumentDraft
  • Product intentConfirmed
  • ImplementationObserved

KindCapabilityProduct areaCRMModuleDuplicate Review and Record MergingRevision1

Read atservices-crm a8d1364freact-console baf6dae3

The Formal Contract

The narrative above explains; the sections below are authoritative — the rules, scenarios and tests this document binds.

Outcomes
Background changes produce review suggestions without another staff action.Detection failures do not block saves, imports or integration writes.Overly common values do not create an unbounded queue of comparisons.
Surfaces
job
Preconditions
A workspace contact or organization has a committed create, edit or delete.
Postconditions
Detection has refreshed the applicable keys and inserted, updated or removed the affected candidates.
Intent sources
services-crm:docs/merging/README.md#Status (architecture and plan approved by Andrew 2026-10-11)services-crm:docs/merging/decisions.md#Settled by inspection or engineering practice (LLM in detection: none)

Controls

18 controls apply, from the corpus control catalogue.

TC-CRY-004 TC-DAT-001 TC-DAT-002 TC-DAT-003 TC-IAM-001 TC-IAM-005 TC-IAM-006 TC-LOG-005 TC-MON-001 TC-MON-002 TC-PI-001 TC-PI-002 TC-PI-004 TC-PRV-001 TC-PRV-002 TC-TEN-001 TC-TEN-002 TC-TEN-003

Business Rules

12 rules, 11 to be proved before approval. A rule's product intent is derived from its origin: 12 confirmed by a product decision, the rest inheriting this capability's confirmed.

IdRuleKindEnforced atProvenance
01must prove
Confirmed
Committed change events trigger background detection; saving neither waits for that work nor fails because detection fails.
origin: services-crm:docs/merging/README.md#Status (architecture and plan approved by Andrew 2026-10-11)
policyserviceobserved
02must prove
Confirmed
Detection refreshes keys and scores only for changes to matching names, birth date, spouse, affiliations, organization identity and hierarchy, origin identifiers or contact details, excluding job title, notes, status and region.
✓ For example, a coordinator corrects a member's last name; the member's pairs are re-scored.✗ By comparison, a coordinator changes the member's job title; nothing is re-scored.
policyservicetest
03must prove
Confirmed
Comparison requires a shared key: contacts use e-mail, phone, phonetic name, phonetic surname with postal code, surname stem with birth date or origin; organizations use normalized name, phonetic name with postal code, non-free-mail domain, phone or origin.
origin: services-crm:docs/merging/README.md#Status (architecture and plan approved by Andrew 2026-10-11)
calculationservicetest
04must prove
Confirmed
Lookup skips a workspace key value with more than 200 holders, still uses rarer keys and adds a zero-point reason identifying the skipped key type.
calculationservicetest
services-crm:modules/duplicates/tests/integration/services/detection/duplicate-detection.integration.spec.js#still found the two records a rarer key joins, which is the telephone number only they hold
05must prove
Confirmed
When a key becomes too common, detection removes open detected pairs supported only by it, refreshes pairs with independent evidence and preserves dismissed, confirmed and manual pairs.
origin: D-47 (cited in services-crm:docs/merging/duplicate-detection.md#3. Match keys; no milestone record holds it, FND-CRM-DQ-018)
lifecycleservicetest
services-crm:modules/duplicates/tests/integration/services/detection/duplicate-detection.integration.spec.js#retired the pair the number alone joined, its only evidence being disqualified
06must prove
Confirmed
Within a detection batch, all records receive their keys before comparison, allowing records created together to match each other.
calculationservicetest
services-crm:modules/duplicates/tests/integration/services/detection/duplicate-detection.integration.spec.js#found the two records of the batch in each other, which no lookup outside the batch could have done
07must prove
Confirmed
An open detected pair disappears when it loses every shared key or scores below 35; dismissed, confirmed, manual and portal-sign-up pairs remain stored.
lifecycleservicetest
08must prove
Confirmed
Rescoring updates an existing pair's score, band, evidence and evaluation time without replacing its identity, status, origin, dismissal or first detection time.
invariantservice, databasetest
09must prove
Confirmed
Contact matching excludes addresses and phones linked from an organization, so shared employer details do not establish a duplicate pair.
calculationservicetest
10must prove
Confirmed
A failed detection pass returns failures for every event in its batch, allowing the entire batch to be delivered again.
lifecycleservicetest
services-crm:modules/duplicates/tests/integration/services/detection/duplicate-change-events.integration.spec.js#fails every event of the group, so the queue delivers the whole group again
11
Confirmed
Import-marked changes are reserved for a later completion pass, but current captured events lack that marker and receive ordinary detection.
policyservicetest
services-crm:modules/duplicates/tests/unit/services/detection/duplicate-change-events.spec.js#answers no job id for the events the capture writes today, so every one of them is processed
12must prove
Confirmed
A detection pass reads and creates pairs only within the workspace of its execution.
invariantservice, databasetest
services-crm:modules/duplicates/tests/integration/services/detection/duplicate-detection.integration.spec.js#answers a pass over a record of ANOTHER tenant with nothing, the tenant being the execution’s

Scenarios

IdGivenWhenThenProvenance
01Two records for the same person arrive together.The background handler processes their change events.One pair records their shared names, birth date and address.test
services-crm:modules/duplicates/tests/integration/services/detection/duplicate-change-events.integration.spec.js#found the two records in each other, which only a batch whose keys are written first can do
02A previously rare number supports two pairs, one of which also shares an e-mail address.Another holder pushes the number above the frequency ceiling.The phone-only pair disappears and the e-mail-supported pair remains.test

Edge Cases

IdGivenWhenThenProvenance
03Two employees link their work phone and address from their employer.Detection evaluates both contacts.Those linked details supply neither keys nor duplicate evidence.test
services-crm:modules/duplicates/tests/integration/services/detection/duplicate-detection.integration.spec.js#keys neither the linked number nor the linked address’s postal code, which are the organization’s

The Markdown files under specs/ in rhythmsoftware/rhythm-v2-docs are the canonical source of truth. This reader is a generated, read-only projection of them.