Skip to content

test(ci): check stale-lock auto-recovery by retry count, not wall clock - #4986

Merged
zackees merged 1 commit into
masterfrom
fix/4984-stale-lock-timing
Oct 31, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/4984-stale-lock-timing

Conversation

@zackees

@zackees zackees commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Closes #4984

test_auto_recovery_on_timeout checked a 2 s wall-clock bound. Under a loaded ./test run, SQLite latency alone took 1.75 to 5.47 s, so the test failed. Run alone it takes about 0.07 s.

The test now patches time.sleep in ci.util.file_lock_rw and requires zero retry sleeps. A correct auto-break returns right after breaking the stale lock, so this checks the same thing without depending on timing.

Evidence:

  • pytest ci/tests/test_stale_lock_recovery.py: 4 passed.
  • Mutation check: with LockDatabase.is_lock_stale patched to return False, the test fails as expected.
  • bash lint passes.

Summary by CodeRabbit

  • Tests
    • Updated automated coverage for stale lock recovery to verify that lock acquisition succeeds without unnecessary retry delays.
    • Removed elapsed-time measurement and duration output from the test, making its check independent of timing.

@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between a96b4a3 and 0fcf203.

Files selected for processing: 1
  • ci/tests/test_stale_lock_recovery.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Walkthrough

The stale-lock recovery test replaces elapsed-time measurement and a two-second bound with a patched sleep function and an assertion that successful acquisition causes no retry sleeps. The timeout failure check remains.

Changes: Stale lock recovery test

Layer / File(s) Summary
Verify acquisition without retry sleeps
ci/tests/test_stale_lock_recovery.py
The test patches the lock sleep function and asserts that acquisition succeeds without retry sleeps. It retains the timeout failure check.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

Suggested labels: area: ci

Merge Risk: Minimal · up to 0fcf2

The test retains stale-lock recovery checks while removing sensitivity to SQLite latency. No actionable merge-blocking issue remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: replacing the stale-lock test's wall-clock timing check with retry-count behavior.
Linked Issues check Passed Issue #4984 identifies the flaky 2-second wall-clock assertion in test_auto_recovery_on_timeout. The PR removes that timing assertion and patches ci.util.file_lock_rw.time.sleep. The test now asse…
Out of Scope Changes check Passed The diff changes only ci/tests/test_stale_lock_recovery.py. The import, mock, and assertion changes directly support the #4984 flaky-test fix. No unrelated production code or unrelated behavior chan…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

Issue #4984 identifies the flaky 2-second wall-clock assertion in test_auto_recovery_on_timeout. The PR removes that timing assertion and patches ci.util.file_lock_rw.time.sleep. The test now asserts that stale-lock recovery completes without retry sleeps. This checks immediate stale-lock recovery without a load-dependent timing bound.

Full details: Out of Scope Changes check

Explanation

The diff changes only ci/tests/test_stale_lock_recovery.py. The import, mock, and assertion changes directly support the #4984 flaky-test fix. No unrelated production code or unrelated behavior changes are present.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@zackees
zackees merged commit 230934b into master Oct 31, 2026
121 checks passed
@zackees
zackees deleted the fix/4984-stale-lock-timing branch October 31, 2026 20:01
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

flaky-test: test_stale_lock_recovery::test_auto_recovery_on_timeout exceeds its 2s bound locally

1 participant