Optimize chaos test setup and add type checking#195
Conversation
|
Claude finished @chrisguidry's task —— View job PR Review: Bump the timeout for the chaos testsI've reviewed the changes in this PR. Here's my analysis: Todo List
SummaryThis PR increases the GitHub Actions timeout for chaos tests from 2 to 3 minutes and refactors the chaos test setup to use pre-created virtual environments instead of on-the-fly Changes Review1. Environment Setup Optimization (
|
|
📚 Documentation has been built for this PR! You can download the documentation directly here: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #195 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 43 43
Lines 7197 7197
Branches 369 369
=========================================
Hits 7197 7197
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
## Performance optimization The chaos tests spawn 15 processes (5 producers + 10 workers), each randomly using either the base version or main version of pydocket. Previously, each process used `uv run --isolated --with pydocket==X.Y.Z`, which created a new isolated environment for every spawn (~0.45s each = ~6.75s total overhead). Now we create two persistent virtual environments upfront (one for base version, one for main) and use the Python executables directly from those environments. This reduces the setup time from ~6.75s to ~1s, saving about 5-6 seconds per chaos test run. ## Type checking improvements Added pyright type checking for the chaos test suite: - Added chaos/ to pyright include paths in pyproject.toml - Added new pre-commit hook for pyright (chaos tests) - Fixed type errors from incomplete third-party library stubs (docker, redis) with type: ignore comments All pre-commit hooks now pass including the new chaos type checking. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
croniter 6.0.0 has two unbounded memory leaks ([#182](pallets-eco/croniter#182), [#195](pallets-eco/croniter#195)) that are fixed in main but unreleased — and the project was declared unmaintained by Pallets Community Ecosystem in March 2025, so no release is coming. It also drags in pytz and python-dateutil as transitive deps. cronsim is actively maintained (~280 lines, zero deps, Python 3.10+), used in production by Healthchecks.io, and handles DST via zoneinfo natively. One gap: cronsim doesn't support Vixie keywords (@daily, @hourly, etc.), so we add a small mapping dict that expands them before passing to CronSim. Also extracted `Cron.next_time()` so tests mock at docket's abstraction level rather than the library's internals, and added contract tests that exercise the real cronsim integration (sequential times, timezone handling, keyword validity). Companion conda-forge PR: conda-forge/pydocket-feedstock#34 Closes #362 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
croniter 6.0.0 has two unbounded memory leaks ([#182](pallets-eco/croniter#182), [#195](pallets-eco/croniter#195)) that are fixed in main but unreleased — and the project was declared unmaintained by Pallets Community Ecosystem in March 2025, so no release is coming. It also drags in pytz and python-dateutil as transitive deps. cronsim is actively maintained (~280 lines, zero deps, Python 3.10+), used in production by Healthchecks.io, and handles DST via zoneinfo natively. One gap: cronsim doesn't support Vixie keywords (@daily, @hourly, etc.), so we add a small mapping dict that expands them before passing to CronSim. Also extracted `Cron.next_time()` so tests mock at docket's abstraction level rather than the library's internals, and added contract tests that exercise the real cronsim integration (sequential times, timezone handling, keyword validity). Companion conda-forge PR: conda-forge/pydocket-feedstock#34 Closes #362 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
The chaos tests spawn 15 processes (5 producers + 10 workers) that randomly use either the latest PyPI release or the current main branch. This helps catch data contract issues when introducing changes.
Previously, each process used `uv run --isolated --with pydocket==X.Y.Z`, creating a new isolated environment for every spawn (~0.45s each). With 15 processes, that's about 6.75 seconds of overhead just for environment setup.
Changes
Performance optimization:
Type checking improvements:
The optimization saves about 5-6 seconds per chaos test run while maintaining the same random version selection behavior for migration testing.
🤖 Generated with Claude Code
Co-authored-by: Claude noreply@anthropic.com