Skip to content

fix: stop the stale-reap test racing the clock - #609

Merged
kartikeya-27 merged 1 commit into
masterfrom
fix/flaky-reap-stale-test
Aug 2, 2026
Merged

fix: stop the stale-reap test racing the clock#609
kartikeya-27 merged 1 commit into
masterfrom
fix/flaky-reap-stale-test

Conversation

@pratyush618

@pratyush618 pratyush618 commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

test_reap_stale_jobs_only_returns_expired fails intermittently on master — most
recently in the push-dispatch step of the SQLite job on run 30745567038, with
left: 0, right: 1.

The feature is a red herring. The test captures t0 before enqueuing, but
make_job defaults scheduled_at: now_millis(). When a millisecond ticks over
between the two, scheduled_at > t0, the candidate scan's scheduled_at <= now
matches nothing, both dequeues claim nothing, and the reap finds no running job.

Pins both jobs' scheduled_at to t0, so every timestamp in the test derives
from one clock reading. Skewing it by 1 ms first reproduces the CI assertion
exactly; every other dequeue in the suite already cushions with +1000 or reads
the clock after the enqueue.

Summary by CodeRabbit

  • Tests
    • Improved stale-job reaping test setup to reliably verify that only jobs exceeding their timeout are removed.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 92cf1c7a-bb95-4111-94d7-0370d83d0935

📥 Commits

Reviewing files that changed from the base of the PR and between 2006dab and b863729.

📒 Files selected for processing (1)
  • crates/taskito-core/src/storage/sqlite/tests.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • ByteVeda/taskito (manual)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/taskito-core/src/storage/sqlite/tests.rs

📝 Walkthrough

Walkthrough

The stale-job reaping test sets both jobs’ scheduled_at values to the shared t0. This ensures both jobs qualify for dequeue before timeout behavior is verified.

Changes

Stale-job reaping test

Layer / File(s) Summary
Pin job schedules for dequeue validation
crates/taskito-core/src/storage/sqlite/tests.rs
The test assigns t0 to both jobs’ scheduled_at values. Existing timeout assertions remain unchanged.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the fix for the intermittent stale-reap test clock race.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@kartikeya-27
kartikeya-27 force-pushed the fix/flaky-reap-stale-test branch from 2006dab to b863729 Compare August 2, 2026 13:13
@kartikeya-27
kartikeya-27 merged commit e0492f4 into master Aug 2, 2026
33 checks passed
@kartikeya-27
kartikeya-27 deleted the fix/flaky-reap-stale-test branch August 2, 2026 13:48
@pratyush618 pratyush618 mentioned this pull request Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants