summaryrefslogtreecommitdiff
path: root/internal/store
AgeCommit message (Collapse)Author
5 daysfeat: unify Google Tasks with main system via caching and integrated UIPeter Stone
- Implement SQLite caching layer for Google Tasks - Integrate Google Tasks into unified Atoms loop (showing in Tasks tab) - Update Planning tab to include cached Google Tasks - Enhance Quick Add form with Todoist project selector - Remove orphaned HandleTasksTab/HandleRefreshTab methods - Update tests to reflect new BuildTimeline signature and data structures
5 daysfeat: complete Agent Context API Phase 2 & 3 (Write/Create/Management)Peter Stone
- Implement write operations (complete, uncomplete, update due date, update task) - Implement create operations (create task, add shopping item) - Add Trusted Agents management UI in Settings with revocation support - Fix SQLite timestamp scanning bug for completed tasks - Add comprehensive unit tests for all new agent endpoints - Update worklog and feature documentation
5 daysfix: parse Todoist local datetimes, show near-future tasks, add undated ↵Peter Stone
tasks to timeline - parseDueDate: handle date field containing "YYYY-MM-DDTHH:MM:SS" (local time, no tz offset) — Todoist REST API v1 uses this format for recurring tasks with a set time, causing due dates to silently parse as nil - IsFuture threshold: widen from tomorrow to 7 days out so tasks due this week show in the main tasks section with dates visible (not collapsed) - BuildTimeline: include undated Todoist tasks in the Today section (mirrors existing Google Tasks behavior) - GetUndatedTasks: new store method for tasks with due_date IS NULL Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5 dayschore: unify and centralize agent configuration in .agent/Peter Stone
7 daysfeat: Phase 1 — remove bug feature and dead codePeter Stone
- Delete Bug struct, BugToAtom, SourceBug, TypeBug, TypeNote - Remove bug store methods (SaveBug, GetBugs, ResolveBug, etc.) - Remove HandleGetBugs, HandleReportBug, bug branches in handlers - Remove bug routes, bugs.html template, bug UI from index.html - Remove AddMealToPlanner stub + interface method - Migration 018: DROP TABLE IF EXISTS bugs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
9 daystest: add coverage for planning tab, meals, Google Tasks, bug handlers, ↵Agent
completed task parsing - HandleTabPlanning: happy-path test verifying tasks/cards land in correct sections (scheduled/unscheduled/upcoming); boundary test confirming a task due exactly at midnight of tomorrow lands in Upcoming, not Scheduled - HandleTabMeals: grouping test verifying two meals sharing date+mealType produce one CombinedMeal with both recipe names merged - Google Tasks GetTasksByDateRange: four boundary tests (start inclusive, end exclusive, no-due-date always included, out-of-range excluded) using redirectingTransport mock server pattern - HandleGetBugs: data assertions verifying bug list and empty-list cases - HandleReportBug: success test verifying bug is saved and bugs template is re-rendered - GetCompletedTasks: timestamp parsing test ensuring CompletedAt is not zero when inserted with a known "2006-01-02 15:04:05" string Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04feat: sync log, cache clear endpoint, Todoist projects from cached tasksPeter Stone
- migration 016: sync_log table - store: AddSyncLogEntry, GetRecentSyncLog, InvalidateAllCaches, GetProjectsFromTasks - settings: HandleClearCache (POST /settings/clear-cache), SyncLog in page data - settings: use GetProjectsFromTasks instead of deprecated Todoist REST /projects - handlers: populate atom projects from store - agent: log warning on registration failure instead of silently swallowing - google_tasks: simplify URL literal - tests: sync log CRUD, clear cache handler, settings page includes sync log, sync sources adds log entry, incremental sync paths, task completion response/headers, calendar cache fallback Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-17Add calendar cache layer, incremental sync tests, completion assertionsPeter Stone
- 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 <noreply@anthropic.com>
2026-02-06Fix missing settings button, disappeared events, and tab refresh bugPeter Stone
- Add settings gear icon link to dashboard header - Fix GetTasksByDateRange/GetCardsByDateRange to include overdue items (changed from BETWEEN to <= end, filter completed tasks) - Fix refresh replacing active tab with tasks tab by using htmx.trigger(body, 'refresh-tasks') instead of innerHTML+htmx.process - Add refresh-tasks hx-trigger to meals, shopping, conditions tabs - Add tests for overdue inclusion/exclusion, settings link, template data Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-03Add comprehensive test coverage across packagesPeter Stone
New test files: - api/http_test.go: HTTP client and error handling tests - config/config_test.go: Configuration loading and validation tests - middleware/security_test.go: Security middleware tests - models/atom_test.go: Atom model and conversion tests Expanded test coverage: - api/todoist_test.go: Todoist API client tests - api/trello_test.go: Trello API client tests - auth/auth_test.go: Authentication and CSRF tests - handlers/timeline_logic_test.go: Timeline building logic tests - store/sqlite_test.go: SQLite store operations tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31Add feature toggles system with settings UI (#74)Peter Stone
- Add feature_toggles table (migration 012) - Add source_config table for future source selection (migration 013) - Create settings page at /settings with: - Feature toggle management (enable/disable/create/delete) - Data source configuration (sync and toggle boards/calendars) - Add store methods for feature toggles and source config - Add GetCalendarList and GetTaskLists to Google API clients - Document feature toggle workflow in DESIGN.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28Expand agent context API with completed log and calendar viewPeter Stone
- Add completed_tasks table to log task completions with title, due date, and completion timestamp - Extend agent context date range: 7 days back to 14 days forward - Add completed_log to API response (last 50 completed tasks) - Add day_section field to timeline items (overdue/today/tomorrow/later) - Add calendar-style view for today's schedule (6am-10pm hourly grid) - Add tabbed interface for Timeline vs Completed Log in HTML view Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28Add Agent Context API for external agent integrationPeter Stone
Phase 1: Authentication and read-only context - POST /agent/auth/request - request access with name + agent_id - GET /agent/auth/poll - poll for approval status - POST /agent/auth/approve|deny - user approval (browser auth required) - GET /agent/context - 7-day timeline context (agent session required) Phase 1.5: Browser-only agent endpoints (HTML pages) - GET /agent/web/request - request page with token - GET /agent/web/status - status page with polling - GET /agent/web/context - context page with timeline data WebSocket notifications: - GET /ws/notifications - push agent requests to browsers - Approval modal with trust indicators and countdown timer Database: - agents table for registered agent tracking - agent_sessions table for pending/active sessions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Fix multiple UI issues and shopping completion bugPeter Stone
- #54: Fix shopping item completion - now works for all sources (trello, plantoeat, user) with state stored in local DB - #48: Hide 12:00am times in timeline (all-day items) - #49: Remove "Task" type label from timeline items for cleaner UI - #51: Combine multiple PlanToEat meals for same date+mealType - #52: Change Conditions tab to standard link to standalone page Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Phase 4: Extract magic numbers to constantsPeter Stone
Create config/constants.go with centralized configuration values: - Concurrency limits (MaxConcurrentTrelloRequests) - Timeouts (HTTP, Google Calendar, graceful shutdown, request) - Meal times (breakfast, lunch, dinner hours) - Database pool settings (connections, lifetime) - Session and rate limiting settings Update all files to use these constants instead of hardcoded values. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Phase 3: Error handling and security hardeningPeter Stone
- Handle JSON marshal errors in sqlite.go (log + fallback to empty array) - Add 30s timeout to Google Calendar client initialization - Fix CSRF timing attack by using subtle.ConstantTimeCompare Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25Fix all static analysis errors (golangci-lint)Peter Stone
- Fix errcheck: handle all error return values in production code - Fix errcheck: handle all error return values in test files - Fix staticcheck: replace deprecated WithCredentialsFile with WithAuthCredentialsFile - Remove unused code: authHeaders, planToEatPlannerItem, planToEatResponse - Use defer func() { _ = x.Close() }() pattern for ignored close errors Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25Refactor: extract helpers and clean up hardcoded HTMLPeter Stone
- Extract parseEventTime() and deduplicateEvents() in google_calendar.go - Add scanTask() and scanTasks() SQL helpers in sqlite.go - Move completed-atom HTML to partial template - Add loadTestTemplates() test helper for template-dependent tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25Implement architectural refactors for feature requests #28, #30, #31, #33-38Peter Stone
Phase 1: Bugs as First-Class Atoms (#28) - Add resolved_at column to bugs table (migration 007) - Add GetUnresolvedBugs(), ResolveBug(), UnresolveBug() store methods - Include bugs in Tasks tab via BugToAtom() with completion toggle - Add unit tests for bug resolution Phase 2: Timeline as Default + Enhancements (#35, #37) - Change default tab from tasks to timeline - Add IsCompleted, DaySection, Source fields to TimelineItem - Group timeline items by today/tomorrow/later sections - Add completion checkboxes for tasks/cards, grey completed items - Collapse tomorrow/later sections by default Phase 3: Shopping Quick-Add (#33) - Add user_shopping_items table (migration 008) - Add SaveUserShoppingItem(), GetUserShoppingItems(), ToggleUserShoppingItem() - Add HandleShoppingQuickAdd() and HandleShoppingToggle() handlers - Add quick-add form to shopping tab Phase 4: Mobile Swipe Navigation (#38) - Add touch event handlers for swipe left/right tab switching - 50px threshold triggers tab change Phase 5: Consistent Background Opacity (#30) - Add CSS variables for panel/card/input/modal backgrounds - Update templates to use consistent opacity classes Phase 6: Tab Reorganization (#37) - Reorganize tabs: Timeline, Shopping, Conditions as main tabs - Move Tasks, Planning, Meals under Details dropdown Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23Fix uncomplete: add HX-Reswap header to prevent empty swapPeter Stone
The uncomplete response was returning an empty body, causing HTMX to swap the element with nothing before the refresh-tasks trigger fired. Added HX-Reswap: none header to preserve the element while the refresh event propagates. Also fixed TestGetCardsByDateRange test data to include all required columns (list_id, list_name, url). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23Refactor: reduce code duplication with shared abstractionsPeter Stone
- Add BaseClient HTTP abstraction (internal/api/http.go) to eliminate duplicated HTTP boilerplate across Todoist, Trello, and PlanToEat clients - Add response helpers (internal/handlers/response.go) for JSON/HTML responses - Add generic cache wrapper (internal/handlers/cache.go) using Go generics - Consolidate HandleCompleteAtom/HandleUncompleteAtom into handleAtomToggle - Merge TabsHandler into Handler, delete tabs.go - Extract sortTasksByUrgency and filterAndSortTrelloTasks helpers - Update tests to work with new BaseClient structure Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23Fix critical resilience issues from code reviewPeter Stone
- DB connection pool: Allow 5 connections instead of 1 for better concurrency - JSON unmarshal: Add error handling to prevent nil slice issues - Context cancellation: Check ctx.Done() in aggregateData goroutines - Migration path: Make configurable via MIGRATION_DIR env var Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22Fix slice reallocation bug in GetBoardsPeter Stone
The boardMap was storing pointers to Board structs in the boards slice. When the slice grew and reallocated, those pointers became stale, causing cards to be added to old memory locations instead of the current slice. Fixed by storing indices instead of pointers in boardMap. Added tests to verify multiple boards with varying card counts are correctly saved and retrieved. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22Fix slice reallocation bug in GetBoardsPeter Stone
2026-01-22Add debug logging to board save/retrievePeter Stone
2026-01-20Add in-app bug reporting featurePeter Stone
- New bugs table in SQLite (migration 005) - Store methods for saving and retrieving bugs - Handlers for GET/POST /bugs - Floating bug button with modal UI - Shows recent bug reports in modal Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20Add session-based authenticationPeter Stone
Implement secure authentication using scs session manager with SQLite backing store and bcrypt password hashing. - Add users and sessions tables (migration 004) - Create internal/auth package with Service, Middleware, and Handlers - Protect all routes except /login, /logout, /static/* - Add login page template and logout button to dashboard - Default credentials: admin/changeme (configurable via env vars) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20Remove Obsidian integration for public server deploymentPeter Stone
Obsidian relied on local filesystem access which is incompatible with public server deployment. This removes all Obsidian-related code including: - API client and interface - Store layer methods (SaveNotes, GetNotes, SearchNotes) - Handler methods and routes - UI tab and templates - Configuration fields - Related tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20Implement efficient sync for Todoist and Trello APIsPeter Stone
- Add Todoist Sync API v9 support with incremental sync tokens - Store sync tokens in SQLite for persistence across restarts - Add field filtering to Trello API calls to reduce payload size - Update handlers to use incremental sync (merge changes vs full replace) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19Fix stale Todoist tasks persisting after refreshPeter Stone
Clear tasks table before inserting fresh API data, matching the fix applied to SaveBoards. This ensures completed/updated/deleted tasks are properly removed from the cache. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19Refactor: Add cache key constants and configurable template pathPeter Stone
Code quality improvements: - Define CacheKey* constants in store package for type safety - Add TemplateDir to config (default: web/templates, env: TEMPLATE_DIR) - Update handlers to use store.CacheKey* instead of hardcoded strings - Update NewTabsHandler to accept templateDir parameter - Use filepath.Join for cross-platform template path construction Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18Fix Trello closed boards bug - filter API and clear stale cachePeter Stone
Closed boards were appearing because: 1. API fetched all boards including closed ones 2. Cache used upsert logic that never removed old data Fixes: - Add filter=open to GetBoards API call - Add filter=visible to GetCards API call - Clear boards/cards tables before inserting fresh data in SaveBoards Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18Implement unified task completion with cache sync (Phase 3 Step 7)Peter Stone
Add checkbox UI to Tasks tab for completing Todoist tasks and archiving Trello cards. Fix cache synchronization so completed items stay gone after page reload by deleting them from SQLite cache after API success. - Add HandleCompleteAtom handler routing to Todoist/Trello APIs - Add DeleteTask/DeleteCard store methods for cache removal - Add htmx.process() calls after innerHTML updates in app.js - Add comprehensive tests for completion and cache behavior Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13Implement Phase 2 Steps 3-5: Sorting and Search improvementsPeter Stone
Step 3 - Trello Smart Sorting: - Update GetBoards SQL with LEFT JOIN and MAX(c.id) for activity sorting - Update GetBoardsWithCards to find max card ID per board - Sort by: 1) Has cards, 2) Newest card activity, 3) Board name - Trello IDs are chronologically sortable (newer > older) Step 4 - Todoist Due-First Sorting: - Update GetTasks ORDER BY with CASE WHEN due_date IS NULL - Sort by: 1) Incomplete, 2) Has due date, 3) Earliest date, 4) Priority - Tasks with due dates appear before tasks without due dates Step 5 - Obsidian Search: - Add SearchNotes method with LIKE queries on title/content - Update HandleNotes to check 'q' query param and HX-Target header - Implement smart partial rendering (obsidian-notes vs notes-tab) - Add search input with 300ms debounce and HTMX integration - Real-time search without page reload Mark Steps 1-5 as complete in PHASE_2_SURGICAL_PLAN.md All tests passing Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-13 Implement Trello smart sorting by newest card activityPeter Stone
- Update GetBoards SQL query with LEFT JOIN and GROUP BY - Sort by: 1) Has cards, 2) Newest card (MAX ID), 3) Board name - Update GetBoardsWithCards to match SQL sorting behavior - Leverage Trello ID chronological sortability (newer > older) - Active boards with recent activity appear first - All tests passing Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12Sort Trello boards with active boards firstPeter Stone
Improves UX by prioritizing boards with cards over empty boards. Both API and cached results now sort consistently: non-empty boards appear first, then empty boards, with alphabetical ordering within each group. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12Add security tests for path traversal and SQL injection fixesPeter Stone
Created comprehensive test coverage for security fixes: - internal/api/obsidian_test.go: * TestGetNotes_SymlinkSecurity: Verifies symlinks are not followed * TestGetNotes_BasicFunctionality: Tests basic limit and ordering * Uses t.TempDir() for isolated test environments - internal/store/sqlite_test.go: * TestGetNotes_LimitClause: Validates LIMIT parameter handling * TestGetNotes_EmptyDatabase: Tests empty state * TestSaveNotes_Upsert: Verifies INSERT OR REPLACE behavior * TestGetNotes_SQLInjectionAttempt: Confirms parameterized queries * All tests use temporary SQLite databases for isolation All tests passing (7 new test cases). Security fixes from commits 325811c and 4c03e9c now have full test coverage. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12Harden database security and reliabilityPeter Stone
Enable WAL mode for better concurrency, serialize writes to prevent database lock errors, and fix SQL injection vulnerability in GetNotes by using parameterized queries. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12Initial commit: Personal Consolidation Dashboard (Phase 1 Complete)Peter Stone
Implemented a unified web dashboard aggregating tasks, notes, and meal planning: Core Features: - Trello integration (PRIMARY feature - boards, cards, lists) - Todoist integration (tasks and projects) - Obsidian integration (20 most recent notes) - PlanToEat integration (optional - 7-day meal planning) - Mobile-responsive web UI with auto-refresh (5 min) - SQLite caching with 5-minute TTL - AI agent endpoint with Bearer token authentication Technical Implementation: - Go 1.21+ backend with chi router - Interface-based API client design for testability - Parallel data fetching with goroutines - Graceful degradation (partial data on API failures) - .env file loading with godotenv - Comprehensive test coverage (9/9 tests passing) Bug Fixes: - Fixed .env file not being loaded at startup - Fixed nil pointer dereference with optional API clients (typed nil interface gotcha) Documentation: - START_HERE.md - Quick 5-minute setup guide - QUICKSTART.md - Fast track setup - SETUP_GUIDE.md - Detailed step-by-step instructions - PROJECT_SUMMARY.md - Complete project overview - CLAUDE.md - Guide for Claude Code instances - AI_AGENT_ACCESS.md - AI agent design document - AI_AGENT_SETUP.md - Claude.ai integration guide - TRELLO_AUTH_UPDATE.md - New Power-Up auth process Statistics: - Binary: 17MB - Code: 2,667 lines - Tests: 5 unit + 4 acceptance tests (all passing) - Dependencies: chi, sqlite3, godotenv Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>