Repository navigation
Surface the person._possible_duplicate marker in the desktop UI - #2125
Merged
Merged
Conversation
Completes the desktop half of the convergence duplicate indicator (ADR-065 §4) left open by core#1734/#2115: mark_possible_duplicates already stamps properties.person._possible_duplicate on sync convergence, but nothing read or displayed it — a flagged duplicate was only visible via raw node.properties. - NodeService::is_possible_duplicate(&Node) -> bool: pure read-side counterpart to mark_possible_duplicates, reading the same properties.<node_type>._possible_duplicate path via the same POSSIBLE_DUPLICATE_FIELD constant so the two can never disagree. Generic across node types by construction. Covered by a new test (default-false cases: missing field, explicit false) plus the existing convergence test suite, whose local marker() helper now delegates to this accessor instead of re-deriving the property path. - lib/utils/possible-duplicate.ts: the frontend's equivalent accessor (isPossibleDuplicate), since node.properties already reaches the frontend unfiltered on every existing read path — no new RPC needed. - person-schema-form.svelte (the person property panel): a small "Possible duplicate — click to review" badge appears when the node is flagged. Clicking it re-runs the exact same find_duplicate_for lookup and reuses the exact same adopt-existing Alert (Use existing / Keep as new) the creation-time suggestion from #2115 already has — no parallel resolution UI. - possible-duplicate-badge.svelte: a self-contained inline-node-view indicator (mirrors the existing RecoveredItemsBadge pattern), wired into base-node.svelte next to it. Renders nothing unless the node is a flagged person, so it's inert everywhere else. Own compact popover offers the same Use existing / Dismiss choice via the same backend lookup and non-destructive navigate action. Both surfaces are purely informational and non-modal: neither can block editing the node, and dismissing only closes the local popover — the marker itself is never cleared, since admin-driven merge/dismiss machinery is explicitly out of scope per the parent ADR. Closes #2116 Co-Authored-By: Claude <[email protected]>
An independent adversarial review of PR #2125 (no blockers, but three real non-blocking findings) flagged: - possible-duplicate-badge.svelte's runCheck() had no staleness guard, unlike person-schema-form.svelte's checkForDuplicate. Rapid open/close/reopen of the popover could start two overlapping lookups; whichever resolved last won regardless of start order. Fixed with a monotonic generation counter (mirrors the existing guard's intent, but keyed on start order rather than value equality so it also covers same-value overlapping calls); also guards the `checking` flag so a superseded call's `finally` can't flip it back on while a newer check is still in flight. - The same class of gap existed in person-schema-form.svelte itself: checkForDuplicate's staleness guard compared the checked value by string equality, which cannot distinguish two overlapping calls for the SAME value (e.g. a blur-triggered check racing a badge-triggered recheck). Replaced with the same generation-counter approach: only the most recently STARTED check may ever write duplicateMatch, regardless of resolution order. - recheckPossibleDuplicate() (the badge's click handler) was a silent no-op when the recheck found no live collision — since the marker is permanent (nothing clears it), a recheck finding nothing is an expected, not exceptional, outcome and needs to be visible. Added a "No conflicting person found right now." message, cleared on the next edit or recheck attempt. Five new regression tests cover the generation-counter fix in both components and the no-match feedback path. Co-Authored-By: Claude <[email protected]>
Contributor
Author
|
An independent adversarial review verdict: APPROVE, zero blockers. It flagged 3 real non-blocking findings, addressed in the follow-up commit:
Also added the missing defensive-backstop test the review noted ( Remaining findings (defensible code duplication between the two badge implementations, and pre-existing |
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.
Summary
Closes #2116. Completes the desktop half of the ADR-065 §4 convergence duplicate indicator, left open by core#1734/#2115:
NodeService::mark_possible_duplicates(merged today in #2115) andnodespace-sync's pulled-write handler already stampproperties.person._possible_duplicate = trueon both colliding nodes when a duplicate slips past creation-time suggestion and converges via sync — but nothing read or displayed that marker anywhere in the desktop app. It was write-only.This PR adds a minimal, non-blocking UI surface for it, reusing #2115's adopt-existing pattern rather than building new merge machinery.
What's in this PR
1. Backend read accessor
NodeService::is_possible_duplicate(&Node) -> bool(packages/core/src/services/node_service/schema.rs) — a pure, synchronous read-side counterpart tomark_possible_duplicates, reading the sameproperties.<node_type>._possible_duplicatepath via the samecore_schemas::POSSIBLE_DUPLICATE_FIELDconstant the writer uses, so the two can never disagree on the marker's location. Generic across node types by construction, matching the writer. The existingperson_duplicate_convergence_test.rssuite's localmarker()helper now delegates to this accessor (so all 5 existing convergence tests double as coverage), plus a new dedicated test for the accessor's default-false cases (missing field, explicitfalse) and its end-to-end agreement withmark_possible_duplicates's actual write.2. Frontend accessor
lib/utils/possible-duplicate.ts—isPossibleDuplicate(node), the frontend's equivalent single source of truth. No new RPC needed:node.propertiesalready reaches the frontend unfiltered on every existing read path (getNode,queryNodes, afindDuplicateFormatch, …) — nothing in core/daemon/desktop-app stripslocal_only/system-managed properties before serialization. This utility replaces what would otherwise be scattered rawnode.properties.person._possible_duplicatereads with one tested accessor.3. Property panel badge (person-schema-form.svelte)
A small "Possible duplicate — click to review" badge appears when the node being viewed/edited is flagged. Clicking it re-runs the exact same
findDuplicateFor('person', 'email', …)lookup and reuses the exact same adopt-existingAlert(Use existing / Keep as new) the creation-time suggestion from #2115 already has — literally the same state and functions, not a parallel implementation. The badge and the Alert are mutually exclusive in the DOM (no UI stacking).4. Inline node view badge (possible-duplicate-badge.svelte)
A new self-contained component mirroring the existing
RecoveredItemsBadgepattern (same inline-pill-with-popover structure, same--color-warningdesign language), wired intobase-node.sveltenext toRecoveredItemsBadge. Renders nothing unless the node is apersoncurrently flagged, so it's inert for every other node type and every unflagged person. Its own compact popover offers the same Use existing / Dismiss choice, backed by the samebackendAdapter.findDuplicateFor+navigateToNodeInOtherPanecalls as the property panel — same backend, same non-destructive action, independent (necessarily — it's a different DOM context) small implementation.Both surfaces are informational and non-modal only: neither can block editing the node it's attached to, and dismissing only closes the local popover — the marker itself is never cleared server-side (no dismiss-persistence or admin-merge mechanism is in scope, per the parent ADR's explicit non-goals).
Explicitly out of scope (per ADR-065, unchanged)
mentions/member_ofedges, tombstoning, sync-echo handling).Test plan
cargo test -p nodespace-core --lib --tests— 1154+ passed across all core test binaries, 0 failedcargo test -p nodespace-daemon --lib— 147 passed, 0 failedcargo test -p nodespace-app --lib— 61 passed, 0 failedcargo clippy --all-targets -- -D warnings -D clippy::unused-async— clean, whole workspacecargo fmt --allappliedbun run test, cold cache — 4724 passed across 218 files, 0 failed (includes 31 new tests: badge visibility/hidden states, click-to-recheck reusing the existing Alert, Use existing/Dismiss behavior, accessor edge cases)svelte-check/tsc --noEmit— 0 errorseslint— cleanbun run quality:fix— clean🤖 Generated with Claude Code