Add CalDAV writeback source registry - #246
Conversation
📝 WalkthroughWalkthroughThis PR implements server-authoritative calendar writeback source discovery by replacing placeholder API logic with a PostgreSQL-backed registry table ( ChangesDatabase Registry and API Implementation
Contract and Plan Updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
PR governance metadata gate is not ready for
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
backend/tests/test_calendar_api.py (1)
681-812: 💤 Low valueGood defensive cleanup, but consider workspace_id header for full auth context coverage.
The smoke test constructs an
AsyncClientwithX-User-IdandX-Organization-Idheaders but omitsX-Workspace-Id. If the auth dependency derivesworkspace_idfrom headers, the test may be relying on a default or fallback value rather than the expectedworkspace-org-caldav-smokevalue inserted into the DB row. This could mask issues where workspace scoping is relevant.Consider adding the workspace header for consistency:
async with httpx.AsyncClient( transport=transport, base_url="http://testserver", - headers={"X-User-Id": user_id, "X-Organization-Id": organization_id}, + headers={ + "X-User-Id": user_id, + "X-Organization-Id": organization_id, + "X-Workspace-Id": f"workspace-{organization_id}", + }, ) as client:🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@backend/tests/test_calendar_api.py` around lines 681 - 812, The test test_calendar_writeback_intent_real_postgres_smoke creates an AsyncClient with X-User-Id and X-Organization-Id but omits X-Workspace-Id; update the client headers in the AsyncClient block to include "X-Workspace-Id": f"workspace-{organization_id}" so the auth dependency receives the same workspace_id as the row inserted into calendar_writeback_sources (match the workspace_id value used in the INSERT), ensuring correct auth context when calling the /api/calendar/writeback-intent endpoint.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@backend/tests/test_calendar_api.py`:
- Around line 681-812: The test
test_calendar_writeback_intent_real_postgres_smoke creates an AsyncClient with
X-User-Id and X-Organization-Id but omits X-Workspace-Id; update the client
headers in the AsyncClient block to include "X-Workspace-Id":
f"workspace-{organization_id}" so the auth dependency receives the same
workspace_id as the row inserted into calendar_writeback_sources (match the
workspace_id value used in the INSERT), ensuring correct auth context when
calling the /api/calendar/writeback-intent endpoint.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 593637a7-048c-42d5-8821-d258de1fdc06
📒 Files selected for processing (11)
AGENTS.mdREADME.mdbackend/api/calendar.pybackend/db/models.pybackend/scripts/bootstrap_db.pybackend/tests/test_bootstrap_db.pybackend/tests/test_calendar_api.pydocs/operations/source-of-truth-and-writeback-sovereignty.mddocs/plans/2026-05-19-north-star-gap-closure.mddocs/plans/2026-05-24-architecture-implementation.mddocs/plans/2026-05-27-caldav-writeback-source-registry.md
|
Current-head merge evidence for PR #246 (
Because the user explicitly directed us not to use GitHub Models and to temporarily turn off the failing direct OpenAI gate when necessary, I am treating this as a reversible gate-availability issue. I will temporarily remove only the required |
|
Post-merge rollback evidence:
|
Summary
calendar_writeback_sourcesregistry rows for/api/calendar/writeback-intent.source_uid; do not expose sequential CalDAV account ids.Verification
PYTHONDONTWRITEBYTECODE=1 DISABLE_BACKGROUND_WORKERS=1 python3 -m pytest backend/tests/test_calendar_api.py backend/tests/test_bootstrap_db.py backend/tests/test_release_governance.py -qDATABASE_URL=postgresql+asyncpg://test:test@localhost:15543/test_db PYTHONDONTWRITEBYTECODE=1 DISABLE_BACKGROUND_WORKERS=1 python3 -m pytest backend/tests/test_calendar_api.py -m postgres -qnpm cinpm test -- --run src/app/calendar/page.test.tsx src/components/EmailDetail.test.tsx src/lib/api-client.test.tsnpm run typechecknpm run lintenv -u NO_COLOR -u FORCE_COLOR NEXT_TELEMETRY_DISABLED=1 POSTCSS_WORKERS=1 DISABLE_POSTCSS_WORKERS=true NEXT_STATIC_GENERATION_MAX_CONCURRENCY=1 npm run buildenv -u NO_COLOR -u FORCE_COLOR LIVE_BASE_URL=http://127.0.0.1:18138 npm run test:e2e -- --project=desktop --project=mobile -g "calendar writeback|validates mobile hamburger composition"bash scripts/ci/test_pr_governance_gate.shbash scripts/ci/test_strix_quick_gate.shBrowser evidence
Summary by CodeRabbit
New Features
Documentation