Edit typed relationships from a Person Card #102

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

Parent

#96

What to build

Add or retract family, partner, colleague, provider and Organisation relationships through the existing Relation vocabulary.

Acceptance criteria

  • Use closed Relation types and optional labels, including contractor labels and supported effective dates; do not turn Tags into Relations.
  • Relations carry author/action provenance, survive sync, and appear consistently on related-person and card reads.
  • Retries do not duplicate edges and undo affects only the selected change.
  • Exercise Person-to-Person and Person-to-Organisation editing through MCP and the card bridge.
  • 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 Add or retract family, partner, colleague, provider and Organisation relationships through the existing Relation vocabulary. ## Acceptance criteria - [ ] Use closed Relation types and optional labels, including contractor labels and supported effective dates; do not turn Tags into Relations. - [ ] Relations carry author/action provenance, survive sync, and appear consistently on related-person and card reads. - [ ] Retries do not duplicate edges and undo affects only the selected change. - [ ] Exercise Person-to-Person and Person-to-Organisation editing through MCP and the card bridge. - [ ] 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#102 edit-typed-relationships-from-a-person-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: 20261106T222957Z-65aeecbc

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

Open risks:

  1. D1: the 'partner' and 'contractor' mapping. The lean is that the server encodes no mapping: the caller picks the closed type and types a free label. Tests use family/'partner', works_at/'contractor' (Person→Organisation) and provider/'contractor' (Person→Person). Question: is that the intended reading, should 'partner' sit on household, or should the App offer fixed label presets per type? [decision]
  2. D2: duplicate-edge identity. The lean treats an edge as present (relation-present) when type, label and both effective dates match, in either direction, because the related and Card projections are undirected. Different dates are allowed. Question: should direction count for asymmetric types (provider, client), or should dates be left out of identity? [decision]
  3. D3: the lean shows relation rows on the default text Card, not behind a flag. ADR 0003 d3 puts relation on the default row, and no ruling hides Relations the way Am5 r6 hides Notes. Question: should Card relation rows instead sit behind a request flag to keep the default Card budget fixed? [decision]
  4. D4: the lean allows the Owner as a Relation holder or target, because the default row's relation column is read only from Owner edges (views.py:46-50). The links Owner refusal (ADR 0005 Am2 r5) concerns identity merges. Question: confirm that relation.add must not answer reason=owner. [decision]
  5. V1: blocker #98's code is on main (squash 726d113 is an ancestor of HEAD; its feature branch carries 'Closes #98' commits d703167 and 03dd0df), but this sandbox cannot read the forge issue state. Check: gh issue view 98 -R dev/people-mind-mcp --json state -q .state returns CLOSED. [verification]
  6. V2: no numeric baseline was measured, because Half A is read-only. Check: on the dispatch worktree, record make check on pristine b6648e6 before the first edit. After the change, the focused pytest command and make check pass, and the failure set is unchanged except for the new passing tests. [verification]

Change: Mirror the #105 manual-Interaction slice (b6648e6) across the same file set.

  • store.py: bump to schema 18 with one additive UPGRADES entry, ("relations","revision"), which adds revision, action_id, effective_from and effective_until, plus non-unique indexes on person_id and target_person_id. SCHEMA_17 becomes SCHEMA_18.
  • actions.py: add RELATION_TYPES (ADR 0002 d8) and RELATION_KINDS. Both kinds charge the links bucket and are undoable.
  • server.py: add a people_relation / app-only people_card_relation tool pair on the shape of people_interaction/interaction (server.py:629-729). Validate type, target id (p or o_), label with _note_text(200), and dates with a helper factored out of _fact (:933-938). Register both in build_app.
  • graph.py: add _apply_relation and _undo_relation, routed beside INTERACTION_KINDS in _apply_action and the undo dispatch.
    • relation.add is a pure addition. It follows redirects, refuses same-person and not-found, and refuses invalid-type. A matching edge in either direction answers relation-present. The Owner is allowed at either end.
    • relation.retract checks the revision and conflicts on a redirect.
    • Undo checks content (a digest plus the author) and ignores merge revision bumps (ADR 0005 Am6 r5). Undo of a retract restores the row under its original id at revision+1, like restore_note.
    • Undo records are keyed person_id=holder and other_id=target, so Forget's existing undo_records deletes reach them.
    • The MOVE_RELATIONS / MOVE_RELATION_TARGETS / unmerge / _move_allocation relation moves bump revision.
  • views.py: card_suggestions gains relations (with an outbound flag) and organisations. The text card gains relation | other | name | type | label | author rows with inbound, from= and until= cells, and relation= and revision= only when revisions are requested.
  • card.html: add relationItem, showRelation and submitRelation, mirroring factItem/showFact/submitFact.
  • README: add the tool and schema paragraphs.

