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
Name the files in protoc messages without the run's temporary directory - #7251
Protobuf parsing now provides cleaner compiler diagnostics, including source locations for errors. Warnings are shown on successful runs, and temporary directory paths are excluded.
Tests
Added coverage for protobuf warning and error messages, including checks that warning output remains consistent across runs.
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
The protobuf parser now captures file-descriptor-level stderr from protoc, removes temporary-directory paths from diagnostics, raises SchemaParseError with cleaned details on failure, and writes successful diagnostics to stderr. Tests cover CLI diagnostic content and stderr consistency across hash seeds.
Changes: Protobuf diagnostics
Layer / File(s)
Summary
Capture and report compiler diagnostics src/datamodel_code_generator/parser/protobuf.py
The parser captures protoc diagnostics and removes temporary-directory paths. It raises SchemaParseError with cleaned details on failure, or writes nonempty diagnostics to stderr on success.
Validate CLI and deterministic diagnostics tests/main/protobuf/test_main_protobuf.py, tests/main/test_generation_determinism.py
CLI tests check warning text and source locations. Determinism tests check expected protobuf warnings and compare stderr across hash seeds.
This change removes the temporary directory from protoc messages. On Windows, the directory may still appear in diagnostics if protoc prints it with forward slashes, which could also make the new diagnostic tests fail there. This is unconfirmed and low impact, so the owner should check the Windows CI results 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 states the main change: file names in protoc messages no longer include the run's temporary directory. The raw summary says the change strips temporary directory paths from captured protoc d…
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 states the main change: file names in protoc messages no longer include the run's temporary directory. The raw summary says the change strips temporary directory paths from captured protoc diagnostics, and the tests assert the input filename in those messages. The title is specific and matches the changeset, so it passes.
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.
431-431: 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.
Match the whole POSIX-form temporary path on Windows.
The protobuf source bundled with supported grpcio-tools==1.62.0 normalizes Windows disk paths to forward slashes and prints those paths in diagnostics. (raw.githubusercontent.com)
For a root such as C:\Users\user\AppData\Local\Temp\tmp123, neither current form matches C:/Users/user/AppData/Local/Temp/tmp123/file.proto. Changing only the trailing separator does not remove that prefix. The temporary directory remains in stderr, and the new exact-message and cross-run tests fail on Windows.
Include the POSIX forms of both roots in this existing cleaner. Retain the native forms. Based on learnings, match both native and POSIX path representations.
Reviewing files that changed from the base of the PR and between 636c22f and 82d8fc0.
Files selected for processing: 3
src/datamodel_code_generator/parser/protobuf.py
tests/main/protobuf/test_main_protobuf.py
tests/main/test_generation_determinism.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
⚠️40 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 moves the formatter's subprocess call into a new private helper module with the same command and arguments, and runs protoc as a separate Python process using the grpc_tools protoc script, which appends the same well-known include path last as before, so the descriptor set and generated models do not change. Protoc diagnostics are now captured with the temporary directory stripped from paths. Invalid schemas still raise the same SchemaParseError with the same exit code, and the message now includes the real protoc diagnostic instead of the old fallback text. Warnings from successful runs still reach stderr, now without temp-dir paths. These are bug fixes and better error messages, not breaking changes. The removed format.subprocess import and the changed _load_grpc_tools signature are internal, not public API. The behaviour diff gate lists only both-fail cells, with no accepted or violation cells, so default output is unchanged. One edge case is not counted as breaking: frozen or embedded interpreters whose sys.executable cannot run the grpc_tools script could now fail.
This analysis was produced by the release draft workflow
This PR is now available in the latest release. See the release notes for details.
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