vCard deletion detection and vanished-collection handling #14

Closed
opened 2026-11-01 03:34:32 +00:00 by piers · 3 comments
Owner

Parent: #1. Records: ADR 0004 §6 (a disappeared contact tombstones its source link; the Person stays).

What to build

  • The vCard Source detects a record that has left the import set and tombstones its source_links row (deleted_at), as the CardDAV Source does for sync-token deletions.
  • A CardDAV collection that vanishes from discovery, or drops out of the addressbooks filter, does not tombstone its members on one pass. Decide and implement the rule: a collection absent for N consecutive passes, or an explicit operator action, retires its links.
  • A tombstoned link revives when the record returns, as the CardDAV path already does.

Acceptance criteria

  • Removing a vCard from the import directory and running sync --once tombstones exactly that link; the Person and its asserted rows stay.
  • A transient discovery failure on one pass tombstones nothing; the counts in the summary line say deleted=0.
  • Tests cover both, with no network.

Blocked by

Filed from the architect gate on the #5 spec, 2026-11-01 (Open Risk 5), operator word "accept".

Parent: #1. Records: ADR 0004 §6 (a disappeared contact tombstones its source link; the Person stays). ## What to build - The vCard Source detects a record that has left the import set and tombstones its `source_links` row (`deleted_at`), as the CardDAV Source does for `sync-token` deletions. - A CardDAV collection that vanishes from discovery, or drops out of the `addressbooks` filter, does not tombstone its members on one pass. Decide and implement the rule: a collection absent for N consecutive passes, or an explicit operator action, retires its links. - A tombstoned link revives when the record returns, as the CardDAV path already does. ## Acceptance criteria - Removing a vCard from the import directory and running `sync --once` tombstones exactly that link; the Person and its asserted rows stay. - A transient discovery failure on one pass tombstones nothing; the counts in the summary line say `deleted=0`. - Tests cover both, with no network. ## Blocked by - #5 Filed from the architect gate on the #5 spec, 2026-11-01 (Open Risk 5), operator word "accept".
Collaborator

⏸ SVD architect gate: dev/peoplemind-mcp#14 vcard-deletion-detection-and-vanished-collection-handling

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 standard · dispatch effort medium

Run: 20261101T081350Z-c70f2c3b

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

Open risks:

  1. Is the retirement rule '3 consecutive successful discovery passes with the collection absent' acceptable, with N as a module constant (RETIRE_AFTER_PASSES = 3) rather than a CardDAVSourceConfig key? At the default interval_seconds = 900 that is about 45 minutes. The issue offered 'N passes or an explicit operator action'; this spec builds only the N-pass rule, and an operator retire verb would be a separate issue. Lean: constant, N=3, no verb. [decision]
  2. Should vCard deletion detection be skipped on any pass with unreadable > 0? The lean skips it. That is safe, but one persistently bad card then blocks every deletion for that source, visible only as 'unreadable=N deleted=0'. Second question: should an import set that yields zero records while live links exist also skip detection (unmounted-volume guard)? The lean does not guard it, because tombstones are reversible. [decision]
  3. Should a successful discovery that returns zero address books count toward retirement? The lean counts it like any other omission. The risk is that 3 consecutive transient empty listings retire every link (reversible on return). Special-casing zero as suspect would mean deleting every book, or a filter that matches nothing, never retires automatically. [decision]
  4. Should the architect record the N-pass rule as an ADR 0004 amendment, following the ADR 0001 Amendment 1 'recorded by the architect' precedent? It is kept out of dispatch scope. [decision]
  5. The test baseline was not measured in Half A because the sandbox denied .venv/bin/python. Before the first edit, run 'python3 -m pytest -q' on pristine dffd39d and record the failure set. After the change, the same command must show the same failure set (expected none), with T8 the only permitted existing-test edit. 'uv run ruff check src tests' and 'uv run mypy' must both be clean. [verification]
  6. Real servers only cover retirement via the FakeDav fake. Post-merge on the host, with scripts/radicale.sh up and the env set, run 'python3 -m pytest -m radicale tests/test_carddav_radicale.py -q'. All three tests must still pass, including deleted=1 in test_radicale_deletion_tombstones_link_keeps_person. [verification]

