Files
alkstore/tasks/pg-fix-scheduler-tick-seam.md
T
glm-5.3-flash 5abd351c86 Wave-6 decomposition (mem engine): eleven tasks per the pg-wave rhythm — foundations (crate scaffold, MemStore::new isolation, guarded state core, wake routing, wasm32 gate from birth), seam-tx (the load-bearing tx overlay: eleven staged _tx methods, commit-merge + wake-at-commit — pg-fix-tx-wake's discipline structural from the start, drop = discard trivial, with_tx panic posture), mechanisms mutually parallel (notify-listen close-at-engine-drop/no-replay/never-coalesced; queues = ADR-010 machine driver-free with the equal-jitter curve and opts resolution as ADR-012 §2's third owner; streams log+offsets+trim; locks TTL registry, no busy-path analog), scheduler-outbox (tick/catch-up-64/leadership through the __alkstore_scheduler lock, engine-uniform per ADR-009 §4; outbox over queues with the 60/5/5 seam stamp), integration (suite third StoreFactory column green on host under a current-thread flavor, wasm32 acceptance items, engine-mem.md to implementation-complete), and the review-wave-6 gate (born-pinned audit: conformance read, discharge-map wiring, wasm items, three-way equivalence green, class-1 window discipline). Window riders: suite-harness-current-thread — the wave's one suite-side pre-task, past_stamp_sleep's blocking sleep goes async per review 003's properties.rs:1683 posture note, enabling the current-thread flavor; pg-fix-scheduler-tick-seam — review 003 Finding 1, the cfg(test) transient-fault seam driving the real tick_with_retries through retry-then-success and exhaustion arms (the last uncovered wave-4 hardening arm, sqlite-commit-error-arm pattern). Task hygiene: pg-fix-open-path frontmatter fixed (unquoted 'max_size: 0' colon-space inside the name scalar broke YAML parsing — taskgraph validate had been red one-error since the wave-4 fix-batch decomposition; also restores review-wave-4-fixes' dependency resolution). implementation.md: wave-6 table row → decomposed, task-set listing with the parallelism note (rider + pre-task independent of the mem chain; rider closes before the gate), wave-6 decomposition bullet in the review-rounds record. Docs-only change; verified taskgraph validate (60 tasks, no cycles), cargo fmt --check, cross-reference read
2026-10-10 09:57:01 +00:00

68 lines
2.6 KiB
Markdown

---
id: pg-fix-scheduler-tick-seam
name: "pg scheduler — transient-fault tick seam: retry/exhaustion arms tested (review 003 Finding 1)"
status: pending
depends_on: []
scope: narrow
risk: low
impact: component
level: implementation
tags: [wave-6, postgres-engine, scheduler, test-hardening]
---
## Description
Review 003 Finding 1 (MEDIUM — `docs/reviews/003-wave-5-general-review.md`):
the pg scheduler's transient-error retry loop
(`alkstore-postgres/src/scheduler.rs:680-704`, `tick_with_retries`)
has never executed under any test — `pg-fix-scheduler-resilience`
pinned its *constants* (`the_tick_retry_policy_is_pinned`) but the
loop that uses them (retry, backoff sleeps, exhaustion error, the
`eprintln` diagnostic — lcov 171-184, 237-260) is dead code under
test, with no fault seam anywhere in the pg scheduler for `tick_once`.
This is the last uncovered hardening arm from the wave-4 fix batch,
and the exact class that produced review 002's live bugs.
Fix shape (the review's recommendation): a `cfg(test)` transient-
fault seam on the pg tick path, following the `sqlite-commit-error-arm
` precedent — a one-shot armed flag feeding a fabricated
transient error into the *real* retry loop (never a replica):
- (a) one retried tick then success: the seam faults once, the next
`tick_once` succeeds, the job processes — the retry + backoff-sleep
arms execute for real;
- (b) exhaustion: the seam faults the max retry count, the loop
exhausts to the typed error shape and the `eprintln` diagnostic
fires, the runner survives (the resilience property the fix
promised).
Cross-test safety is per-store scoping (the commit-fault seam's
pattern); no production-path changes — the seam is cfg-gated, born
disarmed, consumed-on-use.
## Acceptance Criteria
- [ ] The seam lands cfg(test)-gated; the real `tick_with_retries`
executes under test (no loop replication)
- [ ] Arms (a) and (b) pinned as above; the runner survives
exhaustion
- [ ] `cargo test -p alkstore-postgres` green against the harness
server; skips clean server-less
- [ ] Clippy `-D warnings`, fmt clean; workspace gates green
## References
- docs/reviews/003-wave-5-general-review.md §Finding 1 (sites, lcov
inventory, recommendation)
- docs/architecture/decisions/024-mem-engine.md (the wave-6 window
this rider rides — the plan's wave-6 section, "Riding the window")
- tasks/sqlite-commit-error-arm.md (the seam pattern of record)
- tasks/pg-fix-scheduler-resilience.md (the constants the loop uses)
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion