Remove selected local data with an explicit scope #113

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

Parent

#96

What to build

Remove a selected local fact, manual event or eligible local-only Person with an exact impact preview.

Acceptance criteria

  • Name the target and effects; enforce the decided Source/dependency rules and refuse unsafe whole-Person removal.
  • Explain potential re-import; do not create suppression Tombstones or delete provider contacts.
  • Preserve unrelated assertions, relationships and imported activity; apply the decided undo contract.
  • Text/card acceptance distinguishes scoped removal from archive and confirmed irreversible Forget.
  • 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 Remove a selected local fact, manual event or eligible local-only Person with an exact impact preview. ## Acceptance criteria - [ ] Name the target and effects; enforce the decided Source/dependency rules and refuse unsafe whole-Person removal. - [ ] Explain potential re-import; do not create suppression Tombstones or delete provider contacts. - [ ] Preserve unrelated assertions, relationships and imported activity; apply the decided undo contract. - [ ] Text/card acceptance distinguishes scoped removal from archive and confirmed irreversible Forget. - [ ] 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/101 - https://git.groupthink.asia/dev/people-mind-mcp/issues/103 - https://git.groupthink.asia/dev/people-mind-mcp/issues/105 - https://git.groupthink.asia/dev/people-mind-mcp/issues/111 Filed under: operator word "ok" sha256:2689367b205c
Collaborator

⏸ SVD architect gate: dev/people-mind-mcp#113 remove-selected-local-data-with-an-explicit-scope

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: 20261108T054708Z-a82d5f06

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

Open risks:

  1. D1: Should graph.forget gain the removed-id branch in this slice, or wait for #114? The branch erases the live local.remove undo record, writes the Handle Tombstones the record holds using today's Decision-8 keying, and purges mail state. The lean is to include it: criterion 7 requires the new undo record to join the erasure path, and ADR 0005 Am.3 r7 binds forget.person to accept a removed id. #114 later re-keys all of forget. [decision]
  2. D2: ADR 0003 Am.2 r10 says removal takes 'its manual Interactions'. Does that mean only P's own links on manual events, with an event (and its notes) deleted only when no interaction row of any kind remains, as Forget does at graph.py:1205? The alternative is to retract every event P attended, which also deletes it for co-participants and conflicts with criterion 3 ('preserve unrelated'). The lean is links only. [decision]
  3. D3: A local-only Person can hold a shared-Endpoint Handle row (shared=1). The lean removes that holder row, keeps every unattributed endpoint Interaction (person_id IS NULL) as imported activity, and restores the holder row on undo. Should removal instead refuse with a new reason when P is the last holder of an Endpoint that has unattributed activity? [decision]
  4. D4: Two slice-level choices under ADR 0005 Am.1 r1 ('Tool names stay a decision for each slice'). (1) Names: people_remove, people_card_remove, people_remove_preview and people_card_remove_preview, with refusal detail 'reason=source-known next=forget'. (2) UX: the App's existing Retract buttons for facts, events, notes and relations open the preview before confirming, which adds one click. Are both acceptable, or should item Retract stay one click with a separate 'Remove…' preview entry? [decision]
  5. V1: The sandbox cannot read forge state. Before dispatch, confirm on git.groupthink.asia that blockers #101, #103, #105 and #111 are closed. Tree evidence at 94ee50f: c1a5db5 (#146), 2ba707e (#135), b6648e6 (#149), 64df4fe (#126). [verification]
  6. V2: No test baseline was measured, because Half A is read-only and pytest writes caches. On the pristine base 94ee50f, before the first edit, run uv run python3 -m pytest tests/test_actions.py tests/test_card_app.py tests/test_server.py tests/test_archive.py tests/test_interactions.py tests/test_facts.py tests/test_relations.py tests/test_notes.py tests/test_create.py -q and make check. Record the failure set, then assert after the change that it is unchanged apart from the new tests/test_remove.py passes. [verification]

Change: Add one shared read-only planner, graph.removal_plan(conn, pid), in the shape of graph.split_plan (graph.py:517). views.remove_preview and the worker both use it, so the preview is exact by construction.

  • actions.py: add REMOVE_KIND = 'local.remove' to KIND_BUCKET (lifecycle) and UNDOABLE, but not to LIFECYCLE_KINDS. graph.py:2767 sends LIFECYCLE_KINDS to _apply_lifecycle.
  • graph.py forward path (_apply_local_remove): mirror _apply_lifecycle (graph.py:1943-1971): not-found, redirected conflict, owner, then the Person revision. A blocked plan fails with source-known next=forget, where source-known means any source_link, live or retired, or any interaction with event_id NULL. Snapshot every person-keyed row in the undo record, including inbound Relations and P's links on manual events. An event goes only when no interaction row remains on it. Then DELETE_PERSON, emit _change 'del', and emit _endpoint_updates for participants. Store other Person ids under '$.participants' so Forget's existing sweep (graph.py:1175) erases the record.
  • graph.py undo (_undo_local_remove): sits beside the person.create branch (graph.py:3023). Run every check first: P absent, handle-owned, participants canonical, kept events present, org targets present. Then re-insert rows under their ids with revision+1 (restore_note at graph.py:2323; the _undo_fact row re-insert at graph.py:1606-1613). Emit 'add' plus 'update'.
  • graph.forget: gains a removed-id branch. It reads the live local.remove undo record, writes Handle Tombstones, purges mail state, and erases undo records and separations.
  • Read tools: people_remove_preview (text, with resource_uri CARD_URI) and people_card_remove_preview (app-only JSON), mirroring server.py:386-431. Items fact, event, note and relation mirror their *.retract rules, including the correction pair's 'restores' list.
  • Write tools: people_remove and app-only people_card_remove, mirroring _archive (server.py:652-676).
  • card.html: add loadRemove in the shape of loadSplit (card.html:690-737). Copy contrasts Remove, Archive and Forget. The existing item Retract buttons route through the preview first.
  • README: document the new tools and the preview.
  • No schema change.

Files: src/people_mind_mcp/actions.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 · README.md · tests/test_remove.py · tests/test_actions.py · tests/test_card_app.py · tests/test_server.py

Decision: accept the 6 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-08-remove-selected-local-data-with-an-explicit-scope.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-08-remove-selected-local-data-with-an-explicit-scope.md