Change: vCard part: in sync.run_pass, add an elif source.kind == "vcard" and not source.unreadable branch next to the StatefulSource tombstone loop at sync.py:44-47, using the same loop shape. It reads live links with a new LIVE_LINKS query (SELECT source_record FROM source_links WHERE source = ? AND deleted_at IS NULL) and tombstones every live link whose record the pass did not yield. seen is every yielded record, skipped outcomes included. Detection sits in run_pass and the DB rather than in new source state, so unchanged passes still write nothing (test_fifty_card_import_is_idempotent). The vCard summary line gains deleted=D (sync.py:70-74). Revival already works: the upsert clears deleted_at (graph.py:53-57, 255, 320-325). CardDAV part: add a RETIRE_AFTER_PASSES = 3 constant to carddav.py. In fetch, right after discovered = self._discover() (carddav.py:245) and after old_groups (:242), keep a separate top-level state["absent"] url→count map. A discovered url pops its count. An undiscovered url increments; at N it pops the collection and adds its members' records to removed. The existing remaining/groups/affected tail (:262-287) then handles UIDs still listed in a live collection, group-tag refresh, and a full-listing return. A failed discovery raises before the counters change, and run_pass persists state only on success (sync.py:47, 52-69).

Files: src/peoplemind_mcp/sync.py · src/peoplemind_mcp/sources/carddav.py · tests/test_vcard_sync.py · tests/test_carddav.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-01-vcard-deletion-detection-and-vanished-collection-handling.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-vcard-deletion-detection-and-vanished-collection-handling.md

### ⏸ SVD architect gate: dev/peoplemind-mcp#14 vcard-deletion-detection-and-vanished-collection-handling **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 `standard` · dispatch effort `medium` **Run:** `20261101T081350Z-c70f2c3b` **Held because:** CLEAN but 6 open risk(s) (2 verification · 4 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. Is the retirement rule '3 consecutive successful discovery passes with the collection absent' acceptable, with N as a module constant (RETIRE_AFTER_PASSES = 3) rather than a CardDAVSourceConfig key? At the default interval_seconds = 900 that is about 45 minutes. The issue offered 'N passes or an explicit operator action'; this spec builds only the N-pass rule, and an operator retire verb would be a separate issue. Lean: constant, N=3, no verb. [decision] 2. Should vCard deletion detection be skipped on any pass with unreadable > 0? The lean skips it. That is safe, but one persistently bad card then blocks every deletion for that source, visible only as 'unreadable=N deleted=0'. Second question: should an import set that yields zero records while live links exist also skip detection (unmounted-volume guard)? The lean does not guard it, because tombstones are reversible. [decision] 3. Should a successful discovery that returns zero address books count toward retirement? The lean counts it like any other omission. The risk is that 3 consecutive transient empty listings retire every link (reversible on return). Special-casing zero as suspect would mean deleting every book, or a filter that matches nothing, never retires automatically. [decision] 4. Should the architect record the N-pass rule as an ADR 0004 amendment, following the ADR 0001 Amendment 1 'recorded by the architect' precedent? It is kept out of dispatch scope. [decision] 5. The test baseline was not measured in Half A because the sandbox denied .venv/bin/python. Before the first edit, run 'python3 -m pytest -q' on pristine dffd39d and record the failure set. After the change, the same command must show the same failure set (expected none), with T8 the only permitted existing-test edit. 'uv run ruff check src tests' and 'uv run mypy' must both be clean. [verification] 6. Real servers only cover retirement via the FakeDav fake. Post-merge on the host, with scripts/radicale.sh up and the env set, run 'python3 -m pytest -m radicale tests/test_carddav_radicale.py -q'. All three tests must still pass, including deleted=1 in test_radicale_deletion_tombstones_link_keeps_person. [verification] **Change:** vCard part: in sync.run_pass, add an `elif source.kind == "vcard" and not source.unreadable` branch next to the StatefulSource tombstone loop at sync.py:44-47, using the same loop shape. It reads live links with a new LIVE_LINKS query (`SELECT source_record FROM source_links WHERE source = ? AND deleted_at IS NULL`) and tombstones every live link whose record the pass did not yield. `seen` is every yielded record, skipped outcomes included. Detection sits in run_pass and the DB rather than in new source state, so unchanged passes still write nothing (test_fifty_card_import_is_idempotent). The vCard summary line gains ` deleted=D` (sync.py:70-74). Revival already works: the upsert clears deleted_at (graph.py:53-57, 255, 320-325). CardDAV part: add a RETIRE_AFTER_PASSES = 3 constant to carddav.py. In fetch, right after `discovered = self._discover()` (carddav.py:245) and after old_groups (:242), keep a separate top-level `state["absent"]` url→count map. A discovered url pops its count. An undiscovered url increments; at N it pops the collection and adds its members' records to `removed`. The existing remaining/groups/affected tail (:262-287) then handles UIDs still listed in a live collection, group-tag refresh, and a full-listing return. A failed discovery raises before the counters change, and run_pass persists state only on success (sync.py:47, 52-69). **Files:** `src/peoplemind_mcp/sync.py` · `src/peoplemind_mcp/sources/carddav.py` · `tests/test_vcard_sync.py` · `tests/test_carddav.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-01-vcard-deletion-detection-and-vanished-collection-handling.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-vcard-deletion-detection-and-vanished-collection-handling.md`</sub>
Author
Owner

