Compare identities and apply merge or alias from a card #107

Closed
opened 2026-11-05 07:53:03 +00:00 by svc-agent-writer · 2 comments

Parent

#96

What to build

Compare two Persons with their Handles and provenance and invoke #78’s merge/alias/undo commands.

Acceptance criteria

  • Reuse existing link actions with revisions and request keys; do not create a second merge implementation.
  • Show which identity survives and how old ids resolve; retain or reconcile suggestion ownership without losing evidence.
  • An old comparison cannot apply after intervening identity changes; undo preserves later unrelated work.
  • Graph merge never deletes or rewrites upstream contact cards; demonstrate both text and card flows.
  • Run the required repository checks and the focused public-MCP/worker tests for this behaviour; use the existing temporary-store and Source fixtures.
  • For every new mutation, enforce the approved write contract, expected revisions, attribution, idempotent retry and safe undo; extend applicable read projections/change feeds.
  • For every new person-associated value, extend the existing erasure path and tests; keep personal values out of logs/audit detail.

Blocked by

Filed under: operator word "ok" sha256:2689367b205c

## Parent https://git.groupthink.asia/dev/people-mind-mcp/issues/96 ## What to build Compare two Persons with their Handles and provenance and invoke #78’s merge/alias/undo commands. ## Acceptance criteria - [ ] Reuse existing link actions with revisions and request keys; do not create a second merge implementation. - [ ] Show which identity survives and how old ids resolve; retain or reconcile suggestion ownership without losing evidence. - [ ] An old comparison cannot apply after intervening identity changes; undo preserves later unrelated work. - [ ] Graph merge never deletes or rewrites upstream contact cards; demonstrate both text and card flows. - [ ] Run the required repository checks and the focused public-MCP/worker tests for this behaviour; use the existing temporary-store and Source fixtures. - [ ] For every new mutation, enforce the approved write contract, expected revisions, attribution, idempotent retry and safe undo; extend applicable read projections/change feeds. - [ ] For every new person-associated value, extend the existing erasure path and tests; keep personal values out of logs/audit detail. ## Blocked by - https://git.groupthink.asia/dev/people-mind-mcp/issues/98 Filed under: operator word "ok" sha256:2689367b205c
Collaborator

⏸ SVD architect gate: dev/people-mind-mcp#107 compare-identities-and-apply-merge-or-alias-from-a-card

Status: CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity substrate · dispatch effort high

Run: 20261105T230152Z-612e114e

Held because: CLEAN but 5 open risk(s) (3 verification · 2 decision) — HOLD-ALL parks everything. The risks, verbatim:

Open risks:

  1. No grill or ADR amendment records the new tool surface: public people_compare, and app-only people_card_compare, people_card_link and people_card_undo. The repo recorded #78's and #98's rulings in ADR 0005 Am.2 and Am.4 before implementation. Question: may dispatch add these four tools (names, row shapes, merge=blocked:, resolves rows) with README as the only record, or must a #107 grill amend ADR 0005 first? Lean: proceed, since no new kind, bucket or rule is added and via=app is already provided by Am.1 ruling 6. [decision]
  2. AC 3 ('an old comparison cannot apply after intervening identity changes') is enforced for merge via both Person revisions plus the redirected conflict. link.alias stays revisionless per ADR 0005 Am.2 ruling 2; its stale guard is the apply-time ownership check (handle-owned, owner, tombstoned). Question: accept the ADR's revisionless alias for a card-originated alias, or does #107 need an expected-revision alias? That would amend Am.2 ruling 2 and is out of this phase. [decision]
  3. The #98 blocker's issue state could not be fetched (gh denied; issue-context covers only #107). Its deliverables are on main at 726d113, eebbd86 and 4c4776d. Check: confirm dev/people-mind-mcp#98 is closed before dispatch. [verification]
  4. No numeric test baseline: the sandbox refused to execute .venv/bin/python. Check: on pristine eebbd86, before the first edit, run uv run python3 -m pytest tests/test_card_app.py tests/test_actions.py tests/test_review.py tests/test_server.py -q and assert the post-change failure set (with tests/test_compare.py added) equals the baseline set. [verification]
  5. Live App view behaviour (compare mode from tool-input other_id and the 'compare |' tool-result line, the Merge, Undo and Attach clicks, resize) is provable only in a real MCP Apps host; tests cover only the static HTML markers and the tool calls. Check (post-merge smoke): in an MCP Apps host, call people_compare on two test Persons, click Merge, then Undo; confirm people_actions shows link.merge and undo with via=app and the host token label. [verification]

