Files
alkstore/alkstore-contract-suite/src/lib.rs
T
glm-5.3-flash 36023914b2 Contract-suite rows (task suite-opts-backoff-rows): the backoff-curve equivalence row and the deferred enqueue-opts clock legs. backoff_curve_equivalence — the equal-jitter exponential pinned as the range, not a jitter label (ADR-010 §3): claim → retry(err, None) cycles on a backoff_base_s = 2 queue land the ranges [1,2], [2,4], [4,8] across attempts 1–3, each computed delay read back through get_job's resolved run_at minus a clock read taken before the retry — the lower bound race-free (the retry's internal clock read cannot precede the suite's, so the observed value over-reads the delay, never under-reads) and the upper bound carrying a one-second straddle tolerance for the integer-second stamp crossing a wall second; identical bounds on both engines is the equivalence pin (ADR-012 §2, the row body shared). The explicit-delay override legs ride the same row: retry(err, Some(5)) honored verbatim ([5, 6] under the same straddle tolerance) and retry(err, Some(0)) resolving ready-now per the boundary-total rule (ADR-023 §2), claimed within a bounded wait. enqueue_opts_resolution extended in place with the wave-5 legs its deferral note named — the run_at-alone literal leg (a future run_at is the row's ready time verbatim, a deterministic equality with no clock read involved; a past run_at stores the literal too and is claimable now through the run_at <= now predicate within a bounded wait, the run_at-ASC ordering making the observation unambiguous among the row's other legs) and the neither-field leg (ready at the enqueue instant, abs_diff(now) <= 5 tolerance-bounded proximity, never a tight timing assert); the deferral note replaced by the completion statement, ADR-023 §2 stamp accumulated per the convention (ADR-020 §1 governs the resolutions). Cap-leg disposition recorded in Notes for the review gate: the 1-hour cap is not suite-pinnable (capped attempts need minute-scale waits) and stays pinned engine-side on both engines' unit tests per the wave-3/4 reviews. Ready-now waits are bounded claim_one poll loops (deadline asserts only, sequential single-store drive), with the one draft defect the finding surfaced (a re-claim after the bounded wait consumed nothing; the helper returns the claimed handle) noted. Wired into both engines' suite targets (SQLite tokio test, pg harness_row!), 25 rows per column up from 24. Verified: SQLite column green server-less (25/25 suite, 189 lib), pg column green vs harness (postgres/poc@:15432 — 25/25 suite, 121 lib + 9 schema), 3 solo re-runs of each new/extended row per engine (determinism), server-less pg skips cleanly via the reachability gate, cargo test -p alkstore-sqlite -p alkstore-postgres green, clippy -D warnings, fmt clean
2026-10-10 07:26:55 +00:00

52 lines
2.6 KiB
Rust

//! alkstore-contract-suite — the contract suite crate (ADR-022).
//!
//! The suite is the [verification
//! backlog](../../docs/architecture/core-contract.md) property set
//! parameterized over a [`StoreFactory`] — one normative owner per
//! property (the one-owner rule, ADR-012 §2 applied to test
//! artifacts); each engine crate consumes the suite as a
//! *dev*-dependency and drives its rows against its own factory. The
//! crate is internal and unpublished (`publish = false`, depends on
//! `alkstore` only); ADR-017 §4.2's "layout decided at implementation"
//! deferral is discharged by
//! [ADR-022](../../docs/architecture/decisions/022-contract-suite-layout.md).
//!
//! # Row structure
//!
//! Each backlog row is one named, independently-runnable property — a
//! public async function taking `&dyn StoreFactory` — with a
//! **version stamp** per the suite's [version-stamp
//! convention](version_stamp): a doc-comment line citing the contract
//! change (ADR §) that added the row (ADR-017 §4.2's no-silent-change
//! discipline applied to the suite itself). Wave 3/4 engine tasks run
//! the existing rows against their engines; wave 5 fills the
//! cross-engine equivalence rows.
//!
//! # Crate posture
//!
//! This is a test-side artifact (ADR-001 §4's posture), not contract
//! surface: rows assert with panics on violation — a failing row is a
//! test failure naming the entry point and expectation — so the
//! family-wide no-panic rule is relaxed here by the crate's purpose.
//! Suite-side changes are contract-non-events (ADR-017 §2 class 4:
//! the suite tests the contract, it is not the contract); a row added
//! for a *contract* addition is stamped with that addition's ADR.
pub mod factory;
pub mod properties;
pub mod version_stamp;
pub use factory::StoreFactory;
pub use properties::{
backoff_curve_equivalence, concurrent_try_lock_loser_is_a_value,
duration_refusal_on_non_positive_ttl, enqueue_opts_resolution, extent_clamp_semantics,
in_tx_reads_see_own_writes, job_handle_validity_predicate, lock_ttl_expiry_and_reacquisition,
name_validation_rejects_empty_and_reserved, outbox_enqueue_tx_commit_atomicity,
payload_round_trip_stores_exact_encoding, payload_too_large_never_produced_on_sqlite,
payload_too_large_produced_on_pg, publish_with_key_tx_commit_atomicity,
queue_depth_reclaim_and_dead_letter, receiver_close_and_save_arms, scheduler_boundary_fires,
scheduler_bounded_catchup, scheduler_leadership_discipline, stream_ordering_equivalence,
sweep_no_stranded_rows, trim_to_semantics, wake_receiver_shapes,
with_tx_panicking_closure_rolls_back,
};