fix(runtime): make unknown-job sweep tests deterministic #663
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/runtime-sweep-deterministic-clock"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #662.
The unknown-job sweep test could age its supposedly fresh fixture past the 1,000 ms threshold while redb committed or the runner was descheduled. This change passes one clock sample through a private
resolve_stale_unknown_jobs_at(now)implementation and uses it to initialize missingunknown_sincerecords too. Production continues to call the public wrapper with the real clock; expiry thresholds, ownership fencing, and reconciliation policy are unchanged.Tests use fixed logical timestamps for threshold-minus-one, exact-threshold, past-threshold, and future clocks. They check missing-clock initialization without reset, repeat sweeps, archived receipt visibility and side-key cleanup, restart preservation, active workers, foreign runtimes, Internal jobs, and disposable jobs (including removed profiles with retained generation receipts). The fixture threshold remains 1,000 ms. There are no added sleeps or wider timeouts.
Validation:
cargo test -p akh-session-services --no-default-features --features runtime --lib: 79 passed.git diff --check: passed.32070818-2d96-4a55-b6e7-d86bc3a0eba9). Whole-run CI: 15/15 jobs passed in run 4306 atcc705e4b6c5201b7b2d18d36e1318858d6d111fa, including the complete platform storage harness and all dependent image checks. No retry or timeout changes were needed.This is the separately authorized follow-up after Talos #220 / platform-storage PR 6 and before PR 7. It does not change manifests or activate workloads. No local Docker harness was run because this change touches only the runtime clock and its tests; local builds use the dedicated lean target, without candle/core feature compilation.
Issue #662 records three distinct incidents: the sweep timing failure, an analogy failure, and the SQLite contention fixture subsequently fixed in #661. This PR fixes the sweep only; it does not claim to fix the analogy test.