focus-flow/Codex Documentation/Completed Plans/Persistence Plan 1 - SQLite Runtime Persistence/README.md

63 lines
2.2 KiB
Markdown

<!-- SPDX-FileCopyrightText: 2026 FocusFlow contributors -->
<!-- SPDX-License-Identifier: AGPL-3.0-only -->
# Persistence Plan 1 - SQLite Runtime Persistence
**Status:** Complete on 2026-07-02.
Start with `PERSISTENCE_PLAN_1_SUMMARY.md`, then execute the block files in
`PERSISTENCE_PLAN_1_EXECUTION_ORDER.md` order.
This plan replaces the current seeded/in-memory Flutter runtime with a real
SQLite-backed runtime slice. The target user-visible proof is narrow:
1. Start the desktop app.
2. Add/capture a task.
3. Optionally schedule it into Today.
4. Mark it done or not done.
5. Close the app.
6. Reopen the app against the same SQLite file.
7. See the task, placement, and completion state exactly as persisted.
The plan does **not** redesign the UI, add sync, add week/month views, add
Shield/Recovery surfaces, or move scheduling rules into Flutter widgets.
## Completion Handoff
Changed:
- Added Drift schema version 2 app-layer tables for application operations,
task activities, project statistics, and notice acknowledgements.
- Added `SqliteApplicationUnitOfWork` and `SqliteApplicationRuntime` in
`packages/scheduler_persistence_sqlite`.
- Switched normal Flutter startup to `PersistentSchedulerComposition`.
- Kept `DemoSchedulerComposition` for deterministic widget and visual tests.
- Updated boundary tests so only the persistent composition root can import the
SQLite adapter and `dart:io`.
Now persists:
- tasks captured through current command flows,
- planned schedule placement,
- completed and reopened/not-done state,
- owner settings and default Home project bootstrap,
- operation, activity, and project statistics records needed by current
commands.
Validation recorded during implementation:
- `cd packages/scheduler_persistence_sqlite && dart analyze`: passed.
- `cd packages/scheduler_persistence_sqlite && dart test`: passed.
- `cd apps/focus_flow_flutter && flutter pub get`: passed.
- `cd apps/focus_flow_flutter && flutter analyze`: passed.
- `cd apps/focus_flow_flutter && flutter test`: passed.
Not in scope:
- full task editor,
- visible Backlog navigation in the compact shell,
- backup/restore UI,
- export/import UI,
- sync/calendar/notifications,
- week/month views,
- Shield/Recovery UX.