You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Run comparator cells in recycled worker processes - #7063
run-comparator-cells-in-recycled-workersdatamodel-code-generator/datamodel-code-generator:run-comparator-cells-in-recycled-workersCopy head branch name to clipboard
run-comparator-cells-in-recycled-workersdatamodel-code-generator/datamodel-code-generator:run-comparator-cells-in-recycled-workersCopy head branch name to clipboard
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
Walkthrough
Generation now runs in warm workers that handle multiple jobs. Each job has isolated output, working-directory, timeout, warning, and memory-limit handling. Workers are recycled under defined conditions, while import checks run in forked children.
Changes: Warm comparison workers
Layer / File(s)
Summary
Worker behavior and comparison options docs/development-contributing.md, scripts/compare_release.py, scripts/behaviour_diff.py, tests/test_behaviour_diff_script.py
The documentation describes warm workers and their recycling. behaviour_diff.py excludes both --watch and --debug and describes the memory cap as applying to worker data memory. The Windows skip reasons list the required POSIX features.
Isolated job execution scripts/compare_release.py
Generation runs in the worker under a scope that restores output redirection, working directory, and alarm settings. Memory caps apply to generator execution. Import checks use forked children.
Worker lifecycle and verification scripts/compare_release.py, tests/test_compare_release_script.py, tests/test_compare_release_script.refs
Runner replaces workers after the recycle limit, process exit, out-of-memory results, or state-changing options. Tests cover worker reuse, import failures, debug runs, recycling, and out-of-memory replacement.
Comparator cells now run in recycled warm workers. The remaining concern is that an import check forked from a warm worker could inherit stale modules and miss a failing generated module. No current comparison cell is shown to trigger this, so the risk is low and limited to the release-comparison tooling.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "Run comparator cells in recycled worker processes" matches the main change in the changeset. The raw summary shows that scripts/behaviour_diff.py and scripts/compare_release.py now use warm…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "Run comparator cells in recycled worker processes" matches the main change in the changeset. The raw summary shows that scripts/behaviour_diff.py and scripts/compare_release.py now use warm, recycled workers that run jobs in-process, replacing a fresh forked child per generation. The title names the primary change (recycled workers) and the subject (comparator cells). It omits details such as memory caps, timeouts, and the test additions, which the title does not need to cover. The PR objectives describe the same intent, so the title is consistent with the stated goal.
Finishing Touches
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.
⚠️53 benchmarks with a significant change ran on different hardware
Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.
The reason will be displayed to describe this comment to others. Learn more.
Additional comments: 1
scripts/compare_release.py-305-305: 1
305-305: Major · Functional Correctness · Quick win
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Remove generation-loaded modules from import checks.
If --custom-formatters model loads an importable formatter module, generation leaves model in the worker's sys.modules. This child inherits that entry. _import_modules then imports "model" and returns the formatter instead of executing the generated model.py. A generated file containing raise ImportError("generated failure") therefore passes the import check. Previously, the formatter import stayed in the separate generation child. (raw.githubusercontent.com)
Start import checks from a clean worker, or remove generated module names and their package trees before importing them.
Reviewing files that changed from the base of the PR and between 1e18f32 and c18ef24.
Files ignored due to path filters: 3
docs/llms-full.txt is excluded by none and included by none
tests/data/expected/compare_release_script/a_run_out_of_memory_closes_its_worker.txt is excluded by !tests/data/**/*.txt and included by none
tests/data/expected/compare_release_script/a_worker_runs_each_job_as_a_fresh_process.txt is excluded by !tests/data/**/*.txt and included by none
Files selected for processing: 6
docs/development-contributing.md
scripts/behaviour_diff.py
scripts/compare_release.py
tests/test_behaviour_diff_script.py
tests/test_compare_release_script.py
tests/test_compare_release_script.refs
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Reasoning: The PR only touches internal developer tooling and its tests and docs: scripts/compare_release.py now runs generations inside warm workers rather than a forked child per run, adds worker recycling, a memory cap context manager and fresh workers for --debug runs; scripts/behaviour_diff.py excludes --debug from its cells and rewords a help string; contributor documentation and test files are updated to match. Nothing under the datamodel_code_generator package source, its CLI options, Python API, templates, defaults, error handling or supported Python versions is changed. The behaviour diff gate lists only both-fail cells, with no accepted or violation cells, so default generated output is unchanged. The changes do not affect users of the released package, so there are no breaking changes.
This analysis was produced by the release draft workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by CodeRabbit
Documentation
Chores