perf(test): speed up test suite -- reduce Hypothesis examples and eliminate real sleeps#557
perf(test): speed up test suite -- reduce Hypothesis examples and eliminate real sleeps#557
Conversation
…minate real sleeps Lower CI Hypothesis profile from 200 to 50 examples (property tests find bugs in the first ~20; 200 was overkill for CI feedback loops). Replace 8x asyncio.sleep(0.05) with asyncio.sleep(0) in unit tests -- cooperative yielding preserves concurrency semantics without wasting wall-clock time. Replace 1x fixed sleep with condition poll in test_task_engine_coverage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pre-reviewed by 3 agents, 1 finding addressed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🧰 Additional context used📓 Path-based instructions (2)**/*.py📄 CodeRabbit inference engine (CLAUDE.md)
Files:
tests/**/*.py📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (10)📓 Common learnings📚 Learning: 2026-03-15T11:48:14.867ZApplied to files:
📚 Learning: 2026-03-18T20:21:08.353ZApplied to files:
📚 Learning: 2026-03-18T20:21:08.353ZApplied to files:
📚 Learning: 2026-03-18T20:21:08.353ZApplied to files:
📚 Learning: 2026-03-15T11:48:14.867ZApplied to files:
📚 Learning: 2026-03-15T11:48:14.867ZApplied to files:
📚 Learning: 2026-03-15T11:48:14.867ZApplied to files:
📚 Learning: 2026-03-18T20:21:08.353ZApplied to files:
📚 Learning: 2026-03-18T20:21:08.353ZApplied to files:
🔇 Additional comments (10)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThese changes optimize test execution by reducing Hypothesis test case counts in CI, replacing intentional sleep delays with zero-duration sleeps or polling mechanisms, and updating testing documentation regarding flaky test handling. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
📝 Coding Plan
Comment |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the efficiency of the test suite by optimizing property-based testing and asynchronous test execution. It reduces the number of examples run for Hypothesis in CI, and replaces fixed time delays with cooperative yielding or condition polling in several unit tests. These changes aim to provide faster feedback cycles in CI and enhance the determinism of timing-sensitive tests, without compromising test coverage or reliability. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request focuses on improving the performance of the test suite. The changes include reducing the number of examples for Hypothesis property-based tests in the CI profile, and replacing fixed-time asyncio.sleep() calls with asyncio.sleep(0) or a more robust polling mechanism. These are excellent changes that will speed up the CI feedback loop and make the tests more reliable. I have one minor suggestion to improve the maintainability of the new polling loop by avoiding a magic number.
| ) | ||
| await asyncio.sleep(0.05) | ||
| # Wait for the engine to enter _process_one and hit slow_save | ||
| for _ in range(200): |
There was a problem hiding this comment.
The polling limit 200 is a magic number. It's also hardcoded in the assertion message on line 62. To improve readability and maintainability, consider defining it as a constant at the start of the test method (e.g., MAX_POLL_YIELDS = 200) and using it in both the loop and in an f-string for the assertion message. This will ensure they stay in sync.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #557 +/- ##
=======================================
Coverage 92.45% 92.45%
=======================================
Files 544 544
Lines 26783 26783
Branches 2554 2554
=======================================
Hits 24762 24762
Misses 1615 1615
Partials 406 406 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🤖 I have created a release *beep* *boop* --- ## [0.3.5](v0.3.4...v0.3.5) (2026-03-18) ### Features * **api:** auto-wire backend services at startup ([#555](#555)) ([0e52c47](0e52c47)) ### Bug Fixes * **api:** resolve WebSocket 403 rejection ([#549](#549)) ([#556](#556)) ([60453d2](60453d2)) * **cli:** verify SLSA provenance via GitHub attestation API ([#548](#548)) ([91d4f79](91d4f79)), closes [#532](#532) ### Performance * **test:** speed up test suite -- reduce Hypothesis examples and eliminate real sleeps ([#557](#557)) ([d5f3a41](d5f3a41)) ### Refactoring * replace _ErrorResponseSpec NamedTuple with TypedDict ([#554](#554)) ([71cc6e1](71cc6e1)) ### Maintenance * **docker:** suppress pydantic v1 warning on Python 3.14 ([#552](#552)) ([cbe1f05](cbe1f05)), closes [#551](#551) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Summary
test_resolver.pyuse the global profile; 74/77 property tests have explicit per-test@settings)asyncio.sleep(0.05)withasyncio.sleep(0)in 4 unit test files -- cooperative yielding preserves concurrency semantics without wasting wall-clock timetest_task_engine_coverage.py-- polls_in_flightstate up to 200 yields instead of a fixed 50ms delayTest plan
Review coverage
Pre-reviewed by 3 agents (docs-consistency, test-quality, async-concurrency), 1 finding addressed (descriptive assertion message on poll loop).
🤖 Generated with Claude Code