Archive and restore Persons without losing history #112

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

Parent

#96

What to build

Hide an old contact from everyday discovery and suggestions, then restore it from an explicit archived view.

Acceptance criteria

  • Apply the decided visibility contract to Cards, discovery, suggestions and feeds.
  • History remains available through explicit archived lookup; Source refresh cannot silently unarchive a Person.
  • Archive/restore is attributed, idempotent and revision checked; no upstream mutation or Forget suppression occurs.
  • Exercise text and card flows, concurrent saves, restore and sync persistence.
  • 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 Hide an old contact from everyday discovery and suggestions, then restore it from an explicit archived view. ## Acceptance criteria - [ ] Apply the decided visibility contract to Cards, discovery, suggestions and feeds. - [ ] History remains available through explicit archived lookup; Source refresh cannot silently unarchive a Person. - [ ] Archive/restore is attributed, idempotent and revision checked; no upstream mutation or Forget suppression occurs. - [ ] Exercise text and card flows, concurrent saves, restore and sync persistence. - [ ] 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 - 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#112 archive-and-restore-persons-without-losing-history

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: 20261107T022755Z-07524855

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

Open risks:

  1. D1: what an archive or restore undo checks. Lean: the lifecycle token (persons.lifecycle_action_id == target, plus the archive state the Action left), not the whole Person revision. Every sync touch bumps the Person revision through _change, and the other Person-wide undos (merge, split, create) already use targeted checks. Question: is ADR 0005 Amendment 1 ruling 14's 'item the original Action changed' the archive state rather than the Person revision? [decision]
  2. D2: merge undo after a later lifecycle change on the survivor. Lean: conflict reason=revision person=, because undo never overwrites later work (ruling 14). Question: should merge undo instead apply and keep the survivor's current state, restoring only the loser's recorded state? [decision]
  3. D3: the archive state of a Person carved out by link.split. Lean: the carved Person copies P's archive triple. Otherwise split undo, which merges through _merge_ranked, would silently restore an archived P under the survivor-live rule. Question: confirm, or should a carved Person always start live? [decision]
  4. D4: handle-shaped Candidates under archived=exclude. Lean: rule 5 removes only name, organisation and semantic Candidates, so stripped-handle, shared-handle and url Candidates for an archived Person stay, marked archived. Question: should every Candidate except the exact exclusive Endpoint leave under exclude? [decision]
  5. D5: marker placement and explicit-id reads. Leans: (a) people_recent appends archived to each row; (b) links=retired is a cell on the Card person row, shown for any Person with at least one link and no live link; (c) people_review_queue with an explicit person_id still lists an archived Person's Suggestions; (d) people_related with an archived ref still answers. Question: confirm each of (a) to (d). [decision]
  6. V1: blockers #98 and #111 are closed on the forge. Their outputs are on main (4c4776d, 726d113, 64df4fe), but the sandbox cannot read issue state. Check: the git.groupthink.asia issue pages for dev/people-mind-mcp#98 and #111 both show state closed. [verification]
  7. V2: repository checks pass after the change. No numeric baseline was measured. Check: in the dispatch worktree, record make check on pristine 152e4a8 before the first edit; after the change, the focused command and make check pass and the failure set is unchanged except for the new passing tests. [verification]
  8. V3: the App archive flow in a real MCP Apps host, provable only post-merge. Check: with a write token, open a Card, click Archive and see archived, click Restore, then submit from a stale view and see 'stale-view: This person changed since the view loaded'. [verification]

Change: Mirror commit a4a6754 (#153) end to end.

  • Schema 20: one additive UPGRADES row on persons (archived_at, archived_by, lifecycle_action_id) in store.py:21-133. Rename SCHEMA_19 to SCHEMA_20 and set SCHEMA_VERSION = 20 (DD-271 migrate-on-open).
  • actions.py: add LIFECYCLE_KINDS ("person.archive", "person.restore") to the lifecycle bucket (cap 50 already exists) and to UNDOABLE.
  • graph.py forward: add _apply_lifecycle next to _apply_org. Checks run in order: canonical id, owner, Person revision, then already-archived / not-archived (mirroring identity.separate :2634-2651). It then sets the triple and calls _change(update), which bumps the revision and emits feed update. The undo record holds ids only.
  • graph.py undo: _undo_lifecycle checks the lifecycle_action_id token.
  • graph.py merges: _merge_ranked (:425-445) clears the survivor's archive state when the loser was live. link_merge records each side's triple under a new "archive" key; unmerge restores it and reads old records via .get (CONV-23 round-trip). Merge undo conflicts if the survivor's state changed after the merge.
  • graph.py elsewhere: carve copies P's state onto the carved Person. person.create undo counts a lifecycle change as a contribution. Forget is unchanged (DELETE_PERSON plus the undo-record purges).
  • views.py: find gains archived=exclude|include|only. Archived Persons are dropped from name, organisation and semantic Candidates; the exact Endpoint path always returns them; the row gets an "archived" marker cell. card, recent and card_suggestions show markers, and the Card adds links=retired. related and the unscoped review_queue filter archived Persons out. status is unchanged.
  • server.py: add the people_archive / people_card_archive pair mirroring _org (:635-688), registered in build_app, plus the people_find archived parameter and lifecycle_writable.
  • card.html: Archive and Restore buttons, with submitArchive mirroring submitOrg (:365-382).
  • README paragraph.

Files: src/people_mind_mcp/store.py · 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_archive.py · tests/test_actions.py · tests/test_card_app.py

Decision: accept the 8 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-07-archive-and-restore-persons-without-losing-history.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-07-archive-and-restore-persons-without-losing-history.md

### ⏸ SVD architect gate: dev/people-mind-mcp#112 archive-and-restore-persons-without-losing-history **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:** `20261107T022755Z-07524855` **Held because:** CLEAN but 8 open risk(s) (3 verification · 5 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. D1: what an archive or restore undo checks. Lean: the lifecycle token (persons.lifecycle_action_id == target, plus the archive state the Action left), not the whole Person revision. Every sync touch bumps the Person revision through _change, and the other Person-wide undos (merge, split, create) already use targeted checks. Question: is ADR 0005 Amendment 1 ruling 14's 'item the original Action changed' the archive state rather than the Person revision? [decision] 2. D2: merge undo after a later lifecycle change on the survivor. Lean: conflict reason=revision person=<survivor>, because undo never overwrites later work (ruling 14). Question: should merge undo instead apply and keep the survivor's current state, restoring only the loser's recorded state? [decision] 3. D3: the archive state of a Person carved out by link.split. Lean: the carved Person copies P's archive triple. Otherwise split undo, which merges through _merge_ranked, would silently restore an archived P under the survivor-live rule. Question: confirm, or should a carved Person always start live? [decision] 4. D4: handle-shaped Candidates under archived=exclude. Lean: rule 5 removes only name, organisation and semantic Candidates, so stripped-handle, shared-handle and url Candidates for an archived Person stay, marked archived. Question: should every Candidate except the exact exclusive Endpoint leave under exclude? [decision] 5. D5: marker placement and explicit-id reads. Leans: (a) people_recent appends archived to each row; (b) links=retired is a cell on the Card person row, shown for any Person with at least one link and no live link; (c) people_review_queue with an explicit person_id still lists an archived Person's Suggestions; (d) people_related with an archived ref still answers. Question: confirm each of (a) to (d). [decision] 6. V1: blockers #98 and #111 are closed on the forge. Their outputs are on main (4c4776d, 726d113, 64df4fe), but the sandbox cannot read issue state. Check: the git.groupthink.asia issue pages for dev/people-mind-mcp#98 and #111 both show state closed. [verification] 7. V2: repository checks pass after the change. No numeric baseline was measured. Check: in the dispatch worktree, record make check on pristine 152e4a8 before the first edit; after the change, the focused command and make check pass and the failure set is unchanged except for the new passing tests. [verification] 8. V3: the App archive flow in a real MCP Apps host, provable only post-merge. Check: with a write token, open a Card, click Archive and see archived, click Restore, then submit from a stale view and see 'stale-view: This person changed since the view loaded'. [verification] **Change:** Mirror commit a4a6754 (#153) end to end. - Schema 20: one additive UPGRADES row on persons (archived_at, archived_by, lifecycle_action_id) in store.py:21-133. Rename SCHEMA_19 to SCHEMA_20 and set SCHEMA_VERSION = 20 (DD-271 migrate-on-open). - actions.py: add LIFECYCLE_KINDS ("person.archive", "person.restore") to the lifecycle bucket (cap 50 already exists) and to UNDOABLE. - graph.py forward: add _apply_lifecycle next to _apply_org. Checks run in order: canonical id, owner, Person revision, then already-archived / not-archived (mirroring identity.separate :2634-2651). It then sets the triple and calls _change(update), which bumps the revision and emits feed update. The undo record holds ids only. - graph.py undo: _undo_lifecycle checks the lifecycle_action_id token. - graph.py merges: _merge_ranked (:425-445) clears the survivor's archive state when the loser was live. link_merge records each side's triple under a new "archive" key; unmerge restores it and reads old records via .get (CONV-23 round-trip). Merge undo conflicts if the survivor's state changed after the merge. - graph.py elsewhere: carve copies P's state onto the carved Person. person.create undo counts a lifecycle change as a contribution. Forget is unchanged (DELETE_PERSON plus the undo-record purges). - views.py: find gains archived=exclude|include|only. Archived Persons are dropped from name, organisation and semantic Candidates; the exact Endpoint path always returns them; the row gets an "archived" marker cell. card, recent and card_suggestions show markers, and the Card adds links=retired. related and the unscoped review_queue filter archived Persons out. status is unchanged. - server.py: add the people_archive / people_card_archive pair mirroring _org (:635-688), registered in build_app, plus the people_find archived parameter and lifecycle_writable. - card.html: Archive and Restore buttons, with submitArchive mirroring submitOrg (:365-382). - README paragraph. **Files:** `src/people_mind_mcp/store.py` · `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_archive.py` · `tests/test_actions.py` · `tests/test_card_app.py` **Decision:** accept the 8 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-07-archive-and-restore-persons-without-losing-history.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-07-archive-and-restore-persons-without-losing-history.md`</sub>
Collaborator

spec-verify-dispatch Half B for dev/people-mind-mcp#112 archive-and-restore-persons-without-losing-history completed integration verify.

  • PR: #156
  • Branch: feat/svd-dev-people-mind-mcp-112-archive-and-restore-persons-e3a30dd2
  • Commit: 4f89abaa19
  • 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/130/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • Warning: V3 remains a post-merge operator check in a real MCP Apps host.
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261107T024930Z-e3a30dd2 --confirm-merge)
spec-verify-dispatch Half B for dev/people-mind-mcp#112 archive-and-restore-persons-without-losing-history completed integration verify. - PR: https://git.groupthink.asia/dev/people-mind-mcp/pulls/156 - Branch: feat/svd-dev-people-mind-mcp-112-archive-and-restore-persons-e3a30dd2 - Commit: 4f89abaa196a09b4ddb41e6d78d3116a86777811 - 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/130/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - Warning: V3 remains a post-merge operator check in a real MCP Apps host. - CI wait: ci/woodpecker/pr/validation -> pass - Decision: review the PR and merge? (`codex-svd ship --run-id 20261107T024930Z-e3a30dd2 --confirm-merge`)
svc-svd-writer 2026-11-07 03:07:24 +00:00
  • closed this issue
  • removed the
    svd:go
    label
Author
Member

This was generated by AI during triage.

SVD gate and ship record: #112 (einfari gate 2026-11-07, merge 14:06 AEDT)

Measured facts

  • Half-A 20261107T022755Z-07524855: CLEAN, 0 blocking defects, class substrate, 10 Primary Files, base 152e4a8, 28 source hashes. Schema 20 is additive: persons gains archived_at, archived_by and lifecycle_action_id.
  • The spec left five decisions open (D1 to D5). The operator accepted every lean.
  • Dispatch 20261107T024930Z-e3a30dd2 on codex/gpt-6.1-sol committed 4f89aba and opened PR #156. The dispatch baseline at 152e4a8 was make check 783 passed. The agent reported no failing test.
  • Integrate: readyForMerge true, verified head equal to the dispatch commit, 0 rework rounds, CI ci/woodpecker/pr/validation success.
  • Own execution at 4f89aba: make check gave 798 passed, 5 skipped, 0 failed. The Python 3.12 import of people_mind_mcp.cli and people_mind_mcp.server succeeds. SCHEMA_VERSION = 20.
  • The 10 changed files are the Primary Files exactly. All spec-named tests are present. No nested .git. card.html adds no innerHTML, no http(s):// and no eval(. Before the gate, every INSERT INTO persons in src and tests already named its columns, so schema 20 broke no fixture.
  • Merged as 9964885.

Buckets

  • Already decided:
    • GLOSSARY Archive.
    • ADR 0003 Amendment 2 rules 5 to 8 and 12.
    • ADR 0001 Amendment 3 ruling 2.
    • ADR 0005 Amendment 1: the lifecycle inventory row, the cap of 50, and rulings 8 to 15 and 17.
    • ADR 0005 Amendment 3 rulings 3 and 5, and Amendment 5 ruling 15.
    • ADR 0003 Amendment 1 (Forget erasure).
  • Decided at this gate (operator "accept"):
    • D1: an archive or restore undo checks the lifecycle token and the archive state the Action left, not the whole Person revision.
    • D2: a merge undo after a later archive or restore of the survivor ends conflict.
    • D3: a Person carved out by link.split copies the archive state.
    • D4: stripped-handle, shared-handle and url Candidates stay under archived=exclude, marked archived.
    • D5: the people_recent marker, links=retired on the Card person row, and lookups by explicit id that still answer (people_review_queue, people_related).
  • V1 closed at the gate: #98 and #111 are closed on the forge.
  • Recorded as ADR text in PR #155 (ADR 0005 Amendment 7, ADR 0001 Amendment 4).
  • Verification (post-merge operator checks):
    • V3: the Card App archive flow in an MCP Apps host: archive, restore, then stale-view.

Ruling

  • Migration: test_schema_20_migrates_on_writer_open sets user_version=19 without the three columns. It asserts that the reader refuses and the writer upgrades to store.SCHEMA_VERSION.
  • GO, then merge.

Drafted line

codex-svd ship --run-id 20261107T024930Z-e3a30dd2 --confirm-merge (run, exit 0).

Delegation

"this session is an einfari. you merge through 19:00", extended by "extend grant through 19:00" (gate, svd:go and merge). "accept" (D1 to D5). Standing pick "Throughput is more important than cost" (sol on substrate dispatch).

Spec: 2026-11-07-archive-and-restore-persons-without-losing-history.md, Agent Adjustments, riders 1 to 6. Ledger: 2026-W45-arch.

> *This was generated by AI during triage.* **SVD gate and ship record: #112** (einfari gate 2026-11-07, merge 14:06 AEDT) **Measured facts** - Half-A `20261107T022755Z-07524855`: CLEAN, 0 blocking defects, class `substrate`, 10 Primary Files, base `152e4a8`, 28 source hashes. Schema 20 is additive: `persons` gains `archived_at`, `archived_by` and `lifecycle_action_id`. - The spec left five decisions open (D1 to D5). The operator accepted every lean. - Dispatch `20261107T024930Z-e3a30dd2` on `codex/gpt-6.1-sol` committed `4f89aba` and opened PR #156. The dispatch baseline at `152e4a8` was `make check` 783 passed. The agent reported no failing test. - Integrate: `readyForMerge` true, verified head equal to the dispatch commit, 0 rework rounds, CI `ci/woodpecker/pr/validation` success. - Own execution at `4f89aba`: `make check` gave 798 passed, 5 skipped, 0 failed. The Python 3.12 import of `people_mind_mcp.cli` and `people_mind_mcp.server` succeeds. `SCHEMA_VERSION = 20`. - The 10 changed files are the Primary Files exactly. All spec-named tests are present. No nested `.git`. `card.html` adds no `innerHTML`, no `http(s)://` and no `eval(`. Before the gate, every `INSERT INTO persons` in `src` and `tests` already named its columns, so schema 20 broke no fixture. - Merged as `9964885`. **Buckets** - Already decided: - GLOSSARY `Archive`. - ADR 0003 Amendment 2 rules 5 to 8 and 12. - ADR 0001 Amendment 3 ruling 2. - ADR 0005 Amendment 1: the lifecycle inventory row, the cap of 50, and rulings 8 to 15 and 17. - ADR 0005 Amendment 3 rulings 3 and 5, and Amendment 5 ruling 15. - ADR 0003 Amendment 1 (Forget erasure). - Decided at this gate (operator "accept"): - D1: an archive or restore undo checks the lifecycle token and the archive state the Action left, not the whole Person revision. - D2: a merge undo after a later archive or restore of the survivor ends `conflict`. - D3: a Person carved out by `link.split` copies the archive state. - D4: `stripped-handle`, `shared-handle` and `url` Candidates stay under `archived=exclude`, marked `archived`. - D5: the `people_recent` marker, `links=retired` on the Card person row, and lookups by explicit id that still answer (`people_review_queue`, `people_related`). - V1 closed at the gate: #98 and #111 are closed on the forge. - Recorded as ADR text in PR #155 (ADR 0005 Amendment 7, ADR 0001 Amendment 4). - Verification (post-merge operator checks): - V3: the Card App archive flow in an MCP Apps host: archive, restore, then stale-view. **Ruling** - Migration: `test_schema_20_migrates_on_writer_open` sets `user_version=19` without the three columns. It asserts that the reader refuses and the writer upgrades to `store.SCHEMA_VERSION`. - GO, then merge. **Drafted line** `codex-svd ship --run-id 20261107T024930Z-e3a30dd2 --confirm-merge` (run, exit 0). **Delegation** "this session is an einfari. you merge through 19:00", extended by "extend grant through 19:00" (gate, `svd:go` and merge). "accept" (D1 to D5). Standing pick "Throughput is more important than cost" (sol on substrate dispatch). Spec: `2026-11-07-archive-and-restore-persons-without-losing-history.md`, Agent Adjustments, riders 1 to 6. Ledger: `2026-W45-arch`.
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#112
No description provided.