Change: Move RANK_SURVIVORS (graph.py:126-129) into identity.py as identity.survivor(), and have graph._rank (graph.py:253-255) delegate to it, so the comparison and link_merge share one survivor rule. views.py and server.py may not import graph (tests/test_server.py:444-479). Add views.compare() / compare_text() as a pure reader shaped like card_suggestions and card (views.py:203-302). It resolves ids through _person_id, sets blocked=owner|same-person to mirror graph.py:698-701, and returns both Person revisions, names, handles with Source, fields with Author or Source and confidence (same RESTRICTED filter, with the card field loop factored so card output stays byte-identical), Suggestions with a shared flag, and resolves rows (the merged id plus its redirects mapped to the survivor). In server.py add public people_compare (read, bound to CARD_URI) and app-only people_card_compare (JSON plus writable flags), mirroring people_card / people_card_suggestions (server.py:129-144, 241-263). Move the people_link and people_undo bodies (server.py:296-325, 381-396) into _link(via) and _undo(via) helpers, and add app-only people_card_link and people_card_undo with via=app, mirroring the people_review / people_card_review / _review split (server.py:328-378). Register them in build_app (server.py:450-466). The worker (_apply_action, link_merge, unmerge) is unchanged. Extend card.html with a compare mode, entered from tool-input other_id or a 'compare |' tool-result line. It renders both sides, survivor and old ids, offers Merge with the loaded revisions (a conflict shows stale-view plus Reload), Undo via people_card_undo, and an Attach-handle alias whose handle-owned failure offers Compare with the holder. Text goes in through textContent only. Document the tools in README.

Files: src/people_mind_mcp/identity.py · src/people_mind_mcp/graph.py · src/people_mind_mcp/views.py · src/people_mind_mcp/server.py · src/people_mind_mcp/card.html · tests/test_compare.py · tests/test_card_app.py · tests/test_server.py · tests/test_actions.py · README.md

Decision: accept the 5 open risk(s) above and dispatch this spec (svd:go), or park (svd:skip) / re-spec (svd:respec)?

Your call (when this issue is held at the gate via svd:hold):

  • add label svd:go — approve; Half-B dispatch accepts exactly this spec (open risks accepted)
  • add label svd:fire beside svd:go — approve AND authorise the Half-B fire from the phone; never on its own
  • add label svd:skip — park it; dispatch refuses it and the issue stays for a human
  • add label svd:respec — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context

Spec: /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-05-compare-identities-and-apply-merge-or-alias-from-a-card.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-05-compare-identities-and-apply-merge-or-alias-from-a-card.md

