Owner config: attach newly added owner addresses to the Owner Person #73

Closed
opened 2026-11-04 07:51:59 +00:00 by svc-svd-writer · 2 comments
Collaborator

Outcome

An address added to [owner] emails joins the Owner Person, and no other Person keeps a Handle or a Mail-sourced link for it.

Context

#69 (9f583ea) makes a change to [owner] emails rebuild the Mail peer projection. After that rebuild, a new owner address no longer produces support rows (_mail_allowed, sync.py). Two gaps stay:

  • graph.ensure_owner (graph.py:169-187) returns at once when an Owner Person exists. It never adds new config addresses as Handles of the Owner. Callers: cli.py:50 and sync.py:664.
  • A Person that Mail created earlier for that address keeps the Handle and its source_links row. After the rebuild retracts its interactions, it is an orphan.

Live case (starbase-syd, 2026-11-04): Mail Mind's Sent role holds about 25 owner From values, and the config lists 3. When the operator adds the missing addresses, about 22 of these orphans can appear.

Ruling (operator, 2026-11-04)

Merge the other Person into the Owner. ADR 0002 already decides this:

  • Rule 6 (docs/adr/0002-identity-and-merge.md:16): "The Owner's Handles come from the [owner] config block, never from a Source." So ensure_owner must add every config address to an existing Owner. The early return is a defect against rule 6.
  • Rule 2 (:12): a Handle belongs to exactly one Person. So the address cannot stay on the other Person.
  • Rule 3 (:13): an exact shared Handle merges silently. A config address is an exact Handle, so no people_link is needed.
  • Moving only the Handle is refused: it leaves a Person with no Handles.

merge_persons already keeps the Owner as the survivor (RANK_SURVIVORS orders by is_owner DESC, graph.py:119). Use it; do not write a second merge path.

Accepted trade-off: this merge is not a people_link action, so people_undo cannot reverse it. A wrong address in [owner] emails merges a real Person into the Owner silently. The repair is a manual people_link split.

Scope

  • ensure_owner: for an existing Owner, add each normalised config email and phone that the Owner lacks as a config/owner Handle, in the same way as the create path (_record_handles, _insert_handle).
  • When a config Handle belongs to another Person, call merge_persons with the Owner, and emit the merge change as usual.
  • After the merge, the Owner can hold the Mail Source's link for that address. The #69 rebuild excludes the address, so the drain retracts that link (retract_record: no support and no Evidence). Prove this with a test; change the drain only if the test fails.

Out of scope: removing Handles for addresses deleted from [owner] emails, and any change to name matching.

Acceptance criteria

  • A test adds an owner address to config. After the next writer start, the Owner Person holds it as a Handle.
  • A test with a Mail-created Person for that address shows it merged into the Owner: the Owner id survives and the old id redirects to it.
  • A test runs the merge and then a Mail peer pass with the rebuild and drain. Afterwards the Owner holds no Mail Source link for that address and no message: interactions from it.
  • An unchanged owner config writes nothing: no Handle rows, no changes rows.
  • A config address that matches a Tombstone is not re-created on any Person other than the Owner (ADR 0003 Amendment 1).
  • make check passes.

Blocked by

Filed under: operator word "leans" sha256:351a2e1b4b7a (dev/people-mind-mcp #69 gate)

## Outcome An address added to `[owner] emails` joins the Owner Person, and no other Person keeps a Handle or a Mail-sourced link for it. ## Context #69 (`9f583ea`) makes a change to `[owner] emails` rebuild the Mail peer projection. After that rebuild, a new owner address no longer produces support rows (`_mail_allowed`, `sync.py`). Two gaps stay: - `graph.ensure_owner` (`graph.py:169-187`) returns at once when an Owner Person exists. It never adds new config addresses as Handles of the Owner. Callers: `cli.py:50` and `sync.py:664`. - A Person that Mail created earlier for that address keeps the Handle and its `source_links` row. After the rebuild retracts its interactions, it is an orphan. Live case (starbase-syd, 2026-11-04): Mail Mind's Sent role holds about 25 owner From values, and the config lists 3. When the operator adds the missing addresses, about 22 of these orphans can appear. ## Ruling (operator, 2026-11-04) Merge the other Person into the Owner. ADR 0002 already decides this: - Rule 6 (`docs/adr/0002-identity-and-merge.md:16`): "The Owner's Handles come from the `[owner]` config block, never from a Source." So `ensure_owner` must add every config address to an existing Owner. The early return is a defect against rule 6. - Rule 2 (`:12`): a Handle belongs to exactly one Person. So the address cannot stay on the other Person. - Rule 3 (`:13`): an exact shared Handle merges silently. A config address is an exact Handle, so no `people_link` is needed. - Moving only the Handle is refused: it leaves a Person with no Handles. `merge_persons` already keeps the Owner as the survivor (`RANK_SURVIVORS` orders by `is_owner DESC`, `graph.py:119`). Use it; do not write a second merge path. Accepted trade-off: this merge is not a `people_link` action, so `people_undo` cannot reverse it. A wrong address in `[owner] emails` merges a real Person into the Owner silently. The repair is a manual `people_link` split. ## Scope - `ensure_owner`: for an existing Owner, add each normalised config email and phone that the Owner lacks as a `config`/`owner` Handle, in the same way as the create path (`_record_handles`, `_insert_handle`). - When a config Handle belongs to another Person, call `merge_persons` with the Owner, and emit the `merge` change as usual. - After the merge, the Owner can hold the Mail Source's link for that address. The #69 rebuild excludes the address, so the drain retracts that link (`retract_record`: no support and no Evidence). Prove this with a test; change the drain only if the test fails. Out of scope: removing Handles for addresses deleted from `[owner] emails`, and any change to name matching. ## Acceptance criteria - [ ] A test adds an owner address to config. After the next writer start, the Owner Person holds it as a Handle. - [ ] A test with a Mail-created Person for that address shows it merged into the Owner: the Owner id survives and the old id redirects to it. - [ ] A test runs the merge and then a Mail peer pass with the rebuild and drain. Afterwards the Owner holds no Mail Source link for that address and no `message:` interactions from it. - [ ] An unchanged owner config writes nothing: no Handle rows, no changes rows. - [ ] A config address that matches a Tombstone is not re-created on any Person other than the Owner (ADR 0003 Amendment 1). - [ ] `make check` passes. ## Blocked by - #69 Filed under: operator word "leans" sha256:351a2e1b4b7a (dev/people-mind-mcp #69 gate)
Author
Collaborator

⏸ SVD architect gate: dev/people-mind-mcp#73 owner-config-attach-newly-added-owner-addresses-to-the-owner

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: 20261104T104557Z-a9aa707a

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

Open risks:

  1. The issue says to change the drain only if the AC3 test fails. On cf32ff2 it fails: activation's _mail_enqueue filters owner addresses out (sync.py:232-242, :340), and the drain's disallowed branch deletes pending/support without calling retract_record (:500-503). The spec therefore adds a LIVE_LINKS → retract_record loop to snapshot activation (sync.py between :327 and :328) and records it as ADR 0010 Amendment 3. The drain stays unchanged, so no Evidence request is ever sent for an owner address. Question: is retracting in activation, rather than enqueuing the owner address for the drain, the accepted form of 'change the drain'? Lean: yes. [decision]
  2. ensure_owner re-attributes a Handle the Owner gained by merge from its Source provenance (e.g. mail/) to config/owner, via a new CLAIM_OWNER_HANDLE UPDATE. people_card (views.py:31) will then show 'config' as the source. Question: accept this re-attribution under ADR 0002 rule 6 ('never from a Source')? Lean: yes. The alternative leaves the Owner's card showing a mail provenance for an owner address. [decision]
  3. Live check on starbase-syd after deploy: add the missing owner addresses and restart the writer. Then: (a) SELECT COUNT() FROM changes WHERE kind='merge' AND person_id=(SELECT id FROM persons WHERE is_owner=1) AND at >= '' should be about 22; (b) after the rebuild activates, SELECT COUNT() FROM source_links l JOIN persons p ON p.id=l.person_id WHERE p.is_owner=1 AND l.source='mail' AND l.deleted_at IS NULL should be 0; (c) SELECT COUNT(*) FROM handles h JOIN persons p ON p.id=h.person_id WHERE p.is_owner=1 AND h.source='config' should equal the number of distinct normalised config emails and phones. [verification]
  4. Adjacent, not absorbed: the legacy-text Mail source (protocol='legacy-text', sources/mailmind.py:215-220) has no rebuild. After the merge, the Owner keeps a live legacy Mail link for the address. Question: does any deployment still run legacy-text, and if so, should a follow-up issue retire legacy links for owner addresses? Lean: file one only if such a deployment exists. This spec leaves mailmind.py untouched. [decision]

Change: (1) graph.ensure_owner (graph.py:179-195): replace the early return for an existing Owner with a reconcile loop over _record_handles(SourceRecord('owner', emails, phones), region). For each matchable handle held by another Person (FIND_EXACT_HANDLE), call merge_persons(conn, owner, holder). RANK_SURVIVORS is_owner DESC (graph.py:117-120) keeps the Owner as survivor, with the redirect and merge change. Merge before insert so the handles_exact unique index (store.py:55) never raises. Then run a new CLAIM_OWNER_HANDLE UPDATE that re-attributes the handle to config/owner (guarded so an already-config handle changes 0 rows), then _insert_handle. Emit UPDATE_PERSON_TIME + _change('update') only when conn.total_changes moved, mirroring ingest_record graph.py:341-344,390-392. The create path is unchanged. (2) sync._mail_snapshot_page activation: after the message: interaction DELETE (sync.py:320-327) and before DELETE FROM mail_support (:328), loop over LIVE_LINKS (sync.py:50) and call graph.retract_record for each address _mail_allowed rejects. Premise correction: _mail_enqueue (sync.py:232-242) never enqueues owner addresses, and the drain's disallowed branch (:500-503) never retracts, so the issue's 'drain retracts it' test would fail. The drain and _mail_enqueue stay unchanged, so no Evidence request is ever sent for an owner address. (3) Append ADR 0010 Amendment 3 (the #69 gate ruled amendments, not edits) plus one README:137 sentence about the silent merge.

Files: src/people_mind_mcp/graph.py · src/people_mind_mcp/sync.py · docs/adr/0010-mail-peer-v1-consumer-implementation.md · README.md · tests/test_identity.py · tests/test_mailpeer.py

Decision: accept the 4 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-04-owner-config-attach-newly-added-owner-addresses-to-the-owner.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-owner-config-attach-newly-added-owner-addresses-to-the-owner.md

### ⏸ SVD architect gate: dev/people-mind-mcp#73 owner-config-attach-newly-added-owner-addresses-to-the-owner **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:** `20261104T104557Z-a9aa707a` **Held because:** CLEAN but 4 open risk(s) (1 verification · 3 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. The issue says to change the drain only if the AC3 test fails. On cf32ff2 it fails: activation's _mail_enqueue filters owner addresses out (sync.py:232-242, :340), and the drain's disallowed branch deletes pending/support without calling retract_record (:500-503). The spec therefore adds a LIVE_LINKS → retract_record loop to snapshot activation (sync.py between :327 and :328) and records it as ADR 0010 Amendment 3. The drain stays unchanged, so no Evidence request is ever sent for an owner address. Question: is retracting in activation, rather than enqueuing the owner address for the drain, the accepted form of 'change the drain'? Lean: yes. [decision] 2. ensure_owner re-attributes a Handle the Owner gained by merge from its Source provenance (e.g. mail/<address>) to config/owner, via a new CLAIM_OWNER_HANDLE UPDATE. people_card (views.py:31) will then show 'config' as the source. Question: accept this re-attribution under ADR 0002 rule 6 ('never from a Source')? Lean: yes. The alternative leaves the Owner's card showing a mail provenance for an owner address. [decision] 3. Live check on starbase-syd after deploy: add the missing owner addresses and restart the writer. Then: (a) SELECT COUNT(*) FROM changes WHERE kind='merge' AND person_id=(SELECT id FROM persons WHERE is_owner=1) AND at >= '<restart>' should be about 22; (b) after the rebuild activates, SELECT COUNT(*) FROM source_links l JOIN persons p ON p.id=l.person_id WHERE p.is_owner=1 AND l.source='mail' AND l.deleted_at IS NULL should be 0; (c) SELECT COUNT(*) FROM handles h JOIN persons p ON p.id=h.person_id WHERE p.is_owner=1 AND h.source='config' should equal the number of distinct normalised config emails and phones. [verification] 4. Adjacent, not absorbed: the legacy-text Mail source (protocol='legacy-text', sources/mailmind.py:215-220) has no rebuild. After the merge, the Owner keeps a live legacy Mail link for the address. Question: does any deployment still run legacy-text, and if so, should a follow-up issue retire legacy links for owner addresses? Lean: file one only if such a deployment exists. This spec leaves mailmind.py untouched. [decision] **Change:** (1) graph.ensure_owner (graph.py:179-195): replace the early return for an existing Owner with a reconcile loop over _record_handles(SourceRecord('owner', emails, phones), region). For each matchable handle held by another Person (FIND_EXACT_HANDLE), call merge_persons(conn, owner, holder). RANK_SURVIVORS is_owner DESC (graph.py:117-120) keeps the Owner as survivor, with the redirect and merge change. Merge before insert so the handles_exact unique index (store.py:55) never raises. Then run a new CLAIM_OWNER_HANDLE UPDATE that re-attributes the handle to config/owner (guarded so an already-config handle changes 0 rows), then _insert_handle. Emit UPDATE_PERSON_TIME + _change('update') only when conn.total_changes moved, mirroring ingest_record graph.py:341-344,390-392. The create path is unchanged. (2) sync._mail_snapshot_page activation: after the message: interaction DELETE (sync.py:320-327) and before DELETE FROM mail_support (:328), loop over LIVE_LINKS (sync.py:50) and call graph.retract_record for each address _mail_allowed rejects. Premise correction: _mail_enqueue (sync.py:232-242) never enqueues owner addresses, and the drain's disallowed branch (:500-503) never retracts, so the issue's 'drain retracts it' test would fail. The drain and _mail_enqueue stay unchanged, so no Evidence request is ever sent for an owner address. (3) Append ADR 0010 Amendment 3 (the #69 gate ruled amendments, not edits) plus one README:137 sentence about the silent merge. **Files:** `src/people_mind_mcp/graph.py` · `src/people_mind_mcp/sync.py` · `docs/adr/0010-mail-peer-v1-consumer-implementation.md` · `README.md` · `tests/test_identity.py` · `tests/test_mailpeer.py` **Decision:** accept the 4 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-04-owner-config-attach-newly-added-owner-addresses-to-the-owner.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-owner-config-attach-newly-added-owner-addresses-to-the-owner.md`</sub>
Author
Collaborator

spec-verify-dispatch Half B for dev/people-mind-mcp#73 owner-config-attach-newly-added-owner-addresses-to-the-owner completed integration verify.

  • PR: #79
  • Branch: feat/svd-dev-people-mind-mcp-73-owner-config-attach-newly-add-7cb7b962
  • Commit: 4ff2c5c982
  • 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/43/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 20261104T110103Z-7cb7b962 --confirm-merge)
spec-verify-dispatch Half B for dev/people-mind-mcp#73 owner-config-attach-newly-added-owner-addresses-to-the-owner completed integration verify. - PR: https://git.groupthink.asia/dev/people-mind-mcp/pulls/79 - Branch: feat/svd-dev-people-mind-mcp-73-owner-config-attach-newly-add-7cb7b962 - Commit: 4ff2c5c982d5941e0c7d7a18e89ce93c7331b5dc - 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/43/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 20261104T110103Z-7cb7b962 --confirm-merge`)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

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