Forget: scrub the database file, purge the legacy checkpoint and orphaned derived Organisations #54
Labels
No labels
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:fire
svd:go
svd:hold
svd:respec
svd:skip
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/people-mind-mcp#54
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Outcome
After Forget, no byte of the forgotten Person's Handles remains in the store's database file, the legacy pending checkpoint holds none of their addresses, and no derived Organisation that only they used remains.
Context
Parent: dev/people-mind-mcp#50. This is a child of that issue, not a blocker of it.
The #50 grill (2026-11-04) ruled ADR 0003 Amendment 1, rules 1, 4 and 5. The amendment is on branch
docs/grill-49-50-amendments(a493728); dispatch after it is onmain. Restore-safe Tombstones (rule 3) are a separate issue.open_writer(src/people_mind_mcp/store.py:127-154) sets onlyjournal_mode=WAL,foreign_keys=ONandbusy_timeout=5000.graph.forget(src/people_mind_mcp/graph.py:380-404) does not touchsource_state. Inlegacy-textmode the zlib pending checkpoint there (sync.py:57-60) is keyed by address (sources/mailmind.py:168)._derived_orgs(graph.py:208-225) creates an Organisation and anorg_domainsrow for each non-public email domain.tests/test_mailpeer.py:924-925).Do not add an application checkpoint or a per-Forget
VACUUM. Litestream 0.3.13 holds a read lock to own checkpointing; an applicationTRUNCATEcheckpoint returns busy or forces a new backup generation (ADR 0003 Amendment 1, rule 1).Scope
PRAGMA secure_delete=ONinopen_writer.store.py: a migration whose only effect is oneVACUUM, so pages freed beforesecure_deleteare scrubbed.VACUUMcannot run inside a transaction; run it outside the migration transaction and setuser_version=7after it.graph.forget, inside the Forget transaction, decode eachsource_staterow that holdspending, drop the forgotten Person's addresses, and write the row back encoded.graph.forget, delete each derived Organisation, with itsorg_domainsrows, that the forgotten Person related to, when no other Person relates to it and it has no asserted field.wal_checkpoint(TRUNCATE)(no Litestream in tests), the forgotten address bytes are absent from the db file;source_staterow and asserts absence;README.md:141to state the guarantee: physical erasure from the database file; backup residue lasts until retention removes it (ADR 0003 Amendment 1, rule 2).Acceptance criteria
Filed under: operator word "accept/agree. yes. go" sha256:f76d6cac557a (#49 #50 grill)
⏸ SVD architect gate: dev/people-mind-mcp#54 forget-scrub-the-database-file-purge-the-legacy-checkpoint-a
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 efforthighRun:
20261103T221217Z-d3ad4609Held because: CLEAN but 4 open risk(s) (2 verification · 2 decision) — HOLD-ALL parks everything. The risks, verbatim:
Open risks:
peoplemind checkprints store=ok schema=7, that Litestream logs show no new-generation or replication error around the migration, and record the time from writer start to /healthz/sync ok against the db size. [verification]Change: store.py: add SECURE_DELETE/VACUUM constants beside the pragma constants at store.py:11-18 and execute PRAGMA secure_delete=ON after BUSY_TIMEOUT (store.py:134). Set SCHEMA_VERSION=7 but keep MIGRATIONS at six transactional entries, because tests/test_mailpeer.py:355 builds a v5 store with MIGRATIONS[:-1]. After the
with transaction(conn)block in open_writer (store.py:135-145), addif version < SCHEMA_VERSION:running VACUUM, then PRAGMA user_version=7. Readers keep refusing store-schema-behind until then. graph.py: extend forget (graph.py:380-404) inside its existing transaction. (1) Collect email values in the existing handle loop. (2) A new _purge_legacy_pending helper decodes each source_state row with sync.decode_state, drops the forgotten addresses frompending, and rewrites the row with encode_state only when an address matched. It uses a function-local import of sync, since sync imports graph, following sync.py:69. (3) Collect candidate orgs from the Person's derived 'organisation' fields and target_org_id relations before DELETE_PERSON. After it, delete each org that has an org_domains row and no remaining fields/relations/org_aliases reference, relying on ON DELETE CASCADE for org_domains. Tests: extended C08 with a test-run wal_checkpoint(TRUNCATE) and a raw ADDRESS-bytes check; a new explicit-secure_delete=OFF v6→v7 migration test shaped like test_identity.py:382-400; a new derived-org test; a new parametrised legacy checkpoint test; flip test_identity.py:292 to 0; update the schema=6 literals in test_config_cli.py:119, test_embed.py:64, test_deploy.py:295,328 and README.md:141,177.Files:
src/people_mind_mcp/store.py·src/people_mind_mcp/graph.py·tests/test_identity.py·tests/test_mailmind.py·tests/test_mailpeer.py·tests/test_config_cli.py·tests/test_embed.py·tests/test_deploy.py·README.mdDecision: 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):svd:go— approve; Half-B dispatch accepts exactly this spec (open risks accepted)svd:firebesidesvd:go— approve AND authorise the Half-B fire from the phone; never on its ownsvd:skip— park it; dispatch refuses it and the issue stays for a humansvd:respec— discard this spec; the next Half-A run re-produces it with this record as prior-attempt contextSpec:
/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-03-forget-scrub-the-database-file-purge-the-legacy-checkpoint-a.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-03-forget-scrub-the-database-file-purge-the-legacy-checkpoint-a.md⏸ SVD architect gate: dev/people-mind-mcp#54 forget-scrub-the-database-file-purge-the-legacy-checkpoint-a
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 efforthighRun:
20261103T234004Z-6d10a837Held because: CLEAN but 1 open risk(s) (1 verification) — HOLD-ALL parks everything. The risks, verbatim:
Open risks:
peoplemind check --config …printsstore=ok schema=7, that the Litestream logs show no new-generation or replication error around the migration, and record the time from writer start to /healthz/sync ok against the db size. [verification]Change: store.py: add SECURE_DELETE/VACUUM/user_version=7 constants beside store.py:11-18 and execute PRAGMA secure_delete=ON after BUSY_TIMEOUT (store.py:134). Set SCHEMA_VERSION=7. Keep MIGRATIONS at six transactional entries, because tests/test_mailpeer.py:355 treats MIGRATIONS[:-1] as a v5 store. After the
with transaction(conn)block in open_writer (store.py:135-145), addif version < SCHEMA_VERSION:that runs VACUUM and then sets user_version=7, in autocommit (isolation_level=None). Readers keep refusing store-schema-behind until then. graph.py: extend forget (graph.py:380-404) inside its existing transaction: (1) collect email values in the existing handle loop; (2) a new _purge_legacy_pending helper decodes each source_state row with sync.decode_state, drops the forgotten addresses frompendingand rewrites the row with encode_state only when an address matched, using a function-local import of sync because sync imports graph (precedent sync.py:69,661); (3) before DELETE_PERSON, collect candidate orgs from the Person's derived 'organisation' fields and target_org_id relations; after it, delete each org that has an org_domains row and no remaining fields/relations/org_aliases reference, with ON DELETE CASCADE removing org_domains. These definitions were approved by the architect at the prior gate. Tests: extend C08 (test_mailpeer.py:911-968) with a test-run wal_checkpoint(TRUNCATE) and a raw ADDRESS-bytes check; add an explicit-secure_delete=OFF v6→v7 migration test shaped like test_identity.py:382-400; add a derived-org test; add a parametrised legacy checkpoint test (zlib and rc4 text); flip test_identity.py:292 to 0; update the schema-6 literals in test_config_cli.py:119, test_embed.py:64, test_deploy.py:295,328 and README.md:141,177.Files:
src/people_mind_mcp/store.py·src/people_mind_mcp/graph.py·tests/test_identity.py·tests/test_mailmind.py·tests/test_mailpeer.py·tests/test_config_cli.py·tests/test_embed.py·tests/test_deploy.py·README.mdDecision: accept the 1 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):svd:go— approve; Half-B dispatch accepts exactly this spec (open risks accepted)svd:firebesidesvd:go— approve AND authorise the Half-B fire from the phone; never on its ownsvd:skip— park it; dispatch refuses it and the issue stays for a humansvd:respec— discard this spec; the next Half-A run re-produces it with this record as prior-attempt contextSpec:
/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-03-forget-scrub-the-database-file-purge-the-legacy-checkpoint-a.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-03-forget-scrub-the-database-file-purge-the-legacy-checkpoint-a.mdspec-verify-dispatch Half B for dev/people-mind-mcp#54 forget-scrub-the-database-file-purge-the-legacy-checkpoint-a completed integration verify.
52f552ea0f52f552e: ci/woodpecker/pr/validation pending. Local: make check green (387 passed, 5 skipped). One blocker: PR body lacks the post-deploy checklist.peoplemind checkreports store=ok schema=7; check Litestream logs for new-generation or replication errors around migration; record writer-start-to-/healthz/sync-ok duration against database size. Note that container deployment integration tests (make test-integration) remain for the container-capable host.peoplemind checkreports store=ok schema=7; check Litestream logs for new-generation or replication errors around migration; record writer-start-to-/healthz/sync-ok duration against database size. Note that container deployment integration tests (make test-integration) remain for the container-capable host.; no denial signature; evidence: PR #63 body (694 chars) contains no 'Litestream', 'healthz' or 'store=ok'; the subagent deviations require the checklist in the PR body.52f552e; the runner must re-poll it.0dc6998differs from the spec baseCommit2788842; the subagent measured the baseline at the supplied HEAD (383 passed, 5 skipped, 4 deselected). Verified here: 387 passed, 5 skipped, 4 deselected.peoplemind checkreports store=ok schema=7; check Litestream logs for new-generation or replication errors around migration; record writer-start-to-/healthz/sync-ok duration against database size. Note that container deployment integration tests (make test-integration) remain for the container-capable host.; edit the PR title or body by hand, then re-run integrate or run the own-execution gate.spec-verify-dispatch Half B for dev/people-mind-mcp#54 forget-scrub-the-database-file-purge-the-legacy-checkpoint-a completed integration verify.
52f552ea0f52f552e: ci/woodpecker/pr/validation green (combined status success). Local filtered run 32 passed. make check: 387 passed, 5 skipped, 4 deselected.0dc6998differed from spec base2788842; spec hashes matched per subagent, and the PR head is52f552e.codex-svd ship --run-id 20261104T004857Z-e6d768fb --confirm-merge)