CardDAV Source with sync-token delta and a Radicale integration test #5
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/people-mind-mcp#5
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?
Parent: #1. Records: ADR 0004.
What to build
The Source that frees peoplemind from the Mac. One CardDAV account per config block, read-only credential in a file, with a separate optional write-back credential file left unused in Phase A.
Acceptance criteria
Blocked by
Filed under: operator word "go. compelling public-facing README.md as A0" sha256:3f9e946994fa
⏸ SVD architect gate: dev/peoplemind-mcp#5 carddav-source-with-sync-token-delta-and-a-radicale-integrat
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:
20261101T031042Z-b474b03fHeld because: CLEAN but 8 open risk(s) (2 verification · 6 decision) — HOLD-ALL parks everything. The risks, verbatim:
Open risks:
usernamein config, and only the password or app password in credential_file. The README's provisional block names only url and credential_file, and for iCloud and Fastmail the username is the account email (PII in config, never logged). Question: keep username in config, or put username:password in one credential file? [decision]syncwithout --once. Lean: run vCard sources once at startup, then one thread per CardDAV source on interval_seconds; with no CardDAV source, exit 2 with 'Error: sync without --once needs a carddav source'. This replaces today's 'only --once is supported' refusal and its test. Question: accept, or also give vCard sources an interval and loop them (widens VCardSourceConfig beyond the issue text)? [decision]# noqa: S314(CPython expat ≥2.4.1 rejects entity-expansion blowups; ElementTree does not fetch external entities), adding no dependency. Alternative: add defusedxml, a new locked dependency that needs network for uv lock. Question: accept the stdlib lean? [decision]uv lockmust resolve in the dispatch worktree (httpx 0.28.1 is already locked transitively). Check:uv lock --checkpasses, andgit diff --stat uv.lockshows only the peoplemind-mcp package block changed. [verification]Change: Add CardDAVSource in sources/carddav.py, shaped like VCardSource (sources/vcard.py:116-179). It reuses vcard.py's _parse/_record/_kind/_values/_first/_uid (37-113) unchanged and uses httpx with follow_redirects=False. It does manual discovery (current-user-principal → addressbook-home-set → Depth:1 addressbook collections, with an optional addressbooks filter). Each pass runs an RFC 6578 sync-collection REPORT for getetag, then addressbook-multiget in batches of 100. A token rejection (409/410/412, or 403 with valid-sync-token) triggers one full fetch, and full-fetch deletions are computed from a per-source JSON state blob (token, href→record map, group map). A group change refetches only the affected members. All network I/O finishes before the store transaction opens. A new sync.run_pass, moved from cli._sync (cli.py:44-62), applies ingest_record, a new graph.tombstone_link (sets source_links.deleted_at and emits an 'update' change; the Person and its rows stay) and the source_state upsert in one transaction. Additive migration 2 (store.py:20-70) adds source_links.deleted_at and a source_state table. ingest_record (graph.py:242-250, 309-320) revives a tombstoned link. CardDAVSourceConfig joins the config union (config.py:60-81) with url (https, or loopback http), username, credential_file, an unused write_credential_file, addressbooks and interval_seconds≥60. cli makes the path check vCard-only, checks the credential file, and in non---once mode runs one thread per CardDAV source, each with its own writer connection. scripts/radicale.sh up/down starts Radicale in a container. The Radicale tests skip unless PEOPLEMIND_RADICALE_URL is set. httpx and httpcore loggers are pinned to WARNING.
Files:
src/peoplemind_mcp/sources/carddav.py·src/peoplemind_mcp/sync.py·src/peoplemind_mcp/sources/__init__.py·src/peoplemind_mcp/config.py·src/peoplemind_mcp/store.py·src/peoplemind_mcp/graph.py·src/peoplemind_mcp/cli.py·pyproject.toml·uv.lock·scripts/radicale.sh·tests/conftest.py·tests/test_carddav.py·tests/test_carddav_radicale.py·tests/test_config_cli.py·tests/test_identity.pyDerived artifacts:
uv.lockDecision: accept the 8 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-01-carddav-source-with-sync-token-delta-and-a-radicale-integrat.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-carddav-source-with-sync-token-delta-and-a-radicale-integrat.mdArchitect gate, 2026-11-01. Half-A on this issue returned CLEAN (batch 2ea1fb72b7224dc392e1f77559e88868), but the spec collides with the #4 spec: both set the store schema to version 2 with different migrations and both rewrite the sync loop in
cli.py. #4 dispatches first. This issue is held and re-specced with/svd dev/peoplemind-mcp#5after #4 merges. The rulings below bind that re-spec.Sequencing: migration 3, not 2 (
source_links.deleted_at,source_state).sync.run_passtakes over the per-source loop fromcli._syncincluding thesync_loginsert #4 adds there.source_links.deleted_atonly; the Person keeps the record's names, asserted fields, Tags and Handles.usernamelives in the[[sources]]block; only the password or app password incredential_file, as mailmind'sAccountConfig.username.syncwithout--once: vCard sources once at startup, one thread per CardDAV source oninterval_seconds, exit 2 when no CardDAV source is configured. vCard sources get no interval.PEOPLEMIND_RADICALE_URL; a host run pasted into the PR is required, and the architect repeats it before merge. CI is a separate architect follow-up.defusedxml(>=0.7,<1, mypy override as mailmind), notElementTreewithnoqa: S314.uv lock --checkat dispatch.⏸ SVD architect gate: dev/peoplemind-mcp#5 carddav-source-with-sync-token-delta-and-a-radicale-integrat
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:
20261101T035937Z-2154d00eHeld because: CLEAN but 2 open risk(s) (2 verification) — HOLD-ALL parks everything. The risks, verbatim:
Open risks:
3c252f7(grep 'name = "defusedxml"' uv.lock finds nothing), so the prior 'already locked, no new download' premise is false. Check in the dispatch worktree: uv lock succeeds, uv lock --check passes, and git diff uv.lock shows only the peoplemind-mcp block gaining defusedxml and httpx plus one new defusedxml package block (expected 0.7.1). [verification]Change: Re-spec on post-#4 main (
3c252f7), bound by gate rulings R1-R8. CardDAVSource in sources/carddav.py follows the shape of VCardSource (sources/vcard.py:116-179) and reuses the vcard.py helpers at 37-113 unchanged. It uses httpx (follow_redirects=False, httpx/httpcore loggers pinned to WARNING as server.py:175-176 does) and defusedxml.ElementTree.fromstring (R6). It does manual discovery, then an RFC 6578 sync-collection REPORT and addressbook-multiget in batches of 100, with one full fetch when the token is rejected (409/410/412, or 403 with valid-sync-token). Its state blob holds token, href→record and group map; the state of a vanished collection is left untouched (R5→#14). New sync.run_pass takes the per-source loop from cli._sync (cli.py:53-87), including #4's sync_log success and failure rows (cli.py:69-82). It fetches outside the transaction, then commits ingest_record, the new graph.tombstone_link (sets deleted_at only, emits an 'update' change; R1), the source_state upsert and the sync_log row in one transaction. On failure it writes a sync_log row with code SourceError.code or sync-failed. Additive migration 3 (store.py:20, appended after 70-75) adds source_links.deleted_at and a source_state table. ingest_record (graph.py:79, 246-250, 309-320) revives a tombstoned link. CardDAVSourceConfig joins the union (config.py:94-117) with fields url (https, or loopback-only http), username (R2), credential_file, an unused write_credential_file, addressbooks and interval_seconds≥60. cli makes the path check vCard-only and reads the CardDAV credential file. Without --once, cli runs vCard sources once and then one thread per CardDAV source, and exits 2 if no CardDAV source is configured (R3). scripts/radicale.sh up/down manages the container, and the Radicale tests skip without PEOPLEMIND_RADICALE_URL (R4).Files:
src/peoplemind_mcp/sources/carddav.py·src/peoplemind_mcp/sync.py·src/peoplemind_mcp/sources/__init__.py·src/peoplemind_mcp/config.py·src/peoplemind_mcp/store.py·src/peoplemind_mcp/graph.py·src/peoplemind_mcp/cli.py·pyproject.toml·uv.lock·scripts/radicale.sh·tests/conftest.py·tests/test_carddav.py·tests/test_carddav_radicale.py·tests/test_config_cli.py·tests/test_identity.pyDerived artifacts:
uv.lockDecision: accept the 2 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-01-carddav-source-with-sync-token-delta-and-a-radicale-integrat.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-carddav-source-with-sync-token-delta-and-a-radicale-integrat.mdArchitect gate on the re-spec, 2026-11-01 04:10Z (run
20261101T035937Z-2154d00e, base3c252f7).The spec honours rulings 1 to 8 from the comment above: migration 3 (
source_links.deleted_at,source_state),sync.run_passcarries thesync_loginsert,deleted_atonly,usernamein[[sources]],defusedxml, Radicale tests skip withoutPEOPLEMIND_RADICALE_URL. It also found thattests/test_identity.py:396hard-codesuser_version == 2and amends it.Both open risks are verification-class and keep their checks: the architect runs
scripts/radicale.sh upand the-m radicaletests on the host before merge, anduv lockruns in the dispatch worktree becausedefusedxmlis not yet locked. Riders are appended to the spec as Agent Adjustments. Released forsvd:go.Spec Amendment 1, 2026-11-01 04:25Z. The first dispatch (run
20261101T041547Z-669961c2) stopped with no commit:tests/test_server.py:275and:369readcfg.sources[0].path, which failsmypy --strictonceConfig.sourcesis a union. Verified at3c252f7. The file joins the write set for two type-narrowing edits (16 files, at the ceiling). Dispatch re-fired on the amended spec.spec-verify-dispatch Half B for dev/peoplemind-mcp#5 carddav-source-with-sync-token-delta-and-a-radicale-integrat completed integration verify.
db5047d8ebdb5047d: no Forgejo commit statuses (absent). Local: 153 passed, 3 skipped (Radicale); mypy --strict, ruff check/format, uv lock --check clean.db5047d; remote CI evidence is absent.db5047dhas no commit statuses on Forgejo (empty list); no CI run in history. No tracking pointer found. — reported as absent, not blocking (gh#633)codex-svd ship --run-id 20261101T041917Z-55f25c8a --confirm-merge)