Restore-safe Tombstones before people_forget is mounted #55

Open
opened 2026-11-03 21:55:56 +00:00 by piers · 2 comments
Owner

Outcome

A restore of the People database to a point before a Forget does not bring the forgotten Person back, including a restore onto an empty volume after the host is lost.

Context

Parent: dev/people-mind-mcp#50. This is a child of that issue, not a blocker of it.

ADR 0003 Amendment 1, rule 3 (the #50 grill, 2026-11-04). Today the Tombstones and the Forget audit row live in the same database (src/people_mind_mcp/store.py:65-67), so a restore from before a Forget undoes it, and no record outside the database lets an operator redo it. In Kubernetes the salt is a read-only Secret copied into memory (README.md:152), so no durable writable place exists beside it.

The grill's design lean (Q13): a separate tombstones.db on the data volume, replicated by the same Litestream sidecar as its own database entry. The restore runbook always restores it to its latest point, whatever point people.db returns to. On start, People re-applies every Tombstone the people database lacks. It holds only salted hashes, so its retention can be long.

This issue must close before the Phase B slice mounts people_forget (ADR 0005).

Scope

  1. Done: the ruling below confirms the design lean with four amendments.
  2. Implement the store, the start-up re-apply, the Litestream entries in compose.yaml, deploy/litestream.example.yml and the Kubernetes overlay, and the restore runbook in README.md:167-177.
  3. Test: Forget, restore people.db from before the Forget, start, and assert the Person is absent and its Handles stay suppressed.

Ruling (2026-11-05)

The operator confirms the design lean: a separate tombstones.db on the data volume, replicated by the same Litestream sidecar as its own database entry, and always restored to its latest point. Four amendments bind the implementation:

  1. tombstones.db is the authority and is written first. Litestream needs WAL mode, and in WAL mode a transaction across ATTACHed databases is atomic per file, not as a set. Forget commits the hashes to tombstones.db, then applies the Forget to people.db. The start-up re-apply repairs a crash between the two commits.
  2. Re-apply runs the full Forget path and is idempotent. On start, People hashes every stored Handle with the salt. For each Person that holds a matching Handle, it runs the whole Forget: Interactions, orphaned derived Organisations, the legacy checkpoint purge and the secure_delete scrub (#54). Inserting the hash alone is not enough.
  3. Every start takes the union of both stores. A hash that only people.db holds is copied to tombstones.db, and the reverse. The union also migrates today's people.db Tombstones on first deploy. The Forget audit row (store.py:78) moves to tombstones.db.
  4. The two remaining limits are stated, not engineered away. A Forget is durable off-host only after the next Litestream sync (10 s in the example overlay); Litestream 0.3.13 cannot confirm a sync. The salt is part of the guarantee, so the restore runbook names the salt's backup.

Write the rule into ADR 0003 Amendment 1 rule 3 as part of this issue.

Human act

T4 merge: the operator reviews and merges the change, because it alters Litestream replication and the restore runbook (CONV-40)

Filed under: operator word "accept/agree. yes. go" sha256:f76d6cac557a (#49 #50 grill)

## Outcome A restore of the People database to a point before a Forget does not bring the forgotten Person back, including a restore onto an empty volume after the host is lost. ## Context Parent: dev/people-mind-mcp#50. This is a child of that issue, not a blocker of it. ADR 0003 Amendment 1, rule 3 (the #50 grill, 2026-11-04). Today the Tombstones and the Forget audit row live in the same database (`src/people_mind_mcp/store.py:65-67`), so a restore from before a Forget undoes it, and no record outside the database lets an operator redo it. In Kubernetes the salt is a read-only Secret copied into memory (`README.md:152`), so no durable writable place exists beside it. The grill's design lean (Q13): a separate `tombstones.db` on the data volume, replicated by the same Litestream sidecar as its own database entry. The restore runbook always restores it to its latest point, whatever point `people.db` returns to. On start, People re-applies every Tombstone the people database lacks. It holds only salted hashes, so its retention can be long. This issue must close before the Phase B slice mounts `people_forget` (ADR 0005). ## Scope 1. Done: the ruling below confirms the design lean with four amendments. 2. Implement the store, the start-up re-apply, the Litestream entries in `compose.yaml`, `deploy/litestream.example.yml` and the Kubernetes overlay, and the restore runbook in `README.md:167-177`. 3. Test: Forget, restore `people.db` from before the Forget, start, and assert the Person is absent and its Handles stay suppressed. ## Ruling (2026-11-05) The operator confirms the design lean: a separate `tombstones.db` on the data volume, replicated by the same Litestream sidecar as its own database entry, and always restored to its latest point. Four amendments bind the implementation: 1. **`tombstones.db` is the authority and is written first.** Litestream needs WAL mode, and in WAL mode a transaction across ATTACHed databases is atomic per file, not as a set. Forget commits the hashes to `tombstones.db`, then applies the Forget to `people.db`. The start-up re-apply repairs a crash between the two commits. 2. **Re-apply runs the full Forget path and is idempotent.** On start, People hashes every stored Handle with the salt. For each Person that holds a matching Handle, it runs the whole Forget: Interactions, orphaned derived Organisations, the legacy checkpoint purge and the `secure_delete` scrub (#54). Inserting the hash alone is not enough. 3. **Every start takes the union of both stores.** A hash that only `people.db` holds is copied to `tombstones.db`, and the reverse. The union also migrates today's `people.db` Tombstones on first deploy. The Forget audit row (`store.py:78`) moves to `tombstones.db`. 4. **The two remaining limits are stated, not engineered away.** A Forget is durable off-host only after the next Litestream sync (10 s in the example overlay); Litestream 0.3.13 cannot confirm a sync. The salt is part of the guarantee, so the restore runbook names the salt's backup. Write the rule into ADR 0003 Amendment 1 rule 3 as part of this issue. ## Human act T4 merge: the operator reviews and merges the change, because it alters Litestream replication and the restore runbook (CONV-40) Filed under: operator word "accept/agree. yes. go" sha256:f76d6cac557a (#49 #50 grill)

This was generated by AI during triage.

Ruling recorded

The operator confirmed the design lean with four amendments. The issue body now carries them under ## Ruling (2026-11-05):

  1. tombstones.db is the authority and is written first.
  2. Re-apply runs the full Forget path and is idempotent.
  3. Every start takes the union of both stores; the Forget audit row moves to tombstones.db.
  4. The sync window and the salt dependency are stated in the ADR.

The label stays ready-for-human. The change alters Litestream replication, so CONV-40 rule 3 keeps it with a human. The remaining human act is the T4 merge.

Filed under: operator word "I accept 55 ruling" sha256:98451e190c26

> *This was generated by AI during triage.* ## Ruling recorded The operator confirmed the design lean with four amendments. The issue body now carries them under `## Ruling (2026-11-05)`: 1. `tombstones.db` is the authority and is written first. 2. Re-apply runs the full Forget path and is idempotent. 3. Every start takes the union of both stores; the Forget audit row moves to `tombstones.db`. 4. The sync window and the salt dependency are stated in the ADR. The label stays `ready-for-human`. The change alters Litestream replication, so CONV-40 rule 3 keeps it with a human. The remaining human act is the T4 merge. Filed under: operator word "I accept 55 ruling" sha256:98451e190c26
Author
Owner

From the 2026-11-05 grill (Q-B1, Q33): no wait on this issue. ADR 0003 Amendment 2 rule 3 (merged in #126, 64df4fe) restates rule 2 here as "on every start, re-apply Forget for each Person that holds a matching exclusive Handle or a matching source link". A shared Endpoint is never tombstoned, so the other holder of a shared phone is not forgotten at start. tombstones.db still holds hashes only. Please quote that rule when the T4 lands.

From the 2026-11-05 grill (Q-B1, Q33): no wait on this issue. ADR 0003 Amendment 2 rule 3 (merged in #126, `64df4fe`) restates rule 2 here as "on every start, re-apply Forget for each Person that holds a matching exclusive Handle or a matching source link". A shared Endpoint is never tombstoned, so the other holder of a shared phone is not forgotten at start. `tombstones.db` still holds hashes only. Please quote that rule when the T4 lands.
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#55
No description provided.