fix(runtime): make unknown-job sweep tests deterministic #663

Merged
toasterson merged 1 commit from fix/runtime-sweep-deterministic-clock into main 2026-10-16 10:24:30 +00:00
Owner

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 missing unknown_since records 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.
  • Sweep tests repeated in 20 trials across four concurrent processes: 100/100 test executions passed.
  • File-scoped rustfmt and git diff --check: passed.
  • CI full session-platform feature-set library tests: 173 passed, 0 failed, 6 ignored (original Solstice task 37356, request 32070818-2d96-4a55-b6e7-d86bc3a0eba9). Whole-run CI: 15/15 jobs passed in run 4306 at cc705e4b6c5201b7b2d18d36e1318858d6d111fa, 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.

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 missing `unknown_since` records 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. - Sweep tests repeated in 20 trials across four concurrent processes: 100/100 test executions passed. - File-scoped rustfmt and `git diff --check`: passed. - CI full session-platform feature-set library tests: 173 passed, 0 failed, 6 ignored (original Solstice task 37356, request `32070818-2d96-4a55-b6e7-d86bc3a0eba9`). Whole-run CI: **15/15 jobs passed** in [run 4306](https://code.aopc.cloud/toasterson/akh-medu/actions/runs/4306) at `cc705e4b6c5201b7b2d18d36e1318858d6d111fa`, 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.
fix(runtime): use deterministic time in unknown-job sweep tests
All checks were successful
CI / check-seshat (pull_request) Successful in 5m46s
CI / test-sokar (pull_request) Successful in 6m50s
CI / test-sokar-sharing (pull_request) Successful in 9m12s
CI / docker-seshd (pull_request) Successful in 6m50s
CI / docker-akh-transcripts (pull_request) Successful in 7m6s
CI / test-session-platform (pull_request) Successful in 22m56s
CI / publish-chart (pull_request) Successful in 11m9s
CI / test-akh-medu (pull_request) Successful in 23m13s
CI / check-akh-medu (pull_request) Successful in 28m7s
CI / docker-sokard (pull_request) Successful in 21m25s
CI / platform-images-home (pull_request) Successful in 1m11s
CI / platform-images-daemons (pull_request) Successful in 1m20s
CI / platform-images-core (pull_request) Successful in 1m25s
CI / platform-images-fleet (pull_request) Successful in 57s
CI / platform-images-collect (pull_request) Successful in 1m7s
cc705e4b6c
toasterson deleted branch fix/runtime-sweep-deterministic-clock 2026-10-16 10:24:37 +00:00
Sign in to join this conversation.
No reviewers
No labels
follow-up
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
toasterson/akh-medu!663
No description provided.