feat(api): implement sync collection reconciliation #93

Merged
yuris merged 10 commits from feat/issue-88-sync into main 2026-09-23 11:47:19 +00:00
Owner

Implements the real RFC 6578 sync collection route for issue #88.

Changes:

  • adds POST /v1/sync and the life sync CLI transport
  • persists sync state by collection and generation
  • applies observed baselines and atomic projection reconciliation
  • preserves removals, per-resource failures, resumable cursor progress, and operation replay
  • validates href scope, ETags, XML responses, unsupported resources, and CalDAV status classes
  • preserves backend authentication failures as unauthenticated responses while keeping local URL security refusals forbidden
  • serializes same-collection syncs within the process and relies on the service data-directory lock across processes
  • updates the life skill command reference

Verification at head 5d8182e:

  • cargo fmt --check
  • cargo check
  • cargo clippy --all-targets -- -D warnings
  • cargo test --all-targets: all tests passed, including 22 sync tests and 13 CalDAV report tests

Independent review at head 5d8182e found no remaining patch-introduced P1 or P2 defects. Review findings and resolutions are recorded in comments 4583, 4585, 4586, and 4588.

Closes #88

Implements the real RFC 6578 sync collection route for issue #88. Changes: - adds POST /v1/sync and the life sync CLI transport - persists sync state by collection and generation - applies observed baselines and atomic projection reconciliation - preserves removals, per-resource failures, resumable cursor progress, and operation replay - validates href scope, ETags, XML responses, unsupported resources, and CalDAV status classes - preserves backend authentication failures as unauthenticated responses while keeping local URL security refusals forbidden - serializes same-collection syncs within the process and relies on the service data-directory lock across processes - updates the life skill command reference Verification at head 5d8182e: - cargo fmt --check - cargo check - cargo clippy --all-targets -- -D warnings - cargo test --all-targets: all tests passed, including 22 sync tests and 13 CalDAV report tests Independent review at head 5d8182e found no remaining patch-introduced P1 or P2 defects. Review findings and resolutions are recorded in comments 4583, 4585, 4586, and 4588. Closes #88
Author
Owner

Independent review of head 360da17 found three issues requiring changes before merge:

  1. P2: CalDavClient.send turns upstream HTTP 401 from discovery and resource GET into SecurityViolation, and sync maps that to forbidden/403. Preserve unauthenticated/401 for upstream credential rejection while keeping local URL and redirect security failures forbidden.

  2. P2: parse_components can return a valid component after silently ignoring an unterminated later sibling. A malformed calendar resource must refuse before observations, projections, or sync state change.

  3. P2: replaying an applied partial sync reconstructs only concurrent_change warnings, losing dependency_unavailable or calendar_unsupported warnings from the original response. Replay must preserve the original warning codes and messages.

The implementation worker is addressing these findings on the branch before merge.

Independent review of head 360da17 found three issues requiring changes before merge: 1. P2: CalDavClient.send turns upstream HTTP 401 from discovery and resource GET into SecurityViolation, and sync maps that to forbidden/403. Preserve unauthenticated/401 for upstream credential rejection while keeping local URL and redirect security failures forbidden. 2. P2: parse_components can return a valid component after silently ignoring an unterminated later sibling. A malformed calendar resource must refuse before observations, projections, or sync state change. 3. P2: replaying an applied partial sync reconstructs only concurrent_change warnings, losing dependency_unavailable or calendar_unsupported warnings from the original response. Replay must preserve the original warning codes and messages. The implementation worker is addressing these findings on the branch before merge.
Author
Owner

Follow-up review finding on head 9ecb668: component validation accepts STANDARD, DAYLIGHT, VALARM, AVAILABLE, or VOTE at any nesting depth. Parent-aware nesting is required so a nested STANDARD cannot be parsed as VEVENT properties, and VALARM or other children cannot nest under an invalid parent. The worker is fixing this together with the unsupported VAVAILABILITY and VPOLL regression.

Follow-up review finding on head 9ecb668: component validation accepts STANDARD, DAYLIGHT, VALARM, AVAILABLE, or VOTE at any nesting depth. Parent-aware nesting is required so a nested STANDARD cannot be parsed as VEVENT properties, and VALARM or other children cannot nest under an invalid parent. The worker is fixing this together with the unsupported VAVAILABILITY and VPOLL regression.
Author
Owner

Follow-up P2: CalendarError::Unauthenticated is shared by CalDavClient.send, so non-sync routes such as agenda, tasks, items, resolve, and mutations now receive the new variant. Their error classifiers must preserve backend HTTP 401 as unauthenticated/401 rather than falling through to dependency_unavailable/503. The worker is auditing those mappings while retaining forbidden for local security violations.

Follow-up P2: CalendarError::Unauthenticated is shared by CalDavClient.send, so non-sync routes such as agenda, tasks, items, resolve, and mutations now receive the new variant. Their error classifiers must preserve backend HTTP 401 as unauthenticated/401 rather than falling through to dependency_unavailable/503. The worker is auditing those mappings while retaining forbidden for local security violations.
Author
Owner

Fresh independent review of head 5d8182e found no remaining patch-introduced P1 or P2 defects. The review covered backend authentication status mapping, RFC 5545 component framing and legal nesting, malformed-resource atomic refusal, warning-preserving replay with legacy result compatibility, RFC 6578 cursor and projection reconciliation, concurrency, and the CLI/API contract. The earlier findings in comments 4583, 4585, and 4586 were addressed on this head.

Fresh independent review of head 5d8182e found no remaining patch-introduced P1 or P2 defects. The review covered backend authentication status mapping, RFC 5545 component framing and legal nesting, malformed-resource atomic refusal, warning-preserving replay with legacy result compatibility, RFC 6578 cursor and projection reconciliation, concurrency, and the CLI/API contract. The earlier findings in comments 4583, 4585, and 4586 were addressed on this head.
yuris merged commit 9be6cb5dec into main 2026-09-23 11:47:19 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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
yuris/life-service!93
No description provided.