tests: priority-aging end-to-end checks for queue_storage runtime claim#249
Conversation
Two tests covering both branches of the aging guard in ReadyJobLeaseRow::into_job_row: - test_priority_aging_lifts_effective_priority_and_records_original: enqueues a priority-4 job, waits 250 ms, claims with a 100 ms aging interval, asserts the claimed job's effective priority is < 4 and metadata._awa_original_priority records the lane priority of 4. - test_priority_aging_off_does_not_stamp_original: same enqueue but with a 1 hour aging interval; asserts effective priority equals lane priority and metadata._awa_original_priority is absent. Pins the no-aging branch so a future refactor cannot accidentally always-stamp the metadata. Motivated by the 2026-05-09 sweep's starvation_awa_60min cell reporting aged_completion_rate=0 across a 60 minute soak. The mechanism works at the SQL level (these tests pass at a 100 ms interval); the bench-side gap is that JOB_WORK_MS=1 with rate=300 doesn't create the queue starvation needed to reach the 60 s default aging interval. Tracked as a follow-up to lower the bench cell's aging interval or raise producer rate above worker capacity for the high-priority lane.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds two Tokio integration tests to verify priority-aging behavior in the queue storage runtime. The tests exercise claim operations with aging both enabled and disabled, validating that effective priority is adjusted and metadata is stamped appropriately when aging triggers. ChangesPriority-Aging Tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Two unit tests pinning the priority-aging mechanism in `QueueStorage::claim_runtime_batch_with_aging`. Motivated by the 2026-05-09 cross-system sweep's `starvation_awa_60min` cell reporting `aged_completion_rate=0` across a 60 minute soak — confirms the mechanism is in fact working, so the gap is on the bench side.
What this isn't fixing
The bench cell `aged_completion_rate=0` is real but downstream of these tests. `JOB_WORK_MS=1` with `rate=300` doesn't accumulate enough wait time on the priority-4 lane to hit the bench's 60 s default aging interval. Two options:
Tracked as a follow-up; does not need to land in this PR.
Test plan
Summary by CodeRabbit