What to build
crates/storage/src/focus_store.rs has no #[test] block. It is the most load-bearing storage module: atomic directory creation, markdown parse, timer sidecar load, atomic write, delete. Coverage today is only implicit through Commands integration tests (TempDir via crates/commands).
Add a #[cfg(test)] module directly in focus_store.rs (or focus_store/tests.rs) covering:
| Test |
What it proves |
create_then_list_roundtrip |
create_focus → list() returns focus with correct fields |
list_with_timer_sidecar |
Focus created with timer → list() includes populated FocusTimer |
list_without_timer_sidecar |
Focus created without timer → list() has timer: None |
delete_removes_directory |
delete_focus → focus dir gone from fs |
delete_nonexistent_returns_err |
Deleting unknown id returns error, does not panic |
corrupted_timer_json_degrades_gracefully |
Malformed timer.json → focus still returned, timer field None or explicit error variant |
append_task_persists |
append_task → list() shows new task in body |
delete_task_persists |
delete_task(index) → list() task removed |
All tests use tempfile::TempDir; no real ~/.adhd-ranch touched.
Completion promise
MarkdownFocusStore has direct unit tests covering the create/list/delete/task mutation cycle and timer sidecar edge cases; the storage seam is independently trusted without Commands.
Acceptance criteria
Blocked by
None — can start immediately.
What to build
crates/storage/src/focus_store.rshas no#[test]block. It is the most load-bearing storage module: atomic directory creation, markdown parse, timer sidecar load, atomic write, delete. Coverage today is only implicit through Commands integration tests (TempDir viacrates/commands).Add a
#[cfg(test)]module directly infocus_store.rs(orfocus_store/tests.rs) covering:create_then_list_roundtripcreate_focus→list()returns focus with correct fieldslist_with_timer_sidecarlist()includes populatedFocusTimerlist_without_timer_sidecarlist()hastimer: Nonedelete_removes_directorydelete_focus→ focus dir gone from fsdelete_nonexistent_returns_errcorrupted_timer_json_degrades_gracefullytimer.json→ focus still returned, timer fieldNoneor explicit error variantappend_task_persistsappend_task→list()shows new task in bodydelete_task_persistsdelete_task(index)→list()task removedAll tests use
tempfile::TempDir; no real~/.adhd-ranchtouched.Completion promise
MarkdownFocusStorehas direct unit tests covering the create/list/delete/task mutation cycle and timer sidecar edge cases; the storage seam is independently trusted without Commands.Acceptance criteria
focus_store.rscovering the cases aboveTempDir; no writes to real home dirtimer.jsontest passes (no panic, graceful fallback)cargo test -p adhd-ranch-storagegreen in isolationtask checkgreenBlocked by
None — can start immediately.