Purpose
This page documents the live execution paths in the current app implementation. Use it when you need to answer questions like:- “What runs on app startup?”
- “What exactly happens when a task is completed?”
- “How do check-ins write events?”
- “Where do replayed events affect mana computation?”
This page is implementation-facing. It reflects current code paths under
app/lib.Startup flow
Startup does two phases:- Boot and app wiring in
main.dart - First
todaymana compute triggered by screen providers
Complete task occurrence flow
When the user taps Complete on the Tasks screen, the write path is transactional and event-backed.Completion payload contract
taskOccurrenceCompleted currently carries:
- occurrence/task identity
- due/completed timestamps
manaCostAtCompletionaxisFactorAtCompletionbaselineCostAtCompletioncompletedLocalDay
Save check-in flow
Check-in writes are canonicalized to one row per local day and emit two events atomically.Why two events?
checkInRecordedpreserves explicit check-in submission data.dayTypeSetprovides replay-friendly day opportunity weight context.
Task edit flow with recovery-weight emission
Task edits always emittaskEdited.They emit
taskRecoveryWeightUpdated only when recovery fields were touched and values actually changed.
Replay consumption during compute
Historical events are sorted byoccurredAt then id, then reduced into deterministic learning state.
Determinism and safety invariants
- All replay-affecting signals come from append-only event history.
- Event ordering is stable (
occurredAt, thenid). - Check-in and completion writes use DB transactions for row+event atomicity.
- Recompute is idempotent for a fixed input set and algorithm version.
Code anchors
app/lib/main.dartapp/lib/ui/core/design/typography.dartapp/lib/ui/core/providers/mana_day_view_providers.dartapp/lib/domain/application/mana/compute_mana_day.dartapp/lib/ui/tasks/widgets/tasks_screen.dartapp/lib/domain/application/tasks/complete_task_occurrence.dartapp/lib/data/repositories/drift_task_repository.dartapp/lib/domain/application/check_ins/save_check_in.dartapp/lib/data/repositories/drift_check_in_repository.dartapp/lib/domain/mana/engine/historical_learning_state_reducer.dartapp/lib/domain/mana/engine/composed_mana_engine.dart