Files
alkstore/tasks/sqlite-fix-scheduler-error-classification.md
T

65 lines
2.5 KiB
Markdown

---
id: sqlite-fix-scheduler-error-classification
name: Classify run_schedules' renew-failure arms (review 004 item 9)
status: pending
depends_on: []
scope: narrow
risk: low
impact: component
level: implementation
tags: [review-004-fixes, sqlite-engine, scheduler]
---
## Description
The SQLite `run_schedules` error flattening, per
`docs/reviews/004-pre-release-general-review.md` §"Findings recorded,
not fixed" item 9: the renew arm maps *any* renew failure — including
the closed-store `Database` error — to `LeadershipLost`
(`scheduler.rs:216`, `lease.renew(LEADER_TTL_S).await.unwrap_or(false)`),
misdirecting the documented respawn recipe at a dead store (an operator
respawns a leader against a store that is closed).
Decide the right arm set and implement it: closed-store vs
leadership-lost vs storage failure — what `run_schedules` returns on a
dead store, and what stays `LeadershipLost`.
**Contract-adjacent — check the window state first.** This is an
error-classification change on a stable surface (what error a public
scheduler entry point returns is contract-observable). As of the
decomposition (2026-10-11) no publish tag exists, so the class-1
window is presumed open — verify, and if open, land with a dated
ADR-023 §2-style annotation of the classification. If the window has
closed (the user has published), raise with the user before changing
the observable error surface, per AGENTS.md's ADR-wins discipline.
## Acceptance Criteria
- [ ] The arm set is decided and recorded in Notes (which error maps
where, citing the contract text that pins `run_schedules`' error
surface); the closed-store arm no longer reports
`LeadershipLost`
- [ ] The window state was verified and recorded; a dated annotation
landed if class-1, or user sign-off if post-publish
- [ ] A test pins the closed-store arm (and the genuine
leadership-lost arm's unchanged disposition)
- [ ] The documented respawn recipe's text (wherever it lives) matches
the new classification
- [ ] `cargo test -p alkstore-sqlite`, clippy `-D warnings`, fmt
clean; workspace gates green server-less
## References
- docs/reviews/004-pre-release-general-review.md §"Findings recorded,
not fixed" item 9 (the finding, the "record, don't rush" note this
task discharges)
- docs/architecture/core-contract.md (the scheduler error surface)
- alkstore-sqlite/src/scheduler.rs:205-216 (the flattening site)
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion