From ec7d895c00c571b37ad9255b99b2e1756776c9e1 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Tue, 17 Feb 2026 14:43:42 -1000 Subject: Add calendar cache layer, incremental sync tests, completion assertions - Google Calendar events now cached via CacheFetcher pattern with stale-cache fallback on API errors (new migration 015, store methods, fetchCalendarEvents handler, BuildTimeline reads from store) - Todoist incremental sync path covered by 5 new tests - Task completion tests assert response body, headers, and template data Co-Authored-By: Claude Opus 4.6 --- SESSION_STATE.md | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'SESSION_STATE.md') diff --git a/SESSION_STATE.md b/SESSION_STATE.md index 9ecbcbe..ffd7719 100644 --- a/SESSION_STATE.md +++ b/SESSION_STATE.md @@ -1,9 +1,31 @@ # Session State ## Current Focus -Infrastructure & documentation improvements +Bug fixes: test coverage gaps + calendar cache layer ## Recently Completed +- **Bug 1: Todoist incremental sync** — added 5 tests exercising the incremental merge path (upsert, delete completed/deleted, sync token storage/reuse, forceRefresh). Code was already correct, just untested. + - Tests: `TestFetchTasks_IncrementalSync_UpsertsActiveTasks`, `TestFetchTasks_IncrementalSync_DeletesCompletedAndDeletedTasks`, `TestFetchTasks_IncrementalSync_StoresNewSyncToken`, `TestFetchTasks_IncrementalSync_UsesSavedSyncToken`, `TestFetchTasks_ForceRefresh_ClearsSyncToken` +- **Bug 2: Task completion response/headers** — added assertions for response body (`rendered:completed-atom`), Content-Type header, HX-Reswap/HX-Trigger headers, template data verification. Code was correct, assertions were missing. + - Tests updated: `TestHandleCompleteAtom_Todoist`, `TestHandleUncompleteAtom_Todoist` + - New test: `TestHandleCompleteAtom_RendersCorrectTemplateData` +- **Bug 3: Google Calendar cache layer** — calendar events now cached via `CacheFetcher` pattern, surviving API outages. + - New migration: `migrations/015_calendar_events.sql` + - New store methods: `SaveCalendarEvents`, `GetCalendarEvents`, `GetCalendarEventsByDateRange` + - New cache key: `store.CacheKeyGoogleCalendar` + - New handler method: `fetchCalendarEvents` (uses `CacheFetcher` with stale-cache fallback) + - `BuildTimeline` now reads events from store (removed `calendarClient` param) + - Tests: `TestBuildTimeline_ReadsCalendarEventsFromStore`, `TestFetchCalendarEvents_CacheFallbackOnAPIError`, `TestSaveAndGetCalendarEvents` +- All tests pass (`go test ./...`) + +## Previously Completed +- Extracted project-agnostic dev methodology to `~/.claude/CLAUDE.md` +- Created `~/.claude/roles/` with architect.md, implementor.md, reviewer.md +- Slimmed task-dashboard `CLAUDE.md` (87→72 lines, references global for methodology) +- Trimmed `DESIGN.md` (removed Development Workflow, Git Practices, TDD methodology, ADR methodology, Config Reference duplication) +- Deleted `ARCHITECT_ROLE.md`, `IMPLEMENTOR_ROLE.md`, `REVIEWER_ROLE.md` from repo + +## Previously Completed - Build version footer with ldflags injection (`deploy.sh`, `index.html`) - `assertTemplateContains` test helper, refactored existing template tests - `scripts/logs` for fetching production journalctl @@ -30,7 +52,7 @@ Infrastructure & documentation improvements - Phase 2 (Write Operations) and Phase 3 (Create + Management) pending ## Known Gaps -- Google Tasks/Calendar API clients lack dedicated unit tests (integration tested via timeline) +- Google Tasks API client lacks dedicated unit tests (integration tested via timeline) - WebAuthn passkeys require `WEBAUTHN_RP_ID` and `WEBAUTHN_ORIGIN` env vars in production ## Remaining Items (Feature Requests) @@ -44,3 +66,9 @@ Infrastructure & documentation improvements 1. Set `WEBAUTHN_RP_ID` and `WEBAUTHN_ORIGIN` in production to enable passkeys 2. **Phase 2**: Agent write operations (complete, uncomplete, update due date) 3. **Phase 3**: Create task/shopping item, agent management UI + +## Process Improvements +- Extracted dev workflow to `~/.claude/CLAUDE.md` — reusable across projects +- Role definitions now in `~/.claude/roles/` — project-agnostic +- CLAUDE.md reduced from 87 to 72 lines — faster to parse +- DESIGN.md trimmed ~200 lines of duplicated methodology -- cgit v1.2.3