Mail peer: rebuild the projection when [owner] emails changes #69

Closed
opened 2026-11-04 06:38:10 +00:00 by svc-svd-writer · 2 comments
Collaborator

Outcome

A change to [owner] emails re-derives the Mail peer projection, so existing support rows follow the new owner set.

Context

_mail_targets and _mail_allowed (sync.py) read source.owner_emails when a page or snapshot row is applied. The result is stored in mail_support (direction, and which addresses count). Nothing records which owner set produced those rows. After the operator adds an owner address, the old rows keep the old direction until the next snapshot, and only an identity change or a cursor error starts one. There is no command to start a rebuild.

Live case (starbase-syd, 2026-11-04): Mail Mind's Sent role holds about 25 owner From values, and the config lists 3. Adding the missing addresses today corrects only events that arrive after the change.

Scope

  • Record a salted digest of the normalised owner set in mail_peer (a migration), or derive it from config at each pass and store it beside the identity.
  • When the digest differs from the stored one, start a staged snapshot as an identity change does (_mail_reset_snapshot), and log mailmind-rebuild.
  • README: say that changing [owner] emails triggers one rebuild.

The first pass after the migration has no stored digest. Record it without a rebuild.

Acceptance criteria

  • A test adds an owner address, runs a pass, and sees the earlier messages from that address re-derived as outgoing.
  • An unchanged owner set never triggers a rebuild.
  • The digest reveals no address (salted, like the fence digest).

Filed under: operator word "file them." sha256:237e55ef9da1 (People Mind mail cross-check, test 6)

## Outcome A change to `[owner] emails` re-derives the Mail peer projection, so existing support rows follow the new owner set. ## Context `_mail_targets` and `_mail_allowed` (`sync.py`) read `source.owner_emails` when a page or snapshot row is applied. The result is stored in `mail_support` (direction, and which addresses count). Nothing records which owner set produced those rows. After the operator adds an owner address, the old rows keep the old direction until the next snapshot, and only an identity change or a cursor error starts one. There is no command to start a rebuild. Live case (starbase-syd, 2026-11-04): Mail Mind's Sent role holds about 25 owner From values, and the config lists 3. Adding the missing addresses today corrects only events that arrive after the change. ## Scope - Record a salted digest of the normalised owner set in `mail_peer` (a migration), or derive it from config at each pass and store it beside the identity. - When the digest differs from the stored one, start a staged snapshot as an identity change does (`_mail_reset_snapshot`), and log `mailmind-rebuild`. - README: say that changing `[owner] emails` triggers one rebuild. The first pass after the migration has no stored digest. Record it without a rebuild. ## Acceptance criteria - [ ] A test adds an owner address, runs a pass, and sees the earlier messages from that address re-derived as outgoing. - [ ] An unchanged owner set never triggers a rebuild. - [ ] The digest reveals no address (salted, like the fence digest). Filed under: operator word "file them." sha256:237e55ef9da1 (People Mind mail cross-check, test 6)
Author
Collaborator

⏸ SVD architect gate: dev/people-mind-mcp#69 mail-peer-rebuild-the-projection-when-owner-emails-changes

Status: CLEAN after 1 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: 20261104T064531Z-dffc8ede

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

Open risks:

  1. graph.ensure_owner (graph.py:169-187) returns early for an existing Owner, so a newly added owner address is never attached to the Owner Person. Any Person the Mail Source created earlier for that address keeps its source_links row but has no interactions. Should a follow-up issue reconcile Owner handles and retract Mail-sourced records for addresses that became owner addresses? Lean: yes, filed separately; not absorbed here. [decision]
  2. On starbase-syd after shipping: deploy, let one pass record the digest, then add the missing owner addresses. Check that SELECT error FROM sync_log WHERE error='mailmind-rebuild' gains exactly one row. After the drain, SELECT direction, COUNT(*) FROM mail_support GROUP BY direction should show the out count risen. Also check that running people-mind sync while serve is up during the schema-8 upgrade leaves both processes running, with no store-unavailable, and that people-mind check prints schema=8. [verification]
  3. ADR 0010 is in Primary Files because §5 lists the snapshot triggers exhaustively. Are ADR edits architect-only in this repo? If yes, drop the docs/adr/0010 row and leave the trigger list stale until an amendment. [decision]

Change: store.py open_writer (:130-161): replace the tail at :151-154 with if version < SCHEMA_VERSION: if version < 7: VACUUM; with transaction(conn): re-read PRAGMA user_version (raise store-schema-ahead if >8); if <8: ALTER only when pragma_table_info lacks owner_digest, then SCHEMA_8. transaction() is BEGIN IMMEDIATE (:226-235), so concurrent writers serialise and the loser re-reads 8 and no-ops. SCHEMA_7 is removed and folded in, so no step can lower user_version. Leave MIGRATIONS unchanged. sync.py: add _mail_owner_digest beside _mail_digest (:192-199), an HMAC-SHA256 under the tombstone salt over the sorted normalised owner_emails. In the _peer_pass identity transaction (:547-556), mirror the identity-change branch: a mismatch against a non-NULL stored digest runs _mail_reset_snapshot plus mailmind-rebuild; a NULL stored digest is recorded without a rebuild.

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

Decision: accept the 3 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-mail-peer-rebuild-the-projection-when-owner-emails-changes.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-mail-peer-rebuild-the-projection-when-owner-emails-changes.md

