CardDAV multiget sends absolute hrefs; iCloud answers 400 #34

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

Problem

Against live iCloud (contacts.icloud.com, 1,351 cards) the first CardDAV pass fails with code=carddav-protocol. Discovery and the sync-collection REPORT succeed (207). The first addressbook-multiget REPORT returns 400 with an 11-byte body.

_listing resolves every member href with urljoin(str(response.url), …), so the hrefs it returns are absolute URLs (https://p140-contacts.icloud.com/<dsid>/carddavhome/card/<uid>.vcf). _multiget writes those absolute URLs into the <D:href> elements of the multiget body. iCloud rejects that; it accepts path-only hrefs.

Measured from the sync container on 2026-11-02 (statuses only, no card data):

hrefs Depth href form result
1 1 absolute 400
1 1 path 207, 1 address-data
1 0 absolute 400
1 0 path 207, 1 address-data
100 1 absolute 400
100 1 path 207, 100 address-data
100 0 absolute 400
100 0 path 207, 100 address-data

Radicale accepts both forms, which is why tests/test_carddav_radicale.py passes. Fastmail was not reachable for comparison in the same run (credential issue, separate).

Fix

In CardDAVSource._multiget, write urlsplit(href).path into each <D:href> while keeping the absolute href as the dictionary key, so cards[href] and the caller's changed/deleted sets are unchanged. Match the server's response hrefs by urljoin as today (the response may come back either way).

Keep the chunk size at 100 and the Depth header as is: both passed on iCloud.

Acceptance

  • A unit test with a recording transport asserts every <D:href> in a multiget body is a path (no scheme, no host) when the listing hrefs are absolute.
  • tests/test_carddav_radicale.py still passes.
  • The live iCloud pass on the gate instance logs status=ok for source=icloud (recorded on #10, not in CI).

Primary files

  • src/people_mind_mcp/sources/carddav.py (_multiget)
  • tests/test_carddav.py

Blocked by

None.

## Problem Against live iCloud (`contacts.icloud.com`, 1,351 cards) the first CardDAV pass fails with `code=carddav-protocol`. Discovery and the `sync-collection` REPORT succeed (207). The first `addressbook-multiget` REPORT returns `400` with an 11-byte body. `_listing` resolves every member `href` with `urljoin(str(response.url), …)`, so the hrefs it returns are absolute URLs (`https://p140-contacts.icloud.com/<dsid>/carddavhome/card/<uid>.vcf`). `_multiget` writes those absolute URLs into the `<D:href>` elements of the multiget body. iCloud rejects that; it accepts path-only hrefs. Measured from the sync container on 2026-11-02 (statuses only, no card data): | hrefs | Depth | href form | result | |---|---|---|---| | 1 | 1 | absolute | 400 | | 1 | 1 | path | 207, 1 address-data | | 1 | 0 | absolute | 400 | | 1 | 0 | path | 207, 1 address-data | | 100 | 1 | absolute | 400 | | 100 | 1 | path | 207, 100 address-data | | 100 | 0 | absolute | 400 | | 100 | 0 | path | 207, 100 address-data | Radicale accepts both forms, which is why `tests/test_carddav_radicale.py` passes. Fastmail was not reachable for comparison in the same run (credential issue, separate). ## Fix In `CardDAVSource._multiget`, write `urlsplit(href).path` into each `<D:href>` while keeping the absolute href as the dictionary key, so `cards[href]` and the caller's `changed`/`deleted` sets are unchanged. Match the server's response hrefs by `urljoin` as today (the response may come back either way). Keep the chunk size at 100 and the Depth header as is: both passed on iCloud. ## Acceptance - A unit test with a recording transport asserts every `<D:href>` in a multiget body is a path (no scheme, no host) when the listing hrefs are absolute. - `tests/test_carddav_radicale.py` still passes. - The live iCloud pass on the gate instance logs `status=ok` for `source=icloud` (recorded on #10, not in CI). ## Primary files - `src/people_mind_mcp/sources/carddav.py` (`_multiget`) - `tests/test_carddav.py` ## Blocked by None.
Collaborator

⏸ SVD architect gate: dev/people-mind-mcp#34 carddav-multiget-sends-absolute-hrefs-icloud-answers-400

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: 20261102T022451Z-f01495d4

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

Open risks:

  1. The live iCloud acceptance item can only be checked after merge. After deploying to the gate instance, run a CardDAV sync pass against contacts.icloud.com. Confirm the source=icloud log line shows status=ok and that no code=carddav-protocol appears, then record it on dev/people-mind-mcp#10. [verification]
  2. tests/test_carddav_radicale.py is skipped unless scripts/radicale.sh up is running on the host, so make check passing does not prove the 'Radicale still passes' item. On the host, run eval "$(scripts/radicale.sh up)" && uv run python3 -m pytest tests/test_carddav_radicale.py -rs, confirm 3 passed and 0 skipped, and quote the summary line in the PR. [verification]

Change: In CardDAVSource._multiget (src/people_mind_mcp/sources/carddav.py:204), write urlsplit(href).path into each <D:href>. This mirrors the existing urlsplit(url).path idiom at carddav.py:149. urlsplit is already imported at line 8. Leave the chunk size of 100, the Depth "1" header, and the line-207 urljoin response matching unchanged, so the keys stay absolute for both fetch call sites (lines 269 and 283). In tests/test_carddav.py, change the FakeDav multiget branch (lines 134-147) to behave like iCloud: return 400 b"Bad Request" when a body href has a scheme or host; otherwise look the card up with urljoin(url, text); echo the path form back, or the absolute form when the new absolute_multiget_responses flag is set. Add test_multiget_sends_path_hrefs_for_absolute_listing_hrefs, parametrized on that flag and modelled on the recording-transport shape of test_rejected_full_listing_is_not_retried (lines 810-831). It puts 150 cards and asserts chunk sizes [100, 50], that every recorded href has no scheme or host, that fetched == 150, and that member keys stay absolute.

Files: src/people_mind_mcp/sources/carddav.py · tests/test_carddav.py

Decision: 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):

  • 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-02-carddav-multiget-sends-absolute-hrefs-icloud-answers-400.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-02-carddav-multiget-sends-absolute-hrefs-icloud-answers-400.md

### ⏸ SVD architect gate: dev/people-mind-mcp#34 carddav-multiget-sends-absolute-hrefs-icloud-answers-400 **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:** `20261102T022451Z-f01495d4` **Held because:** CLEAN but 2 open risk(s) (2 verification) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. The live iCloud acceptance item can only be checked after merge. After deploying to the gate instance, run a CardDAV sync pass against contacts.icloud.com. Confirm the source=icloud log line shows status=ok and that no code=carddav-protocol appears, then record it on dev/people-mind-mcp#10. [verification] 2. tests/test_carddav_radicale.py is skipped unless scripts/radicale.sh up is running on the host, so make check passing does not prove the 'Radicale still passes' item. On the host, run `eval "$(scripts/radicale.sh up)" && uv run python3 -m pytest tests/test_carddav_radicale.py -rs`, confirm 3 passed and 0 skipped, and quote the summary line in the PR. [verification] **Change:** In CardDAVSource._multiget (src/people_mind_mcp/sources/carddav.py:204), write `urlsplit(href).path` into each <D:href>. This mirrors the existing `urlsplit(url).path` idiom at carddav.py:149. urlsplit is already imported at line 8. Leave the chunk size of 100, the Depth "1" header, and the line-207 urljoin response matching unchanged, so the keys stay absolute for both fetch call sites (lines 269 and 283). In tests/test_carddav.py, change the FakeDav multiget branch (lines 134-147) to behave like iCloud: return 400 b"Bad Request" when a body href has a scheme or host; otherwise look the card up with urljoin(url, text); echo the path form back, or the absolute form when the new absolute_multiget_responses flag is set. Add test_multiget_sends_path_hrefs_for_absolute_listing_hrefs, parametrized on that flag and modelled on the recording-transport shape of test_rejected_full_listing_is_not_retried (lines 810-831). It puts 150 cards and asserts chunk sizes [100, 50], that every recorded href has no scheme or host, that fetched == 150, and that member keys stay absolute. **Files:** `src/people_mind_mcp/sources/carddav.py` · `tests/test_carddav.py` **Decision:** 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`): - 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-02-carddav-multiget-sends-absolute-hrefs-icloud-answers-400.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-02-carddav-multiget-sends-absolute-hrefs-icloud-answers-400.md`</sub>
Author
Owner

Architect gate (Half-A CLEAN)

Spec: specs/2026-11-02-carddav-multiget-sends-absolute-hrefs-icloud-answers-400.md (exhaust worktree, gate adjustments appended).

Lean kept. One-line fix in _multiget: send urlsplit(href).path in each <D:href>; _listing keeps resolving absolute. FakeDav becomes iCloud-strict (400 on a scheme or host href) so the existing suite would have caught this. New parametrised test test_multiget_sends_path_hrefs_for_absolute_listing_hrefs[False|True].

Host baselines at 2224edd: tests/test_carddav.py 57 passed. Radicale host suite 3 passed. Dispatch records its own pristine-base run.

Open risks ruled: live iCloud pass is post-merge, recorded on #10 by the architect. Radicale is run by the architect on the scratch worktree at the PR gate, never claimed by the agent.

Riders: basetemp on every pytest command, python3 -m pytest, no nested .git, no .agents/.codex/.git paths written.

Operator: paste svd:go to release Half-B (batched with #35).

## Architect gate (Half-A CLEAN) Spec: `specs/2026-11-02-carddav-multiget-sends-absolute-hrefs-icloud-answers-400.md` (exhaust worktree, gate adjustments appended). **Lean kept.** One-line fix in `_multiget`: send `urlsplit(href).path` in each `<D:href>`; `_listing` keeps resolving absolute. `FakeDav` becomes iCloud-strict (400 on a scheme or host href) so the existing suite would have caught this. New parametrised test `test_multiget_sends_path_hrefs_for_absolute_listing_hrefs[False|True]`. **Host baselines at 2224edd:** `tests/test_carddav.py` 57 passed. Radicale host suite 3 passed. Dispatch records its own pristine-base run. **Open risks ruled:** live iCloud pass is post-merge, recorded on #10 by the architect. Radicale is run by the architect on the scratch worktree at the PR gate, never claimed by the agent. **Riders:** basetemp on every pytest command, `python3 -m pytest`, no nested `.git`, no `.agents`/`.codex`/`.git` paths written. Operator: paste `svd:go` to release Half-B (batched with #35).
Collaborator

spec-verify-dispatch Half B for dev/people-mind-mcp#34 carddav-multiget-sends-absolute-hrefs-icloud-answers-400 completed integration verify.

  • PR: #37
  • Branch: feat/svd-dev-people-mind-mcp-34-carddav-multiget-sends-absolu-af825f52
  • Commit: e21251ca17
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Check commit-statuses: absent
  • Checks: PR #37 head e21251c: no remote CI statuses (absent). Local: ruff check, ruff format --check and mypy clean; tests/test_carddav.py 59 passed. Both new multiget tests collect.
  • Warning: Radicale suite (tests/test_carddav_radicale.py, 3 tests) was not run here; the architect runs it at the PR gate and must confirm 3 passed, 0 skipped.
  • Warning: Live iCloud verification (status=ok for source=icloud) is post-merge operator work, recorded on dev/people-mind-mcp#10.
  • Warning: No remote CI statuses exist on the PR head; Forgejo statuses API returned an empty list.
  • Warning: no CI for commit-statuses: No commit statuses on PR head e21251c (Forgejo statuses API returned []); repo has no CI directory per spec. No tracking pointer found. — reported as absent, not blocking (gh#633)
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261102T032335Z-af825f52 --confirm-merge)
spec-verify-dispatch Half B for dev/people-mind-mcp#34 carddav-multiget-sends-absolute-hrefs-icloud-answers-400 completed integration verify. - PR: https://git.groupthink.asia/dev/people-mind-mcp/pulls/37 - Branch: feat/svd-dev-people-mind-mcp-34-carddav-multiget-sends-absolu-af825f52 - Commit: e21251ca17c9db7ee20a6c72028d64b34f7fa0c5 - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Check commit-statuses: absent - Checks: PR #37 head e21251c: no remote CI statuses (absent). Local: ruff check, ruff format --check and mypy clean; tests/test_carddav.py 59 passed. Both new multiget tests collect. - Warning: Radicale suite (tests/test_carddav_radicale.py, 3 tests) was not run here; the architect runs it at the PR gate and must confirm 3 passed, 0 skipped. - Warning: Live iCloud verification (status=ok for source=icloud) is post-merge operator work, recorded on dev/people-mind-mcp#10. - Warning: No remote CI statuses exist on the PR head; Forgejo statuses API returned an empty list. - Warning: no CI for commit-statuses: No commit statuses on PR head e21251c (Forgejo statuses API returned []); repo has no CI directory per spec. No tracking pointer found. — reported as absent, not blocking (gh#633) - Decision: review the PR and merge? (`codex-svd ship --run-id 20261102T032335Z-af825f52 --confirm-merge`)
piers closed this issue 2026-11-02 04:02:00 +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#34
No description provided.