Files: src/people_mind_mcp/store.py · src/people_mind_mcp/actions.py · src/people_mind_mcp/graph.py · src/people_mind_mcp/server.py · src/people_mind_mcp/views.py · src/people_mind_mcp/card.html · README.md · tests/test_relations.py · tests/test_actions.py · tests/test_card_app.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-06-edit-typed-relationships-from-a-person-card.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-06-edit-typed-relationships-from-a-person-card.md

### ⏸ SVD architect gate: dev/people-mind-mcp#102 edit-typed-relationships-from-a-person-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:** `20261106T222957Z-65aeecbc` **Held because:** CLEAN but 6 open risk(s) (2 verification · 4 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. D1: the 'partner' and 'contractor' mapping. The lean is that the server encodes no mapping: the caller picks the closed type and types a free label. Tests use family/'partner', works_at/'contractor' (Person→Organisation) and provider/'contractor' (Person→Person). Question: is that the intended reading, should 'partner' sit on household, or should the App offer fixed label presets per type? [decision] 2. D2: duplicate-edge identity. The lean treats an edge as present (relation-present) when type, label and both effective dates match, in either direction, because the related and Card projections are undirected. Different dates are allowed. Question: should direction count for asymmetric types (provider, client), or should dates be left out of identity? [decision] 3. D3: the lean shows relation rows on the default text Card, not behind a flag. ADR 0003 d3 puts relation on the default row, and no ruling hides Relations the way Am5 r6 hides Notes. Question: should Card relation rows instead sit behind a request flag to keep the default Card budget fixed? [decision] 4. D4: the lean allows the Owner as a Relation holder or target, because the default row's relation column is read only from Owner edges (views.py:46-50). The links Owner refusal (ADR 0005 Am2 r5) concerns identity merges. Question: confirm that relation.add must not answer reason=owner. [decision] 5. V1: blocker #98's code is on main (squash 726d113 is an ancestor of HEAD; its feature branch carries 'Closes #98' commits d703167 and 03dd0df), but this sandbox cannot read the forge issue state. Check: `gh issue view 98 -R dev/people-mind-mcp --json state -q .state` returns CLOSED. [verification] 6. V2: no numeric baseline was measured, because Half A is read-only. Check: on the dispatch worktree, record `make check` on pristine b6648e6 before the first edit. After the change, the focused pytest command and `make check` pass, and the failure set is unchanged except for the new passing tests. [verification] **Change:** Mirror the #105 manual-Interaction slice (b6648e6) across the same file set. - store.py: bump to schema 18 with one additive UPGRADES entry, ("relations","revision"), which adds revision, action_id, effective_from and effective_until, plus non-unique indexes on person_id and target_person_id. SCHEMA_17 becomes SCHEMA_18. - actions.py: add RELATION_TYPES (ADR 0002 d8) and RELATION_KINDS. Both kinds charge the links bucket and are undoable. - server.py: add a people_relation / app-only people_card_relation tool pair on the shape of people_interaction/_interaction (server.py:629-729). Validate type, target id (p_ or o_), label with _note_text(200), and dates with a helper factored out of _fact (:933-938). Register both in build_app. - graph.py: add _apply_relation and _undo_relation, routed beside INTERACTION_KINDS in _apply_action and the undo dispatch. - relation.add is a pure addition. It follows redirects, refuses same-person and not-found, and refuses invalid-type. A matching edge in either direction answers relation-present. The Owner is allowed at either end. - relation.retract checks the revision and conflicts on a redirect. - Undo checks content (a digest plus the author) and ignores merge revision bumps (ADR 0005 Am6 r5). Undo of a retract restores the row under its original id at revision+1, like restore_note. - Undo records are keyed person_id=holder and other_id=target, so Forget's existing undo_records deletes reach them. - The MOVE_RELATIONS / MOVE_RELATION_TARGETS / unmerge / _move_allocation relation moves bump revision. - views.py: card_suggestions gains relations (with an outbound flag) and organisations. The text card gains `relation | other | name | type | label | author` rows with inbound, from= and until= cells, and relation= and revision= only when revisions are requested. - card.html: add relationItem, showRelation and submitRelation, mirroring factItem/showFact/submitFact. - README: add the tool and schema paragraphs. **Files:** `src/people_mind_mcp/store.py` · `src/people_mind_mcp/actions.py` · `src/people_mind_mcp/graph.py` · `src/people_mind_mcp/server.py` · `src/people_mind_mcp/views.py` · `src/people_mind_mcp/card.html` · `README.md` · `tests/test_relations.py` · `tests/test_actions.py` · `tests/test_card_app.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-06-edit-typed-relationships-from-a-person-card.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-06-edit-typed-relationships-from-a-person-card.md`</sub>
Collaborator

spec-verify-dispatch Half B for dev/people-mind-mcp#102 edit-typed-relationships-from-a-person-card completed integration verify.

  • PR: #150
  • Branch: feat/svd-dev-people-mind-mcp-102-edit-typed-relationships-fro-35a4ca6f
  • Commit: 2a5e9c61d3
  • 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/118/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • Warning: Remote check ci/woodpecker/pr/validation is still running; the runner should re-poll it.
  • Warning: The post-merge physical-erasure check and the MCP Apps host check remain operator checks, as the subagent reported.
  • Warning: Bare python3 -m pytest failed in this checkout (No module named 'phonenumbers'), so collection and tests ran through uv run.
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261107T011004Z-35a4ca6f --confirm-merge)
spec-verify-dispatch Half B for dev/people-mind-mcp#102 edit-typed-relationships-from-a-person-card completed integration verify. - PR: https://git.groupthink.asia/dev/people-mind-mcp/pulls/150 - Branch: feat/svd-dev-people-mind-mcp-102-edit-typed-relationships-fro-35a4ca6f - Commit: 2a5e9c61d307f2ea5bfafcb19a8da0ff24fc1edd - 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/118/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - Warning: Remote check ci/woodpecker/pr/validation is still running; the runner should re-poll it. - Warning: The post-merge physical-erasure check and the MCP Apps host check remain operator checks, as the subagent reported. - Warning: Bare `python3 -m pytest` failed in this checkout (`No module named 'phonenumbers'`), so collection and tests ran through `uv run`. - CI wait: ci/woodpecker/pr/validation -> pass - Decision: review the PR and merge? (`codex-svd ship --run-id 20261107T011004Z-35a4ca6f --confirm-merge`)
svc-svd-writer 2026-11-07 01:30:48 +00:00
  • closed this issue
  • removed the
    svd:go
    label
Author
Member

This was generated by AI during triage.

SVD gate and ship record: #102 (einfari gate 2026-11-07, merge 12:31 AEDT)

Measured facts

  • Half-A 20261106T222957Z-65aeecbc: CLEAN, 0 blocking defects, class substrate, 10 Primary Files, base b6648e6, 26 source hashes. Schema 18 is additive: relations gains revision, action_id and effective dates.
  • The spec left four decisions open (D1 to D4). The operator accepted every lean.
  • Dispatch 20261107T011004Z-35a4ca6f on codex/gpt-6.1-sol committed 2a5e9c6 and opened PR #150.
  • Integrate: readyForMerge true, verified head equal to the dispatch commit, 0 rework rounds, CI ci/woodpecker/pr/validation success.
  • Own execution at 2a5e9c6: make check gave 769 passed, 5 skipped, 0 failed. The base gave 754 passed. The Python 3.12 import of people_mind_mcp.cli and people_mind_mcp.server succeeds. test_card_without_evidence_under_600_tokens passes.
  • The 10 changed files are the Primary Files exactly. All 14 spec-named tests are present. Exactly four sites write UPDATE relations, as §E names. No nested .git or pytest cache. card.html adds no innerHTML, no http(s):// and no eval(.
  • A gate probe at 2a5e9c6 added two labelled Relations, retracted one, merged the target and forgot the holder. After a TRUNCATE checkpoint the label bytes were absent from the store files, no relations row remained, and the undo records for those Actions were gone.
  • Merged as f616f5a.

