Files
alkstore/tasks/suite-opts-backoff-rows.md
T

81 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: suite-opts-backoff-rows
name: Contract-suite rows — backoff-curve equivalence + the deferred enqueue-opts clock legs
status: pending
depends_on: []
scope: narrow
risk: low
impact: phase
level: implementation
tags: [wave-5, contract-suite, queues]
---
## Description
Complete the arithmetic-equivalence backlog rows
(core-contract.md §Verification backlog): "Backoff-curve and
stamp-resolution equivalence across engines" and the two
wall-clock-adjacent legs the existing `enqueue_opts_resolution` row
explicitly deferred ("The `run_at`-alone-literal and
neither-field-resolves-to-now legs ... pin with wave 5's equivalence
row").
Work:
- **Extend `enqueue_opts_resolution` in place** (one owner per
property — the row's own doc comment names this wave-5 completion;
stamps accumulate per the convention): the `run_at`-alone literal
leg (a future `run_at` is the row's ready time verbatim; a past
`run_at` resolves to ready-now — the boundary-total rule, ADR-023
§2) and the neither-field leg (ready now — tolerance-bounded
proximity, never a tight timing assert).
- **Add `backoff_curve_equivalence`** — the equal-jitter exponential
curve (ADR-010 §3): `delay ∈ [base·2^(a−1)/2, base·2^(a−1)]` per
attempt, uniform jitter over the lower half — *the range, not a
jitter label, is the definition*. Drive claim → `retry(err, None)`
cycles on a queue with a small `backoff_base_s` stamp (2 s keeps
the integer-second row resolution honest: ranges [1,2], [2,4],
[4,8] across the first attempts; the inter-attempt waits stay
tolerance-bounded and sequential), reading the computed delay back
via `get_job`'s `run_at` minus now, asserting range membership per
attempt on both engines — identical bounds is the equivalence pin
(ADR-012 §2: engine-side arithmetic, suite-pinned identical
outputs). Include the explicit-delay override leg
(`retry(err, Some(d))` honored — a `Some(0)` resolves ready-now per
the boundary-total rule). **The 1-hour cap leg is not
suite-pinnable** (reaching capped attempts requires waiting out
minute-scale delays); it stays pinned engine-side (both engines'
unit tests already pin the curve against the ADR text — the
wave-3/4 reviews verified it) — record that disposition in Notes
for the review gate.
## Acceptance Criteria
- [ ] `enqueue_opts_resolution` extended with both clock legs; its
doc comment's deferral note updated (stamps accumulate)
- [ ] `backoff_curve_equivalence` exists, version-stamped (ADR-010 §3,
ADR-020 §1–§3, ADR-012 §2, ADR-023 §2)
- [ ] Rows wired into both engines' `contract_suite.rs` targets
- [ ] SQLite column green server-less; pg column green against the
harness server
- [ ] The cap-leg disposition recorded in Notes
- [ ] `cargo test -p alkstore-sqlite -p alkstore-postgres` green
(pg rows skip cleanly server-less); clippy `-D warnings`; fmt clean
## References
- docs/architecture/core-contract.md §Verification backlog (backoff-curve
and stamp-resolution equivalence; enqueue-opts resolution equivalence)
- docs/architecture/decisions/010-queue-semantics-depth.md §3
- docs/architecture/decisions/020-enqueue-opt-semantics-and-bridges.md §1–§3
- docs/architecture/decisions/012-forked-substrate-design.md §2
- alkstore-contract-suite/src/properties.rs (`enqueue_opts_resolution`'s
deferral note)
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion