vCard-only sync runs forever on an interval #25

Closed
opened 2026-11-01 12:20:39 +00:00 by piers · 3 comments
Owner

Parent: #1. Records: ADR 0004.

What to build

peoplemind sync --config … without --once exits 2 with sync without --once needs a carddav or mailmind source (cli.py). A deployment with only vCard Sources therefore has no long-running sync container: /healthz/sync goes stale after api.max_lag_seconds and the embedding worker never runs. The #9 acceptance run works around this with a test-only --once override.

  • Make run_forever loop for vCard Sources too: re-import each configured file or directory on a [[sources]] interval_seconds (default 900, minimum 60, the CardDAV shape), skipping unchanged files by mtime and size so an unchanged pass writes nothing.
  • Drop the refusal in cli.py when every Source is a vCard Source; keep it when there is no Source at all.
  • The embedding worker already starts from run_forever, so it starts for vCard-only deployments once the refusal is gone.

Acceptance criteria

  • sync without --once and only vCard Sources stays up; a changed .vcf is picked up on the next interval and /healthz/sync stays green.
  • An unchanged pass emits no changes rows and no feed events.
  • The #9 integration fixture can drop its --once override.

Blocked by

Filed by the architect at the #9 gate (2026-11-01), Open Risk 2.

Parent: #1. Records: ADR 0004. ## What to build `peoplemind sync --config …` without `--once` exits 2 with `sync without --once needs a carddav or mailmind source` (cli.py). A deployment with only vCard Sources therefore has no long-running `sync` container: `/healthz/sync` goes stale after `api.max_lag_seconds` and the embedding worker never runs. The #9 acceptance run works around this with a test-only `--once` override. - Make `run_forever` loop for vCard Sources too: re-import each configured file or directory on a `[[sources]] interval_seconds` (default 900, minimum 60, the CardDAV shape), skipping unchanged files by mtime and size so an unchanged pass writes nothing. - Drop the refusal in `cli.py` when every Source is a vCard Source; keep it when there is no Source at all. - The embedding worker already starts from `run_forever`, so it starts for vCard-only deployments once the refusal is gone. ## Acceptance criteria - `sync` without `--once` and only vCard Sources stays up; a changed `.vcf` is picked up on the next interval and `/healthz/sync` stays green. - An unchanged pass emits no `changes` rows and no feed events. - The #9 integration fixture can drop its `--once` override. ## Blocked by - #9 Filed by the architect at the #9 gate (2026-11-01), Open Risk 2.
Collaborator

⏸ SVD architect gate: dev/peoplemind-mcp#25 vcard-only-sync-runs-forever-on-an-interval

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: 20261101T205319Z-9b084172

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

Open risks:

  1. The integration acceptance criterion can only be proven on a host with podman or docker. After the PR is built, run make test-integration on the host. Expect test_compose_up_health_green_with_vcard_fixture and test_litestream_restore_passes_check to pass with the sync override removed, and compose ps during the run to show sync as running, not exited. If the dispatch worktree has no engine, the PR must say 'integration deferred'. [verification]
  2. Should the vCard interval_seconds key and the rule 'skip unchanged files by mtime and size but keep the full snapshot' be recorded as an ADR 0004 amendment? The precedent is Amendment 1, recorded by the architect in a separate docs PR after #18. This spec writes no ADR. File a follow-up docs issue, or treat the README line as enough? [decision]
  3. The issue says an unchanged pass 'writes nothing', but its acceptance criterion names only changes rows and feed events. This spec keeps the per-pass sync_log row, because without it /healthz/sync goes stale (views.py:239-246), which contradicts the issue's 'stays green' criterion. Confirm that reading, or require heartbeat-only sync_log rows to be pruned (which would widen scope)? [decision]

Change: 1. config.py: add interval_seconds: int = Field(default=900, ge=60) to VCardSourceConfig (config.py:113-116), copied from CardDAVSourceConfig (config.py:127).
2. vcard.py: give VCardSource._cards (vcard.py:124-156) an in-memory per-file cache keyed by Path and holding (st_mtime_ns, st_size, parsed cards, block_unreadable).

  • stat each file before reading it.
  • On a cache hit, extend from the cached cards and re-add the cached unreadable count.
  • Do not cache read failures.
  • Evict entries for vanished paths.
  • Count an OSError from rglob as unreadable.
  • Cached records are still yielded. That keeps the full snapshot that cross-file group resolution (vcard.py:160-177) and ADR 0004 Amendment 1 §4 deletion detection (sync.py:50-55) depend on. ingest_record's record-hash check (graph.py:259-268) then makes an unchanged pass write no changes rows.
  1. sync.py run_forever: keep the boot vCard pass and its VCardSource instances. Widen the remote worker (sync.py:119-136, the pattern to mirror) to accept an optional prebuilt source. A prebuilt source waits its interval first. Start one sync-<name> thread per vCard Source alongside the carddav, mailmind and embed threads.
  2. cli.py:136-138: refuse only when not cfg.sources, printing 'Error: sync without --once needs a source'.
  3. test_deploy.py:208-212: drop the sync --once / restart "no" override.
  4. README.md:95: replace the #25 caveat sentence.

Files: src/peoplemind_mcp/config.py · src/peoplemind_mcp/sources/vcard.py · src/peoplemind_mcp/sync.py · src/peoplemind_mcp/cli.py · tests/test_vcard_sync.py · tests/test_config_cli.py · tests/test_carddav.py · tests/test_mailmind.py · tests/test_deploy.py · README.md

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-01-vcard-only-sync-runs-forever-on-an-interval.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-vcard-only-sync-runs-forever-on-an-interval.md

### ⏸ SVD architect gate: dev/peoplemind-mcp#25 vcard-only-sync-runs-forever-on-an-interval **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:** `20261101T205319Z-9b084172` **Held because:** CLEAN but 3 open risk(s) (1 verification · 2 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. The integration acceptance criterion can only be proven on a host with podman or docker. After the PR is built, run `make test-integration` on the host. Expect test_compose_up_health_green_with_vcard_fixture and test_litestream_restore_passes_check to pass with the sync override removed, and `compose ps` during the run to show sync as running, not exited. If the dispatch worktree has no engine, the PR must say 'integration deferred'. [verification] 2. Should the vCard interval_seconds key and the rule 'skip unchanged files by mtime and size but keep the full snapshot' be recorded as an ADR 0004 amendment? The precedent is Amendment 1, recorded by the architect in a separate docs PR after #18. This spec writes no ADR. File a follow-up docs issue, or treat the README line as enough? [decision] 3. The issue says an unchanged pass 'writes nothing', but its acceptance criterion names only changes rows and feed events. This spec keeps the per-pass sync_log row, because without it /healthz/sync goes stale (views.py:239-246), which contradicts the issue's 'stays green' criterion. Confirm that reading, or require heartbeat-only sync_log rows to be pruned (which would widen scope)? [decision] **Change:** 1. config.py: add `interval_seconds: int = Field(default=900, ge=60)` to VCardSourceConfig (config.py:113-116), copied from CardDAVSourceConfig (config.py:127). 2. vcard.py: give VCardSource._cards (vcard.py:124-156) an in-memory per-file cache keyed by Path and holding (st_mtime_ns, st_size, parsed cards, block_unreadable). - stat each file before reading it. - On a cache hit, extend from the cached cards and re-add the cached unreadable count. - Do not cache read failures. - Evict entries for vanished paths. - Count an OSError from rglob as unreadable. - Cached records are still yielded. That keeps the full snapshot that cross-file group resolution (vcard.py:160-177) and ADR 0004 Amendment 1 §4 deletion detection (sync.py:50-55) depend on. ingest_record's record-hash check (graph.py:259-268) then makes an unchanged pass write no changes rows. 3. sync.py run_forever: keep the boot vCard pass and its VCardSource instances. Widen the remote `worker` (sync.py:119-136, the pattern to mirror) to accept an optional prebuilt source. A prebuilt source waits its interval first. Start one `sync-<name>` thread per vCard Source alongside the carddav, mailmind and embed threads. 4. cli.py:136-138: refuse only when `not cfg.sources`, printing 'Error: sync without --once needs a source'. 5. test_deploy.py:208-212: drop the sync --once / restart "no" override. 6. README.md:95: replace the #25 caveat sentence. **Files:** `src/peoplemind_mcp/config.py` · `src/peoplemind_mcp/sources/vcard.py` · `src/peoplemind_mcp/sync.py` · `src/peoplemind_mcp/cli.py` · `tests/test_vcard_sync.py` · `tests/test_config_cli.py` · `tests/test_carddav.py` · `tests/test_mailmind.py` · `tests/test_deploy.py` · `README.md` **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-01-vcard-only-sync-runs-forever-on-an-interval.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-vcard-only-sync-runs-forever-on-an-interval.md`</sub>
Author
Owner

Architect gate: CLEAN, approved for dispatch (2026-11-02)

Half-A run 20261101T205319Z-9b084172 on main 1ffffcb: verdict CLEAN, 0 blocking defects, no degraded or inconclusive lenses, complexity standard. Approved spec: 2026-11-01-vcard-only-sync-runs-forever-on-an-interval.md in the exhaust worktree, with eight Agent Adjustments.

Shape. VCardSourceConfig gains interval_seconds (default 900, minimum 60, the CardDAV line). VCardSource caches parsed cards per file by (st_mtime_ns, st_size) so an unchanged pass does only stat, while every file's cards still enter the snapshot so Amendment 1 deletion detection keeps working. run_forever starts one worker per vCard Source (reusing the boot instance, wait first). cli.py refuses only with zero Sources. The #9 fixture drops its --once override.

Open risks ruled:

  1. Integration: the architect runs make test-integration under podman on a scratch worktree before merge, and checks the sync container stays running.
  2. ADR 0004 amendment: not in this slice; the architect records Amendment 2 in a docs PR after merge, as for Amendment 1.
  3. One sync_log row per vCard pass is kept so /healthz/sync stays green; "writes nothing" means no changes rows and no feed events.

Host baseline pasted (fast lane 151 passed, 2 skipped; static suite 252 passed). tests/test_embed.py joins the write set only if its run_forever test races.

Operator: paste svd:go to release Half-B.

## Architect gate: CLEAN, approved for dispatch (2026-11-02) Half-A run `20261101T205319Z-9b084172` on main 1ffffcb: verdict CLEAN, 0 blocking defects, no degraded or inconclusive lenses, complexity standard. Approved spec: `2026-11-01-vcard-only-sync-runs-forever-on-an-interval.md` in the exhaust worktree, with eight Agent Adjustments. **Shape.** `VCardSourceConfig` gains `interval_seconds` (default 900, minimum 60, the CardDAV line). `VCardSource` caches parsed cards per file by `(st_mtime_ns, st_size)` so an unchanged pass does only `stat`, while every file's cards still enter the snapshot so Amendment 1 deletion detection keeps working. `run_forever` starts one worker per vCard Source (reusing the boot instance, wait first). `cli.py` refuses only with zero Sources. The #9 fixture drops its `--once` override. **Open risks ruled:** 1. Integration: the architect runs `make test-integration` under podman on a scratch worktree before merge, and checks the `sync` container stays running. 2. ADR 0004 amendment: not in this slice; the architect records Amendment 2 in a docs PR after merge, as for Amendment 1. 3. One `sync_log` row per vCard pass is kept so `/healthz/sync` stays green; "writes nothing" means no `changes` rows and no feed events. Host baseline pasted (fast lane 151 passed, 2 skipped; static suite 252 passed). `tests/test_embed.py` joins the write set only if its `run_forever` test races. Operator: paste `svd:go` to release Half-B.
Collaborator

spec-verify-dispatch Half B for dev/peoplemind-mcp#25 vcard-only-sync-runs-forever-on-an-interval completed integration verify.

  • PR: dev/peoplemind-mcp#27
  • Branch: feat/svd-dev-peoplemind-mcp-25-vcard-only-sync-runs-forever-o-63b362b7
  • Commit: 60114e3309
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Check forgejo commit statuses on PR head 60114e3: absent
  • Checks: PR #27 head 60114e3: Forgejo commit statuses empty (absent, no CI history). Local: ruff, ruff format and mypy clean; 258 passed, 5 skipped, 4 deselected. Integration deferred to a container host.
  • Warning: Integration deferred: test_compose_up_health_green_with_vcard_fixture and test_litestream_restore_passes_check need make test-integration on a host with a container engine (Open Risk 1). The static deployment tests passed.
  • Warning: No remote CI statuses exist on the PR head, so there is no remote integration evidence.
  • Warning: The spec names the zero-source message as 'Error: sync without --once needs a source'. The test test_sync_without_sources_exits_2 passes; the verifier did not independently diff the exact string.
  • Warning: no CI for forgejo commit statuses on PR head 60114e3: The commit statuses endpoint for 60114e3 returned [] (authenticated read); no required check has any run in its history. No tracking pointer exists for this repo. — reported as absent, not blocking (gh#633)
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261101T210627Z-63b362b7 --confirm-merge)
spec-verify-dispatch Half B for dev/peoplemind-mcp#25 vcard-only-sync-runs-forever-on-an-interval completed integration verify. - PR: https://git.groupthink.asia/dev/peoplemind-mcp/pulls/27 - Branch: feat/svd-dev-peoplemind-mcp-25-vcard-only-sync-runs-forever-o-63b362b7 - Commit: 60114e3309465b9a4986cd4b78a36ed6663d6b4a - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Check forgejo commit statuses on PR head 60114e3: absent - Checks: PR #27 head 60114e3: Forgejo commit statuses empty (absent, no CI history). Local: ruff, ruff format and mypy clean; 258 passed, 5 skipped, 4 deselected. Integration deferred to a container host. - Warning: Integration deferred: test_compose_up_health_green_with_vcard_fixture and test_litestream_restore_passes_check need make test-integration on a host with a container engine (Open Risk 1). The static deployment tests passed. - Warning: No remote CI statuses exist on the PR head, so there is no remote integration evidence. - Warning: The spec names the zero-source message as 'Error: sync without --once needs a source'. The test test_sync_without_sources_exits_2 passes; the verifier did not independently diff the exact string. - Warning: no CI for forgejo commit statuses on PR head 60114e3: The commit statuses endpoint for 60114e3 returned [] (authenticated read); no required check has any run in its history. No tracking pointer exists for this repo. — reported as absent, not blocking (gh#633) - Decision: review the PR and merge? (`codex-svd ship --run-id 20261101T210627Z-63b362b7 --confirm-merge`)
piers closed this issue 2026-11-01 21:12:54 +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#25
No description provided.