File size: 1,550 Bytes
981aa5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Diff summary

Implemented narrow SQLite DB error visibility coverage and minimal production seam.

Changed files:
- `src/codex_dashboard/codex_data.py`
  - Added `DataAccessError` and `DataResult` result seam.
  - Added `list_threads_result()` and `list_logs_result()` to preserve non-crashing list APIs while exposing schema/data access errors to callers.
  - Added optional `DashboardStats.error` so stats schema drift is distinguishable from a missing/empty database.
  - Missing DB remains non-error empty/zero state for existing behavior.
- `src/codex_dashboard/app.py`
  - Session refresh now uses `list_threads_result()` and shows `Session database error: ...` when a DB/schema error is reported.
  - Log refresh now uses `list_logs_result()` and shows `Log database error: ...` when a DB/schema error is reported.
- `tests/test_codex_data.py`
  - Added failing-first schema drift and malformed row coverage for Codex state.sqlite.
  - Added stats schema drift error visibility coverage.
- `tests/test_logs_data.py`
  - Added normal logs_2.sqlite fixture/search coverage.
  - Added logs schema drift error visibility coverage.
- `tests/test_data_error_visibility.py`
  - Added AST-level guard that session/log refresh code distinguishes DB errors from empty data.

TDD evidence:
- Initial focused test run after writing tests failed with missing `list_threads_result` / `list_logs_result` imports.
- After minimal source changes, focused tests passed: `10 passed in 0.08s`.
- Full validation passed: `23 passed in 0.32s`; compileall passed.