Architect gate: CLEAN, rulings recorded, released for dispatch

Spec 2026-11-01-vcard-deletion-detection-and-vanished-collection-handling.md (Half-A run 20261101T081350Z-c70f2c3b, batch faebc8b77de84e938c3fd543da6ddf33 with #8). The rulings are appended to the spec under ## Agent Adjustments.

  1. N = 3 consecutive successful discovery passes, as a module constant. No config key, no operator verb. A retire verb is a later issue if anyone asks.
  2. Skip detection when unreadable > 0, and add an empty-import guard. A vCard import that yields zero records while live links exist tombstones nothing and prints deleted=0. This is the vCard analogue of the N-pass rule: an unmounted directory must not tombstone every link on one pass. One new test covers it.
  3. A successful discovery of zero address books counts toward retirement. The three-pass counter is the protection; a wipe revives on return.
  4. The architect records the rule as ADR 0004 Amendment 1 after merge. Out of dispatch scope.
  5. Baseline first; Radicale on the host after merge. The architect runs -m radicale against scripts/radicale.sh as for #5.
  6. Summary line: append deleted=D at the end of the vCard line only. The Radicale tests outside the write set substring-match the existing tokens.

Riders: pytest only as uv run python3 -m pytest … --basetemp "$(mktemp -d "${TMPDIR:-/var/tmp}/svd.XXXXXX")/x" (the spec's bare python3 -m pytest spellings mean this form); no nested .git; pyproject.toml stays untouched; the sibling unit's files (#8: config.py, store.py, rows.py, feed.py, server.py, conftest.py, test_server.py, README.md) stay untouched.

Write set: 4 files. Disjoint from #8.

Operator: paste svd:go to release Half-B. Dispatch runs as codex-svd dispatch-batch with CODEX_SVD_STAGE_TIMEOUT_SECONDS=9000.

## Architect gate: CLEAN, rulings recorded, released for dispatch Spec `2026-11-01-vcard-deletion-detection-and-vanished-collection-handling.md` (Half-A run `20261101T081350Z-c70f2c3b`, batch `faebc8b77de84e938c3fd543da6ddf33` with #8). The rulings are appended to the spec under `## Agent Adjustments`. 1. **N = 3 consecutive successful discovery passes, as a module constant.** No config key, no operator verb. A retire verb is a later issue if anyone asks. 2. **Skip detection when `unreadable > 0`, and add an empty-import guard.** A vCard import that yields zero records while live links exist tombstones nothing and prints `deleted=0`. This is the vCard analogue of the N-pass rule: an unmounted directory must not tombstone every link on one pass. One new test covers it. 3. **A successful discovery of zero address books counts toward retirement.** The three-pass counter is the protection; a wipe revives on return. 4. **The architect records the rule as ADR 0004 Amendment 1 after merge.** Out of dispatch scope. 5. **Baseline first; Radicale on the host after merge.** The architect runs `-m radicale` against `scripts/radicale.sh` as for #5. 6. **Summary line:** append ` deleted=D` at the end of the vCard line only. The Radicale tests outside the write set substring-match the existing tokens. Riders: pytest only as `uv run python3 -m pytest … --basetemp "$(mktemp -d "${TMPDIR:-/var/tmp}/svd.XXXXXX")/x"` (the spec's bare `python3 -m pytest` spellings mean this form); no nested `.git`; `pyproject.toml` stays untouched; the sibling unit's files (#8: `config.py`, `store.py`, `rows.py`, `feed.py`, `server.py`, `conftest.py`, `test_server.py`, `README.md`) stay untouched. Write set: 4 files. Disjoint from #8. Operator: paste `svd:go` to release Half-B. Dispatch runs as `codex-svd dispatch-batch` with `CODEX_SVD_STAGE_TIMEOUT_SECONDS=9000`.
Collaborator

spec-verify-dispatch Half B for dev/peoplemind-mcp#14 vcard-deletion-detection-and-vanished-collection-handling completed integration verify.

  • PR: dev/peoplemind-mcp#18
  • Branch: feat/svd-dev-peoplemind-mcp-14-vcard-deletion-detection-and-v-07336e07
  • Commit: 7c3a167048
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Check forgejo-commit-statuses: absent
  • Checks: Remote checks: none reported on 7c3a167 (absent, non-blocking). Local: 162 passed, 3 skipped; ruff, format and mypy clean.
  • Warning: Remote CI absent: Forgejo reports no commit statuses on 7c3a167.
  • Warning: Spec risk: vCard summary line gains deleted=D; all readers are substring matches.
  • Warning: Spec risk: UID-less vCards edited by name or handle now tombstone the old link and add a new one.
  • Warning: Spec risk: the CardDAV state JSON gains a top-level "absent" key.
  • Warning: no CI for forgejo-commit-statuses: No commit statuses on PR head 7c3a167 (statuses API returned []); no CI run in history for this commit. No tracking pointer found. — reported as absent, not blocking (gh#633)
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261101T084721Z-07336e07 --confirm-merge)
spec-verify-dispatch Half B for dev/peoplemind-mcp#14 vcard-deletion-detection-and-vanished-collection-handling completed integration verify. - PR: https://git.groupthink.asia/dev/peoplemind-mcp/pulls/18 - Branch: feat/svd-dev-peoplemind-mcp-14-vcard-deletion-detection-and-v-07336e07 - Commit: 7c3a167048bfe7e9b44cb1b8da554c76dd4bfd14 - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Check forgejo-commit-statuses: absent - Checks: Remote checks: none reported on 7c3a167 (absent, non-blocking). Local: 162 passed, 3 skipped; ruff, format and mypy clean. - Warning: Remote CI absent: Forgejo reports no commit statuses on 7c3a167. - Warning: Spec risk: vCard summary line gains deleted=D; all readers are substring matches. - Warning: Spec risk: UID-less vCards edited by name or handle now tombstone the old link and add a new one. - Warning: Spec risk: the CardDAV state JSON gains a top-level "absent" key. - Warning: no CI for forgejo-commit-statuses: No commit statuses on PR head 7c3a167 (statuses API returned []); no CI run in history for this commit. No tracking pointer found. — reported as absent, not blocking (gh#633) - Decision: review the PR and merge? (`codex-svd ship --run-id 20261101T084721Z-07336e07 --confirm-merge`)
piers closed this issue 2026-11-01 09:40:11 +00:00
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.

Dependencies

No dependencies set.

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