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
Record the builder homes of L1 and guard their bypasses - #7294
Clarified the documented rules and limitations for how parsed outputs are built and handed off.
Tests
Expanded automated checks for builder conventions, dispatch-table usage, and documented exceptions, including seeded test cases. These checks help catch missing or outdated records and inconsistencies.
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
No actionable comments were generated in the recent review.
Walkthrough
This change adds builder-home records and AST-based checks for builder ownership, dispatch-table use, and marked outputs. It documents the checks, records current bypasses, and includes the bypass allowlist in ratchet counts.
Changes: Builder home guard
Layer / File(s)
Summary
Define builder-home records scripts/decision_homes.py
Adds and exports Mark, BuilderHome, and BUILDER_HOMES records for parser outputs and their builders.
Validate builder homes and bypasses tests/test_decision_homes.py
Adds AST-based validation for builder records and bypass detection. Seeded tests cover dispatch tables, marked outputs, and invalid or missing records.
Document and track bypasses docs/architecture.md, tests/decision_home_allowlist.py, scripts/check_ratchets.py, tests/test_decision_homes.py
Documents the checks and their syntactic limits. Adds the BUILDER_BYPASSES baseline and includes it in ratchet counts. Tests compare discovered bypasses with the baseline.
This change adds test-only guards that record where L1 builders live and flag direct calls that bypass them. It adds no runtime behavior. The guard tests were not run in this review, so confirm they pass in CI before merging.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "Record the builder homes of L1 and guard their bypasses" matches the main change. The PR adds BuilderHome and Mark records and BUILDER_HOMES in scripts/decision_homes.py, adds BUILDER_BYPAS…
Linked Issues check
[#7289] The issue asks for three things: (1) builder homes recorded as data next to the decision homes, (2) a generated guard per record in tests/test_decision_homes.py, (3) a shrinking baseline with …
Out of Scope Changes check
All changed areas trace to #7289. scripts/decision_homes.py adds the records the issue requests. tests/test_decision_homes.py adds the guards that read those records. tests/decision_home_allowlist.py …
Full details: Title check
Explanation
The title "Record the builder homes of L1 and guard their bypasses" matches the main change. The PR adds BuilderHome and Mark records and BUILDER_HOMES in scripts/decision_homes.py, adds BUILDER_BYPASSES in tests/decision_home_allowlist.py, and adds AST-based guard tests in tests/test_decision_homes.py. The title is short, specific, and uses the same terms as the linked issue #7289.
Full details: Linked Issues check
Explanation
[#7289] The issue asks for three things: (1) builder homes recorded as data next to the decision homes, (2) a generated guard per record in tests/test_decision_homes.py, (3) a shrinking baseline with a ratchet key, as in #7253.
(1) Recorded as data: scripts/decision_homes.py adds the Mark and BuilderHome record types and a BUILDER_HOMES tuple. The tuple covers the three homes named in the issue: parse methods held by the dispatch tables in parser/_schema_dispatch.py (via the table field, with JsonSchemaParser._DEFINITION_TABLE, _FIELD_TABLE, _OBJECT_KIND_TABLE and OpenAPIParser._OPENAPI_OPERATION_TABLE), the object-map dict (JsonSchemaParser._parse_object_map with marks and parts), and model-reference registration (ModelResolver.add with Reference marks and a _register_reference part). Each record names the passage of docs/architecture.md that states the home.
(2) Guards: per the summary, tests/test_decision_homes.py adds AST-based checks that read these records. They cover table-held parse methods reached only through recorded tables, table reads inside the builder (except typed_children), and marked outputs built only in the builder or its parts. Seeded-package tests exercise the checks. I did not run the tests, and no test results appear in the PR text. The guard logic is therefore established from the summary and the record definitions, not from execution.
(3) Ratchet: BUILDER_BYPASSES is added in tests/decision_home_allowlist.py, and scripts/check_ratchets.py counts it alongside UNLISTED_CALLERS. This matches the baseline requirement.
No concrete unmet coding requirement from #7289 is evident at head. The related issue #7253 is context only; its code was not needed for this verdict.
Full details: Out of Scope Changes check
Explanation
All changed areas trace to #7289. scripts/decision_homes.py adds the records the issue requests. tests/test_decision_homes.py adds the guards that read those records. tests/decision_home_allowlist.py adds the BUILDER_BYPASSES baseline. scripts/check_ratchets.py counts that baseline as a ratchet. docs/architecture.md adds prose that describes the new checks and points to the baseline. The existing DECISION_HOMES content in scripts/decision_homes.py is unchanged apart from the export list and module docstring. I found no change unrelated to the issue. The guard tests were not executed, so their correctness is not confirmed by execution.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Fix failing CI checks
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.
Reviewing files that changed from the base of the PR and between 4cf6021 and 4333738.
Files selected for processing: 5
docs/architecture.md
scripts/check_ratchets.py
scripts/decision_homes.py
tests/decision_home_allowlist.py
tests/test_decision_homes.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.
⚠️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.
Reasoning: The PR only touches internal developer tooling, tests and docs: docs/architecture.md, scripts/check_ratchets.py, scripts/decision_homes.py, scripts/ratchet_approvals.toml, tests/decision_home_allowlist.py and tests/test_decision_homes.py. It adds BuilderHome and Mark records, a BUILDER_BYPASSES allowlist and new architecture guard tests that check builder homes and dispatch tables. Nothing under src/datamodel_code_generator changed, so generated code, templates, the CLI, the public Python API, defaults, supported Python versions and error handling all stay the same. The behaviour diff gate did not run, which fits a PR with no source 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.
Fixes: #7289
Summary by CodeRabbit