Skip to content

fix(leads): preserve canonical master identity during dedup merge - #109

Merged
debpalash merged 3 commits into
mainfrom
fix/pr99-canonical-dedup-identities
Oct 23, 2026
Merged

debpalash merged 3 commits into
mainfrom
fix/pr99-canonical-dedup-identities

Conversation

@debpalash

@debpalash debpalash commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Extends #99, retaining rudycelekli's original commit, to close a remaining master-deletion path. Text comparisons let SQLite and the ORM store resolve "01", 1.0, "+1", and " 1 " to master ID 1, merge it, and delete it with a successful response.

Compare canonical IDs returned by the store, exclude the resolved master, and deduplicate resolved duplicates. Master-only aliases return 400. Adds coverage for numeric aliases, repeated duplicates, aliased master inputs, empty inputs, and missing IDs across both stores.

Validation:

  • Original focused suite: 22 passed. Eight added master-alias cases fail on fix(leads): keep the master lead when a merge lists it as a duplicate #99 because the master is deleted.
  • Corrected expanded focused suite: 40 passed.
  • GitHub CI on correction commit 2826d27: backend SQLite, PostgreSQL integrity/tenancy, and frontend lint/tests/build pass. Browser check pending at this update.
  • Local full backend attempt: 2266 passed, 134 skipped, 8 deselected, 10 failed. Seven failures are HTTPX missing SOCKS support in the host environment; retrying with socksio passes those and reaches a separate enrichment benchmark failure (444 passed, 27 skipped before stop). Two legacy search tests also failed locally. CI backend passes; local full-suite results are not a clean pass.
  • ORM endpoint fixture uses SQLite, not live PostgreSQL; existing PostgreSQL integrity/tenancy CI passed.

Direct modification of the contributor fork was denied by the integration. This branch preserves the contributor's original commit and adds the correction. Supersedes #99 when merged.

rudycelekli and others added 2 commits October 14, 2026 19:09
POST /api/leads/dedup/merge fetched every id in duplicate_ids, merged them
into the master and then deleted all of them. When the caller sends a whole
cluster from /api/leads/dedup (which includes the master), the master was
deleted along with the duplicates and the response still reported "merged".

Leave the master out of the duplicates, merge a repeated id once, and reject
a request whose only duplicate is the master.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
Deduplicate canonical store IDs so numeric aliases cannot delete the master.
Add regression coverage for both lead stores.

Copy link
Copy Markdown
Owner Author

Review validation update: all 40 focused tests pass locally. GitHub's full backend run passed 2276 tests, 134 skipped, 8 deselected on 2826d27; PostgreSQL integrity/tenancy and frontend lint/tests/build also passed. The browser regression job is still in its Chromium installation step, so I have left this PR unmerged pending that check.

The local full-suite attempt was not clean (2266 passed, 10 failed); missing SOCKS support explains seven failures, and the benchmark and two legacy search tests also failed in this host. The independent GitHub backend run passes all ten of those tests. Direct PostgreSQL endpoint merge regression coverage has not been added; the two-store endpoint fixture exercises LeadDB and PgLeadStore-on-SQLite.

Record the author's DCO certification for correction commit
2826d27 without changing its tree
or rewriting the original contributor history.

Signed-off-by: Palash Debnath <4178343+debpalash@users.noreply.github.com>
@debpalash
debpalash merged commit 1c7be70 into main Oct 23, 2026
4 checks passed
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.

2 participants