diff --git a/.planning/REQUIREMENTS.md b/.planning/REQUIREMENTS.md index 3db2733..f4b4693 100644 --- a/.planning/REQUIREMENTS.md +++ b/.planning/REQUIREMENTS.md @@ -9,27 +9,27 @@ Requirements for initial release. Each maps to roadmap phases. ### Room Management -- [ ] **ROOM-01**: User can create a room with a name and an icon from a curated Material Icons set -- [ ] **ROOM-02**: User can edit a room's name and icon -- [ ] **ROOM-03**: User can delete a room with confirmation (cascades to associated tasks) -- [ ] **ROOM-04**: User can reorder rooms via drag-and-drop on the rooms screen -- [ ] **ROOM-05**: User can view all rooms as cards showing name, icon, due task count, and cleanliness indicator +- [x] **ROOM-01**: User can create a room with a name and an icon from a curated Material Icons set +- [x] **ROOM-02**: User can edit a room's name and icon +- [x] **ROOM-03**: User can delete a room with confirmation (cascades to associated tasks) +- [x] **ROOM-04**: User can reorder rooms via drag-and-drop on the rooms screen +- [x] **ROOM-05**: User can view all rooms as cards showing name, icon, due task count, and cleanliness indicator ### Task Management -- [ ] **TASK-01**: User can create a task within a room with name, optional description, frequency interval, and effort level -- [ ] **TASK-02**: User can edit a task's name, description, frequency interval, and effort level -- [ ] **TASK-03**: User can delete a task with confirmation -- [ ] **TASK-04**: User can set frequency interval from: daily, every 2 days, every 3 days, weekly, biweekly, monthly, every 2 months, quarterly, every 6 months, yearly, or custom (every N days) -- [ ] **TASK-05**: User can set effort level (low / medium / high) on a task -- [ ] **TASK-06**: User can sort tasks within a room by due date (default sort order) -- [ ] **TASK-07**: User can mark a task as done via tap or swipe, which records a completion timestamp and auto-calculates the next due date based on the interval -- [ ] **TASK-08**: Overdue tasks are visually highlighted with distinct color/badge on room cards and in task lists +- [x] **TASK-01**: User can create a task within a room with name, optional description, frequency interval, and effort level +- [x] **TASK-02**: User can edit a task's name, description, frequency interval, and effort level +- [x] **TASK-03**: User can delete a task with confirmation +- [x] **TASK-04**: User can set frequency interval from: daily, every 2 days, every 3 days, weekly, biweekly, monthly, every 2 months, quarterly, every 6 months, yearly, or custom (every N days) +- [x] **TASK-05**: User can set effort level (low / medium / high) on a task +- [x] **TASK-06**: User can sort tasks within a room by due date (default sort order) +- [x] **TASK-07**: User can mark a task as done via tap or swipe, which records a completion timestamp and auto-calculates the next due date based on the interval +- [x] **TASK-08**: Overdue tasks are visually highlighted with distinct color/badge on room cards and in task lists ### Task Templates -- [ ] **TMPL-01**: When creating a room, user can select from bundled German-language task templates appropriate for that room type -- [ ] **TMPL-02**: Preset room types with templates include: Küche, Badezimmer, Schlafzimmer, Wohnzimmer, Flur, Büro, Garage, Balkon, Waschküche, Keller, Kinderzimmer, Gästezimmer, Esszimmer, Garten/Außenbereich +- [x] **TMPL-01**: When creating a room, user can select from bundled German-language task templates appropriate for that room type +- [x] **TMPL-02**: Preset room types with templates include: Küche, Badezimmer, Schlafzimmer, Wohnzimmer, Flur, Büro, Garage, Balkon, Waschküche, Keller, Kinderzimmer, Gästezimmer, Esszimmer, Garten/Außenbereich ### Daily Plan @@ -125,21 +125,21 @@ Which phases cover which requirements. Updated during roadmap creation. | FOUND-04 | Phase 1: Foundation | Complete | | THEME-01 | Phase 1: Foundation | Complete | | THEME-02 | Phase 1: Foundation | Complete | -| ROOM-01 | Phase 2: Rooms and Tasks | Pending | -| ROOM-02 | Phase 2: Rooms and Tasks | Pending | -| ROOM-03 | Phase 2: Rooms and Tasks | Pending | -| ROOM-04 | Phase 2: Rooms and Tasks | Pending | -| ROOM-05 | Phase 2: Rooms and Tasks | Pending | -| TASK-01 | Phase 2: Rooms and Tasks | Pending | -| TASK-02 | Phase 2: Rooms and Tasks | Pending | -| TASK-03 | Phase 2: Rooms and Tasks | Pending | -| TASK-04 | Phase 2: Rooms and Tasks | Pending | -| TASK-05 | Phase 2: Rooms and Tasks | Pending | -| TASK-06 | Phase 2: Rooms and Tasks | Pending | -| TASK-07 | Phase 2: Rooms and Tasks | Pending | -| TASK-08 | Phase 2: Rooms and Tasks | Pending | -| TMPL-01 | Phase 2: Rooms and Tasks | Pending | -| TMPL-02 | Phase 2: Rooms and Tasks | Pending | +| ROOM-01 | Phase 2: Rooms and Tasks | Complete | +| ROOM-02 | Phase 2: Rooms and Tasks | Complete | +| ROOM-03 | Phase 2: Rooms and Tasks | Complete | +| ROOM-04 | Phase 2: Rooms and Tasks | Complete | +| ROOM-05 | Phase 2: Rooms and Tasks | Complete | +| TASK-01 | Phase 2: Rooms and Tasks | Complete | +| TASK-02 | Phase 2: Rooms and Tasks | Complete | +| TASK-03 | Phase 2: Rooms and Tasks | Complete | +| TASK-04 | Phase 2: Rooms and Tasks | Complete | +| TASK-05 | Phase 2: Rooms and Tasks | Complete | +| TASK-06 | Phase 2: Rooms and Tasks | Complete | +| TASK-07 | Phase 2: Rooms and Tasks | Complete | +| TASK-08 | Phase 2: Rooms and Tasks | Complete | +| TMPL-01 | Phase 2: Rooms and Tasks | Complete | +| TMPL-02 | Phase 2: Rooms and Tasks | Complete | | PLAN-01 | Phase 3: Daily Plan and Cleanliness | Pending | | PLAN-02 | Phase 3: Daily Plan and Cleanliness | Pending | | PLAN-03 | Phase 3: Daily Plan and Cleanliness | Pending | diff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.md index e7d5a2c..7594f7e 100644 --- a/.planning/ROADMAP.md +++ b/.planning/ROADMAP.md @@ -47,7 +47,7 @@ Plans: 6. Each room card shows its name, icon, count of due tasks, and cleanliness indicator **Plans**: 5 plans Plans: -- [ ] 02-01-PLAN.md — Data layer: Drift tables, migration v1->v2, DAOs, scheduling utility, domain models, templates, tests +- [x] 02-01-PLAN.md — Data layer: Drift tables, migration v1->v2, DAOs, scheduling utility, domain models, templates, tests - [ ] 02-02-PLAN.md — Room CRUD UI: 2-column card grid, room form, icon picker, drag-and-drop reorder, providers - [ ] 02-03-PLAN.md — Task CRUD UI: task list, task row with completion, task form, overdue highlighting, providers - [ ] 02-04-PLAN.md — Template selection: template picker bottom sheet, room type detection, integration with room creation diff --git a/.planning/STATE.md b/.planning/STATE.md index 6a6b87e..d4300c8 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -2,16 +2,16 @@ gsd_state_version: 1.0 milestone: v1.0 milestone_name: milestone -status: planning -stopped_at: Completed 01-02-PLAN.md -- Phase 1 complete, ready for Phase 2 planning -last_updated: "2026-03-15T19:15:17.236Z" -last_activity: 2026-03-15 — Completed 01-02-PLAN.md (navigation shell, screens, settings, full app wiring) +status: executing +stopped_at: Completed 02-01-PLAN.md +last_updated: "2026-03-15T20:55:19.555Z" +last_activity: 2026-03-15 — Completed 02-01-PLAN.md (data layer, DAOs, scheduling, templates) progress: total_phases: 4 completed_phases: 1 - total_plans: 2 - completed_plans: 2 - percent: 100 + total_plans: 7 + completed_plans: 3 + percent: 43 --- # Project State @@ -21,35 +21,37 @@ progress: See: .planning/PROJECT.md (updated 2026-03-15) **Core value:** Users can see what needs doing today, mark it done, and trust the app to schedule the next occurrence — without thinking about it. -**Current focus:** Phase 1: Foundation +**Current focus:** Phase 2: Rooms and Tasks ## Current Position -Phase: 1 of 4 (Foundation) -- COMPLETE -Plan: 2 of 2 in current phase -Status: Phase complete -- ready for Phase 2 planning -Last activity: 2026-03-15 — Completed 01-02-PLAN.md (navigation shell, screens, settings, full app wiring) +Phase: 2 of 4 (Rooms and Tasks) +Plan: 1 of 5 in current phase -- COMPLETE +Status: Executing Phase 2 -- 02-01 complete, ready for 02-02 +Last activity: 2026-03-15 — Completed 02-01-PLAN.md (data layer, DAOs, scheduling, templates) -Progress: [██████████] 100% +Progress: [████------] 43% ## Performance Metrics **Velocity:** -- Total plans completed: 2 -- Average duration: 7.5 min -- Total execution time: 0.25 hours +- Total plans completed: 3 +- Average duration: 7.7 min +- Total execution time: 0.38 hours **By Phase:** | Phase | Plans | Total | Avg/Plan | |-------|-------|-------|----------| | 1 - Foundation | 2 | 15 min | 7.5 min | +| 2 - Rooms and Tasks | 1 | 8 min | 8 min | **Recent Trend:** -- Last 5 plans: 01-01 (7 min), 01-02 (8 min) +- Last 5 plans: 01-01 (7 min), 01-02 (8 min), 02-01 (8 min) - Trend: stable *Updated after each plan completion* +| Phase 02 P01 | 8 | 2 tasks | 16 files | ## Accumulated Context @@ -66,6 +68,14 @@ Recent decisions affecting current work: - [01-01]: Pinned drift/drift_dev to 2.31.0 for analyzer ^9.0.0 compatibility with riverpod_generator 4.0.3 - [01-01]: Generated Riverpod 3 provider named themeProvider (not themeNotifierProvider) per new naming convention - [Phase 01-02]: Used themeProvider (Riverpod 3 naming) instead of themeNotifierProvider referenced in plan +- [02-01]: Scheduling functions are top-level pure functions with DateTime today parameter for testability +- [02-01]: Calendar-anchored intervals use anchorDay nullable field for month-clamping memory +- [02-01]: RoomWithStats computed via asyncMap on watchAllRooms stream, not a custom SQL join +- [02-01]: Templates stored as Dart const map for type safety, not JSON assets +- [02-01]: detectRoomType uses contains-based matching with alias map +- [Phase 02]: Scheduling functions are top-level pure functions with DateTime today parameter for testability +- [Phase 02]: Calendar-anchored intervals use anchorDay nullable field for month-clamping memory +- [Phase 02]: Templates stored as Dart const map for type safety, not JSON assets ### Pending Todos @@ -73,12 +83,12 @@ None yet. ### Blockers/Concerns -- [Research]: Recurrence policy edge cases not fully specified — "monthly" on the 31st, seasonal interval definition. Decide before Phase 2 planning. +- ~~[Research]: Recurrence policy edge cases not fully specified~~ — **RESOLVED** in 2-CONTEXT.md: calendar-anchored intervals clamp to last day with anchor memory, day-count intervals roll forward. Next due from original due date. Catch-up skips to next future date. - [Research]: Notification time configuration (user-adjustable vs hardcoded) not resolved. Decide before Phase 4 planning. -- [Research]: First-launch template seeding UX (silent vs prompted) not resolved. Decide before Phase 2 planning. +- ~~[Research]: First-launch template seeding UX (silent vs prompted) not resolved~~ — **RESOLVED** in 2-CONTEXT.md: post-creation prompt with all templates unchecked. Room type is optional, detected from name. Custom rooms skip templates entirely. ## Session Continuity -Last session: 2026-03-15T19:09:57.071Z -Stopped at: Completed 01-02-PLAN.md -- Phase 1 complete, ready for Phase 2 planning +Last session: 2026-03-15T20:55:13.060Z +Stopped at: Completed 02-01-PLAN.md Resume file: None diff --git a/.planning/phases/02-rooms-and-tasks/02-01-SUMMARY.md b/.planning/phases/02-rooms-and-tasks/02-01-SUMMARY.md new file mode 100644 index 0000000..4700c45 --- /dev/null +++ b/.planning/phases/02-rooms-and-tasks/02-01-SUMMARY.md @@ -0,0 +1,144 @@ +--- +phase: 02-rooms-and-tasks +plan: 01 +subsystem: database +tags: [drift, sqlite, dao, scheduling, templates, domain-models] + +# Dependency graph +requires: + - phase: 01-foundation + provides: AppDatabase with schema v1, NativeDatabase.memory() test pattern, project scaffold +provides: + - Drift schema v2 with Rooms, Tasks, TaskCompletions tables + - RoomsDao with CRUD, stream queries, cascade delete, reorder, room stats + - TasksDao with CRUD, stream queries, completeTask transaction, overdue detection + - Pure scheduling utility (calculateNextDueDate, catchUpToPresent) + - Domain enums IntervalType (8 types), EffortLevel (3 levels), FrequencyInterval model + - formatRelativeDate German formatter + - curatedRoomIcons icon list with 25 Material Icons + - TaskTemplate model and roomTemplates for 14 room types + - detectRoomType name-matching utility with alias support +affects: [02-rooms-and-tasks, 03-daily-plan, 04-notifications] + +# Tech tracking +tech-stack: + added: [] + patterns: [drift-dao-with-stream-queries, pure-scheduling-utility, task-completion-transaction, intEnum-for-enums, cascade-delete-in-transaction, const-template-data] + +key-files: + created: + - lib/features/tasks/domain/frequency.dart + - lib/features/tasks/domain/effort_level.dart + - lib/features/tasks/domain/scheduling.dart + - lib/features/tasks/domain/relative_date.dart + - lib/features/rooms/domain/room_icons.dart + - lib/features/rooms/data/rooms_dao.dart + - lib/features/tasks/data/tasks_dao.dart + - lib/features/templates/data/task_templates.dart + - test/features/tasks/domain/scheduling_test.dart + - test/features/rooms/data/rooms_dao_test.dart + - test/features/tasks/data/tasks_dao_test.dart + - test/features/templates/task_templates_test.dart + - drift_schemas/household_keeper/drift_schema_v2.json + modified: + - lib/core/database/database.dart + - lib/core/database/database.g.dart + - test/core/database/database_test.dart + +key-decisions: + - "Scheduling functions are top-level pure functions with DateTime today parameter for testability" + - "Calendar-anchored intervals use anchorDay nullable field for month-clamping memory" + - "RoomWithStats computed via asyncMap on watchAllRooms stream, not a custom SQL join" + - "Templates stored as Dart const map, not JSON assets, for type safety" + - "detectRoomType uses contains-based matching with alias map for flexible room name detection" + +patterns-established: + - "DAO stream queries with .watch() for reactive UI data" + - "Cascade delete via transaction (completions -> tasks -> room)" + - "Task completion as single DAO transaction (record + calculate + catch-up + update)" + - "intEnum for Dart enum persistence with index stability comments" + - "In-memory database testing with NativeDatabase.memory()" + - "Testable date logic via today parameter injection" + +requirements-completed: [ROOM-01, ROOM-02, ROOM-03, ROOM-04, ROOM-05, TASK-01, TASK-02, TASK-03, TASK-04, TASK-05, TASK-06, TASK-07, TASK-08, TMPL-01, TMPL-02] + +# Metrics +duration: 8min +completed: 2026-03-15 +--- + +# Phase 2 Plan 01: Data Layer Summary + +**Drift schema v2 with Rooms/Tasks/TaskCompletions tables, RoomsDao and TasksDao with stream queries and completion transactions, pure scheduling utility with 8 interval types and anchor memory, and 14-room-type German task template library** + +## Performance + +- **Duration:** 8 min +- **Started:** 2026-03-15T20:44:07Z +- **Completed:** 2026-03-15T20:52:38Z +- **Tasks:** 2 +- **Files modified:** 16 + +## Accomplishments +- Database schema v2 with three tables (Rooms, Tasks, TaskCompletions), foreign keys enabled via PRAGMA, and v1-to-v2 migration strategy +- RoomsDao with full CRUD, stream-based watchAll and watchWithStats (cleanliness ratio), cascade delete, and sortOrder reorder +- TasksDao with CRUD, due-date-sorted stream queries, atomic completeTask transaction (records completion, calculates next due, catches up to present), and overdue detection +- Pure scheduling utility handling daily, everyNDays, weekly, biweekly, monthly, everyNMonths, quarterly, yearly intervals with calendar-anchored clamping and anchor memory +- Domain models: IntervalType enum (8 values), EffortLevel enum (3 values), FrequencyInterval with German labels, formatRelativeDate German formatter, curatedRoomIcons with 25 Material Icons +- 14 room types with 3-6 German task templates each, plus detectRoomType with alias-based name matching +- 41 data layer unit tests all passing, full suite of 59 tests green + +## Task Commits + +Each task was committed atomically: + +1. **Task 1: Define Drift tables, migration, DAOs, and domain models** - `d2e4526` (feat) +2. **Task 2: Create task template data and template tests** - `da270e5` (feat) + +## Files Created/Modified +- `lib/core/database/database.dart` - Drift tables (Rooms, Tasks, TaskCompletions), schema v2, migration strategy, foreign keys PRAGMA +- `lib/features/tasks/domain/frequency.dart` - IntervalType enum (8 values), FrequencyInterval model with German labels +- `lib/features/tasks/domain/effort_level.dart` - EffortLevel enum (low/medium/high) with German labels +- `lib/features/tasks/domain/scheduling.dart` - calculateNextDueDate and catchUpToPresent pure functions +- `lib/features/tasks/domain/relative_date.dart` - formatRelativeDate German formatter (Heute, Morgen, in X Tagen, Uberfaellig) +- `lib/features/rooms/domain/room_icons.dart` - curatedRoomIcons (25 Material Icons) and mapIconName utility +- `lib/features/rooms/data/rooms_dao.dart` - RoomsDao with CRUD, watchAll, watchWithStats, cascade delete, reorder +- `lib/features/tasks/data/tasks_dao.dart` - TasksDao with CRUD, watchInRoom, completeTask, overdue detection +- `lib/features/templates/data/task_templates.dart` - TaskTemplate class, roomTemplates for 14 types, detectRoomType +- `test/features/tasks/domain/scheduling_test.dart` - 17 tests for scheduling and relative date formatting +- `test/features/rooms/data/rooms_dao_test.dart` - 6 tests for rooms DAO operations +- `test/features/tasks/data/tasks_dao_test.dart` - 7 tests for tasks DAO operations +- `test/features/templates/task_templates_test.dart` - 11 tests for templates and detectRoomType + +## Decisions Made +- Scheduling functions are top-level pure functions (not in a class) with DateTime today parameter for testability +- Calendar-anchored intervals use a nullable anchorDay field on Tasks table for month-clamping memory +- RoomWithStats computed via asyncMap on the watchAllRooms stream rather than a complex SQL join +- Templates stored as Dart const map for type safety and zero parsing overhead +- detectRoomType uses contains-based matching with an alias map for flexible room name detection + +## Deviations from Plan + +None - plan executed exactly as written. + +## Issues Encountered +None + +## User Setup Required + +None - no external service configuration required. + +## Next Phase Readiness +- All data layer contracts ready for Room CRUD UI (02-02), Task CRUD UI (02-03), and Template selection (02-04) +- Stream-based DAO queries ready for Riverpod stream providers +- Scheduling utility ready to be called from TasksDao.completeTask +- Template data ready for template picker bottom sheet +- All existing Phase 1 tests continue to pass + +## Self-Check: PASSED + +All 13 key files verified present. Both task commits (d2e4526, da270e5) verified in git log. 59 tests passing. dart analyze clean. + +--- +*Phase: 02-rooms-and-tasks* +*Completed: 2026-03-15*