### ⏸ SVD architect gate: dev/people-mind-mcp#113 remove-selected-local-data-with-an-explicit-scope **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:** `20261108T054708Z-a82d5f06` **Held because:** CLEAN but 6 open risk(s) (2 verification · 4 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. D1: Should graph.forget gain the removed-id branch in this slice, or wait for #114? The branch erases the live local.remove undo record, writes the Handle Tombstones the record holds using today's Decision-8 keying, and purges mail state. The lean is to include it: criterion 7 requires the new undo record to join the erasure path, and ADR 0005 Am.3 r7 binds forget.person to accept a removed id. #114 later re-keys all of forget. [decision] 2. D2: ADR 0003 Am.2 r10 says removal takes 'its manual Interactions'. Does that mean only P's own links on manual events, with an event (and its notes) deleted only when no interaction row of any kind remains, as Forget does at graph.py:1205? The alternative is to retract every event P attended, which also deletes it for co-participants and conflicts with criterion 3 ('preserve unrelated'). The lean is links only. [decision] 3. D3: A local-only Person can hold a shared-Endpoint Handle row (shared=1). The lean removes that holder row, keeps every unattributed endpoint Interaction (person_id IS NULL) as imported activity, and restores the holder row on undo. Should removal instead refuse with a new reason when P is the last holder of an Endpoint that has unattributed activity? [decision] 4. D4: Two slice-level choices under ADR 0005 Am.1 r1 ('Tool names stay a decision for each slice'). (1) Names: people_remove, people_card_remove, people_remove_preview and people_card_remove_preview, with refusal detail 'reason=source-known next=forget'. (2) UX: the App's existing Retract buttons for facts, events, notes and relations open the preview before confirming, which adds one click. Are both acceptable, or should item Retract stay one click with a separate 'Remove…' preview entry? [decision] 5. V1: The sandbox cannot read forge state. Before dispatch, confirm on git.groupthink.asia that blockers #101, #103, #105 and #111 are closed. Tree evidence at 94ee50f: c1a5db5 (#146), 2ba707e (#135), b6648e6 (#149), 64df4fe (#126). [verification] 6. V2: No test baseline was measured, because Half A is read-only and pytest writes caches. On the pristine base 94ee50f, before the first edit, run `uv run python3 -m pytest tests/test_actions.py tests/test_card_app.py tests/test_server.py tests/test_archive.py tests/test_interactions.py tests/test_facts.py tests/test_relations.py tests/test_notes.py tests/test_create.py -q` and `make check`. Record the failure set, then assert after the change that it is unchanged apart from the new tests/test_remove.py passes. [verification] **Change:** Add one shared read-only planner, graph.removal_plan(conn, pid), in the shape of graph.split_plan (graph.py:517). views.remove_preview and the worker both use it, so the preview is exact by construction. - actions.py: add REMOVE_KIND = 'local.remove' to KIND_BUCKET (lifecycle) and UNDOABLE, but not to LIFECYCLE_KINDS. graph.py:2767 sends LIFECYCLE_KINDS to _apply_lifecycle. - graph.py forward path (_apply_local_remove): mirror _apply_lifecycle (graph.py:1943-1971): not-found, redirected conflict, owner, then the Person revision. A blocked plan fails with source-known next=forget, where source-known means any source_link, live or retired, or any interaction with event_id NULL. Snapshot every person-keyed row in the undo record, including inbound Relations and P's links on manual events. An event goes only when no interaction row remains on it. Then DELETE_PERSON, emit _change 'del', and emit _endpoint_updates for participants. Store other Person ids under '$.participants' so Forget's existing sweep (graph.py:1175) erases the record. - graph.py undo (_undo_local_remove): sits beside the person.create branch (graph.py:3023). Run every check first: P absent, handle-owned, participants canonical, kept events present, org targets present. Then re-insert rows under their ids with revision+1 (restore_note at graph.py:2323; the _undo_fact row re-insert at graph.py:1606-1613). Emit 'add' plus 'update'. - graph.forget: gains a removed-id branch. It reads the live local.remove undo record, writes Handle Tombstones, purges mail state, and erases undo records and separations. - Read tools: people_remove_preview (text, with resource_uri CARD_URI) and people_card_remove_preview (app-only JSON), mirroring server.py:386-431. Items fact, event, note and relation mirror their *.retract rules, including the correction pair's 'restores' list. - Write tools: people_remove and app-only people_card_remove, mirroring _archive (server.py:652-676). - card.html: add loadRemove in the shape of loadSplit (card.html:690-737). Copy contrasts Remove, Archive and Forget. The existing item Retract buttons route through the preview first. - README: document the new tools and the preview. - No schema change. **Files:** `src/people_mind_mcp/actions.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` · `README.md` · `tests/test_remove.py` · `tests/test_actions.py` · `tests/test_card_app.py` · `tests/test_server.py` **Decision:** accept the 6 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-08-remove-selected-local-data-with-an-explicit-scope.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-08-remove-selected-local-data-with-an-explicit-scope.md`</sub>
Collaborator

spec-verify-dispatch Half B for dev/people-mind-mcp#113 remove-selected-local-data-with-an-explicit-scope completed integration verify.

  • PR: #165
  • Branch: feat/svd-dev-people-mind-mcp-113-remove-selected-local-data-w-4141fb37
  • Commit: 7b9fccbacf
  • 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/149/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261108T070304Z-4141fb37 --confirm-merge)
spec-verify-dispatch Half B for dev/people-mind-mcp#113 remove-selected-local-data-with-an-explicit-scope completed integration verify. - PR: https://git.groupthink.asia/dev/people-mind-mcp/pulls/165 - Branch: feat/svd-dev-people-mind-mcp-113-remove-selected-local-data-w-4141fb37 - Commit: 7b9fccbacf707611939b5fa22571982e5e13945c - 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/149/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - CI wait: ci/woodpecker/pr/validation -> pass - Decision: review the PR and merge? (`codex-svd ship --run-id 20261108T070304Z-4141fb37 --confirm-merge`)
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#113
No description provided.