Buckets

  • Already decided:
    • ADR 0002 decision 8 (the closed Relation types).
    • ADR 0003 decisions 3 and 7, and Amendment 2 rule 10.
    • ADR 0005 Amendment 1: the inventory rows and rulings 8 to 15.
    • Amendment 5 ruling 15.
    • Amendment 6 rulings 5 and 6.
  • Decided at this gate (operator "Proceed"):
    • D1: no server mapping for "partner" or "contractor". The caller picks a closed type and types a free label.
    • D2: an edge is present when type, label and both dates match, in either direction.
    • D3: relation rows show on the default text Card.
    • D4: the Owner may be either end of a Relation.
  • V1 closed at the gate: #98 is closed on the forge.
  • Verification (post-merge operator checks):
    • The Card App relation flow in an MCP Apps host: add, retract, then stale-view.

Ruling

  • Migration: test_schema_18_migrates_on_writer_open sets a legacy row at user_version=17. It asserts that the reader refuses, the writer upgrades, the row id and revision 1 survive, foreign_key_check is clean and a second open changes nothing.
  • GO, then merge.

Drafted line

codex-svd ship --run-id 20261107T011004Z-35a4ca6f --confirm-merge (run, exit 0).

Delegation

"this session is an einfari. you merge through 19:00", extended by "Extend grant through 14:00aedt" (gate, svd:go and merge). "Proceed" (D1 to D4). Standing pick "2 plus 3 / Throughput is more important than cost" (sol on substrate dispatch).

Spec: 2026-11-06-edit-typed-relationships-from-a-person-card.md, Agent Adjustments. Ledger: 2026-W45-arch.

> *This was generated by AI during triage.* **SVD gate and ship record: #102** (einfari gate 2026-11-07, merge 12:31 AEDT) **Measured facts** - Half-A `20261106T222957Z-65aeecbc`: CLEAN, 0 blocking defects, class `substrate`, 10 Primary Files, base `b6648e6`, 26 source hashes. Schema 18 is additive: `relations` gains `revision`, `action_id` and effective dates. - The spec left four decisions open (D1 to D4). The operator accepted every lean. - Dispatch `20261107T011004Z-35a4ca6f` on `codex/gpt-6.1-sol` committed `2a5e9c6` and opened PR #150. - Integrate: `readyForMerge` true, verified head equal to the dispatch commit, 0 rework rounds, CI `ci/woodpecker/pr/validation` success. - Own execution at `2a5e9c6`: `make check` gave 769 passed, 5 skipped, 0 failed. The base gave 754 passed. The Python 3.12 import of `people_mind_mcp.cli` and `people_mind_mcp.server` succeeds. `test_card_without_evidence_under_600_tokens` passes. - The 10 changed files are the Primary Files exactly. All 14 spec-named tests are present. Exactly four sites write `UPDATE relations`, as §E names. No nested `.git` or pytest cache. `card.html` adds no `innerHTML`, no `http(s)://` and no `eval(`. - A gate probe at `2a5e9c6` added two labelled Relations, retracted one, merged the target and forgot the holder. After a TRUNCATE checkpoint the label bytes were absent from the store files, no `relations` row remained, and the undo records for those Actions were gone. - Merged as `f616f5a`. **Buckets** - Already decided: - ADR 0002 decision 8 (the closed Relation types). - ADR 0003 decisions 3 and 7, and Amendment 2 rule 10. - ADR 0005 Amendment 1: the inventory rows and rulings 8 to 15. - Amendment 5 ruling 15. - Amendment 6 rulings 5 and 6. - Decided at this gate (operator "Proceed"): - D1: no server mapping for "partner" or "contractor". The caller picks a closed type and types a free label. - D2: an edge is present when type, label and both dates match, in either direction. - D3: `relation` rows show on the default text Card. - D4: the Owner may be either end of a Relation. - V1 closed at the gate: #98 is closed on the forge. - Verification (post-merge operator checks): - The Card App relation flow in an MCP Apps host: add, retract, then stale-view. **Ruling** - Migration: `test_schema_18_migrates_on_writer_open` sets a legacy row at `user_version=17`. It asserts that the reader refuses, the writer upgrades, the row id and revision 1 survive, `foreign_key_check` is clean and a second open changes nothing. - GO, then merge. **Drafted line** `codex-svd ship --run-id 20261107T011004Z-35a4ca6f --confirm-merge` (run, exit 0). **Delegation** "this session is an einfari. you merge through 19:00", extended by "Extend grant through 14:00aedt" (gate, `svd:go` and merge). "Proceed" (D1 to D4). Standing pick "2 plus 3 / Throughput is more important than cost" (sol on substrate dispatch). Spec: `2026-11-06-edit-typed-relationships-from-a-person-card.md`, Agent Adjustments. 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#102
No description provided.