### ⏸ SVD architect gate: dev/people-mind-mcp#69 mail-peer-rebuild-the-projection-when-owner-emails-changes **Status:** CLEAN after 1 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:** `20261104T064531Z-dffc8ede` **Held because:** CLEAN but 3 open risk(s) (1 verification · 2 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. graph.ensure_owner (graph.py:169-187) returns early for an existing Owner, so a newly added owner address is never attached to the Owner Person. Any Person the Mail Source created earlier for that address keeps its source_links row but has no interactions. Should a follow-up issue reconcile Owner handles and retract Mail-sourced records for addresses that became owner addresses? Lean: yes, filed separately; not absorbed here. [decision] 2. On starbase-syd after shipping: deploy, let one pass record the digest, then add the missing owner addresses. Check that `SELECT error FROM sync_log WHERE error='mailmind-rebuild'` gains exactly one row. After the drain, `SELECT direction, COUNT(*) FROM mail_support GROUP BY direction` should show the out count risen. Also check that running `people-mind sync` while serve is up during the schema-8 upgrade leaves both processes running, with no store-unavailable, and that `people-mind check` prints schema=8. [verification] 3. ADR 0010 is in Primary Files because §5 lists the snapshot triggers exhaustively. Are ADR edits architect-only in this repo? If yes, drop the docs/adr/0010 row and leave the trigger list stale until an amendment. [decision] **Change:** store.py open_writer (:130-161): replace the tail at :151-154 with `if version < SCHEMA_VERSION: if version < 7: VACUUM; with transaction(conn): re-read PRAGMA user_version (raise store-schema-ahead if >8); if <8: ALTER only when pragma_table_info lacks owner_digest, then SCHEMA_8`. transaction() is BEGIN IMMEDIATE (:226-235), so concurrent writers serialise and the loser re-reads 8 and no-ops. SCHEMA_7 is removed and folded in, so no step can lower user_version. Leave MIGRATIONS unchanged. sync.py: add _mail_owner_digest beside _mail_digest (:192-199), an HMAC-SHA256 under the tombstone salt over the sorted normalised owner_emails. In the _peer_pass identity transaction (:547-556), mirror the identity-change branch: a mismatch against a non-NULL stored digest runs _mail_reset_snapshot plus mailmind-rebuild; a NULL stored digest is recorded without a rebuild. **Files:** `src/people_mind_mcp/store.py` · `src/people_mind_mcp/sync.py` · `README.md` · `docs/adr/0010-mail-peer-v1-consumer-implementation.md` · `tests/test_mailpeer.py` · `tests/test_identity.py` · `tests/test_config_cli.py` · `tests/test_embed.py` · `tests/test_deploy.py` **Decision:** accept the 3 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-mail-peer-rebuild-the-projection-when-owner-emails-changes.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-mail-peer-rebuild-the-projection-when-owner-emails-changes.md`</sub>
Author
Collaborator

spec-verify-dispatch Half B for dev/people-mind-mcp#69 mail-peer-rebuild-the-projection-when-owner-emails-changes completed integration verify.

  • PR: #74
  • Branch: feat/svd-dev-people-mind-mcp-69-mail-peer-rebuild-the-project-8e6243c8
  • Commit: 0b4c913bdd
  • 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/34/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • Warning: The system python3 lacks phonenumbers; tests ran with the repo .venv/bin/python instead (399 passed, 9 skipped).
  • Warning: The spec's Test Strategy names tests/test_identity.py::test_writer_migrates_v6_store_to_v7_scrubbing_freed_pages. The PR renamed it to ..._v6_store_to_v8_scrubbing_freed_pages (self-review fix). It still collects under -k scrubbing. The spec table is a criterion table, not a scenario-trace table, so this is not a blocker.
  • Warning: Host-only deployment integration tests were not run by the coding subagent (schema assertions only updated). Some of the 9 skipped tests may be those host-only tests.
  • Warning: ADR 0010 was edited as an amendment per the spec lean; not re-audited line by line.
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261104T081621Z-8e6243c8 --confirm-merge)
spec-verify-dispatch Half B for dev/people-mind-mcp#69 mail-peer-rebuild-the-projection-when-owner-emails-changes completed integration verify. - PR: https://git.groupthink.asia/dev/people-mind-mcp/pulls/74 - Branch: feat/svd-dev-people-mind-mcp-69-mail-peer-rebuild-the-project-8e6243c8 - Commit: 0b4c913bdd26b800a54de427032cae1e0a1f8fbb - 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/34/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - Warning: The system python3 lacks phonenumbers; tests ran with the repo .venv/bin/python instead (399 passed, 9 skipped). - Warning: The spec's Test Strategy names tests/test_identity.py::test_writer_migrates_v6_store_to_v7_scrubbing_freed_pages. The PR renamed it to ..._v6_store_to_v8_scrubbing_freed_pages (self-review fix). It still collects under -k scrubbing. The spec table is a criterion table, not a scenario-trace table, so this is not a blocker. - Warning: Host-only deployment integration tests were not run by the coding subagent (schema assertions only updated). Some of the 9 skipped tests may be those host-only tests. - Warning: ADR 0010 was edited as an amendment per the spec lean; not re-audited line by line. - CI wait: ci/woodpecker/pr/validation -> pass - Decision: review the PR and merge? (`codex-svd ship --run-id 20261104T081621Z-8e6243c8 --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#69
No description provided.