### ⏸ SVD architect gate: dev/people-mind-mcp#107 compare-identities-and-apply-merge-or-alias-from-a-card **Status:** CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity `substrate` · dispatch effort `high` **Run:** `20261105T230152Z-612e114e` **Held because:** CLEAN but 5 open risk(s) (3 verification · 2 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. No grill or ADR amendment records the new tool surface: public people_compare, and app-only people_card_compare, people_card_link and people_card_undo. The repo recorded #78's and #98's rulings in ADR 0005 Am.2 and Am.4 before implementation. Question: may dispatch add these four tools (names, row shapes, merge=blocked:<reason>, resolves rows) with README as the only record, or must a #107 grill amend ADR 0005 first? Lean: proceed, since no new kind, bucket or rule is added and via=app is already provided by Am.1 ruling 6. [decision] 2. AC 3 ('an old comparison cannot apply after intervening identity changes') is enforced for merge via both Person revisions plus the redirected conflict. link.alias stays revisionless per ADR 0005 Am.2 ruling 2; its stale guard is the apply-time ownership check (handle-owned, owner, tombstoned). Question: accept the ADR's revisionless alias for a card-originated alias, or does #107 need an expected-revision alias? That would amend Am.2 ruling 2 and is out of this phase. [decision] 3. The #98 blocker's issue state could not be fetched (gh denied; issue-context covers only #107). Its deliverables are on main at 726d113, eebbd86 and 4c4776d. Check: confirm dev/people-mind-mcp#98 is closed before dispatch. [verification] 4. No numeric test baseline: the sandbox refused to execute .venv/bin/python. Check: on pristine eebbd86, before the first edit, run uv run python3 -m pytest tests/test_card_app.py tests/test_actions.py tests/test_review.py tests/test_server.py -q and assert the post-change failure set (with tests/test_compare.py added) equals the baseline set. [verification] 5. Live App view behaviour (compare mode from tool-input other_id and the 'compare |' tool-result line, the Merge, Undo and Attach clicks, resize) is provable only in a real MCP Apps host; tests cover only the static HTML markers and the tool calls. Check (post-merge smoke): in an MCP Apps host, call people_compare on two test Persons, click Merge, then Undo; confirm people_actions shows link.merge and undo with via=app and the host token label. [verification] **Change:** Move RANK_SURVIVORS (graph.py:126-129) into identity.py as identity.survivor(), and have graph._rank (graph.py:253-255) delegate to it, so the comparison and link_merge share one survivor rule. views.py and server.py may not import graph (tests/test_server.py:444-479). Add views.compare() / compare_text() as a pure reader shaped like card_suggestions and card (views.py:203-302). It resolves ids through _person_id, sets blocked=owner|same-person to mirror graph.py:698-701, and returns both Person revisions, names, handles with Source, fields with Author or Source and confidence (same RESTRICTED filter, with the card field loop factored so card output stays byte-identical), Suggestions with a shared flag, and resolves rows (the merged id plus its redirects mapped to the survivor). In server.py add public people_compare (read, bound to CARD_URI) and app-only people_card_compare (JSON plus writable flags), mirroring people_card / people_card_suggestions (server.py:129-144, 241-263). Move the people_link and people_undo bodies (server.py:296-325, 381-396) into _link(via) and _undo(via) helpers, and add app-only people_card_link and people_card_undo with via=app, mirroring the people_review / people_card_review / _review split (server.py:328-378). Register them in build_app (server.py:450-466). The worker (_apply_action, link_merge, unmerge) is unchanged. Extend card.html with a compare mode, entered from tool-input other_id or a 'compare |' tool-result line. It renders both sides, survivor and old ids, offers Merge with the loaded revisions (a conflict shows stale-view plus Reload), Undo via people_card_undo, and an Attach-handle alias whose handle-owned failure offers Compare with the holder. Text goes in through textContent only. Document the tools in README. **Files:** `src/people_mind_mcp/identity.py` · `src/people_mind_mcp/graph.py` · `src/people_mind_mcp/views.py` · `src/people_mind_mcp/server.py` · `src/people_mind_mcp/card.html` · `tests/test_compare.py` · `tests/test_card_app.py` · `tests/test_server.py` · `tests/test_actions.py` · `README.md` **Decision:** accept the 5 open risk(s) above and dispatch this spec (`svd:go`), or park (`svd:skip`) / re-spec (`svd:respec`)? **Your call** (when this issue is held at the gate via `svd:hold`): - add label `svd:go` — approve; Half-B dispatch accepts exactly this spec (open risks accepted) - add label `svd:fire` **beside** `svd:go` — approve AND authorise the Half-B fire from the phone; never on its own - add label `svd:skip` — park it; dispatch refuses it and the issue stays for a human - add label `svd:respec` — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context <sub>Spec: `/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-05-compare-identities-and-apply-merge-or-alias-from-a-card.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-05-compare-identities-and-apply-merge-or-alias-from-a-card.md`</sub>
Collaborator

spec-verify-dispatch Half B for dev/people-mind-mcp#107 compare-identities-and-apply-merge-or-alias-from-a-card completed integration verify.

  • PR: #134
  • Branch: feat/svd-dev-people-mind-mcp-107-compare-identities-and-apply-22b1e722
  • Commit: 3cf252fae5
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/73/pipeline/88/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Rework: 1 round(s), outcome converged
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261105T231425Z-22b1e722 --confirm-merge)
spec-verify-dispatch Half B for dev/people-mind-mcp#107 compare-identities-and-apply-merge-or-alias-from-a-card completed integration verify. - PR: https://git.groupthink.asia/dev/people-mind-mcp/pulls/134 - Branch: feat/svd-dev-people-mind-mcp-107-compare-identities-and-apply-22b1e722 - Commit: 3cf252fae5b3169aae7f84d39b3ae1e3eb8df53c - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/73/pipeline/88/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - CI wait: ci/woodpecker/pr/validation -> pass - Rework: 1 round(s), outcome converged - Decision: review the PR and merge? (`codex-svd ship --run-id 20261105T231425Z-22b1e722 --confirm-merge`)
svc-svd-writer 2026-11-05 23:36:42 +00:00
  • closed this issue
  • removed the
    svd:go
    label
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
dev/people-mind-mcp#107
No description provided.