mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Two `#[ignore]` live-Postgres tests layered on Max's `process_scheduled_workflow_at` seam (df997d7cc), each pinning an invariant the existing F4 coverage intentionally does NOT pin: orphan_claim_blocks_refire_at_same_canonical_instant Pre-INSERTs a `scheduled_workflow_fires` claim row with `workflow_run_id = NULL` (simulating a prior pod that won the claim then died before `create_workflow_run`), then calls the seam for the same canonical `scheduled_for`. Asserts `Option<Uuid> == None`, zero rows in `workflow_runs`, single claim row unchanged. Proves the claim row alone — not claim + attached run — is the dedupe boundary. A refactor that ever made `attach_scheduled_workflow_run` (or the `workflow_runs` row) the gate instead of the claim row would still pass `scheduled_cron_claim_is_exactly_once_across_two_engines` (success-path only) but must fail this one. Uses a fixed daily cron (`0 12 * * *`) with `now = 12:00:30Z` so the canonical instant is trivially `12:00:00Z` — closes the alignment hazard Sami flagged where an off-by-one `scheduled_for` would silently exercise the wrong PK and produce a false failure (verified: shifting the orphan INSERT to `12:00:01Z` breaks the test loudly). adjacent_interval_boundaries_produce_distinct_runs Engine-layer companion to Sami's DB-layer `clock_skewed_adjacent_windows_each_claim_independently` (9652037ec). Feeds two `now` values straddling a 60s interval boundary through the seam; assert each returns a `Some(run_id)` and the two run ids differ. Asserts 2 claim rows + 2 workflow_runs rows. Exercises the seam's own canonical-boundary math (`interval_should_fire`) end-to- end — the property `71da65e51` was designed to provide is now observable through the engine surface. Adversarial verify: replacing the canonical-boundary computation with `Some(anchor)` (max coalescing) makes the test fail loudly at `expect("second canonical boundary must fire")`. Both tests reuse Max's `connect_test_db` helper and the unique-uuid- per-test convention (Sami's F1/F4) — no harness work owed. Validation (all hermit cargo): - fmt --check -p buzz-workflow ✅ - clippy -p buzz-workflow --tests --no-deps -- -D warnings ✅ - test -p buzz-workflow --lib ✅ — 145 passed, 3 ignored - test -p buzz-workflow --lib -- --ignored ✅ — 3 passed (orphan_claim, adjacent_interval, scheduled_cron_claim) - check -p buzz-relay ✅ Co-authored-by: Tyler Longwell <tlongwell@block.xyz> Signed-off-by: Tyler Longwell <tlongwell@block.xyz>