Skip to content

fix(compiler): preserve proto package info in IR type lookup and validation#3523

Draft
BaldDemian wants to merge 1 commit intoapache:mainfrom
BaldDemian:main
Draft

fix(compiler): preserve proto package info in IR type lookup and validation#3523
BaldDemian wants to merge 1 commit intoapache:mainfrom
BaldDemian:main

Conversation

@BaldDemian
Copy link
Copy Markdown
Contributor

@BaldDemian BaldDemian commented Mar 27, 2026

Why?

Current Fory compiler's translator and validator for protobuf cannot handle the package information correctly. All four newly-added test cases in test_proto_frontend.py would fail in the current version, despite they are all verified by protoc (should reject / should accept).

What does this PR do?

  • Introduce a new package field to the Message, Enum, and Union types in the Fory IR AST. For .fbs and .fdl inputs, this field is always None. During protobuf translation, type looking-up and validation, the package information is utilized and enforced.

  • Define testcases accordingly. Actually this fix is test-driven.

Related issues

N/A.

AI Contribution Checklist

  • Substantial AI assistance was used in this PR: yes / no
  • If yes, I included the standardized AI Usage Disclosure block below.
  • If yes, I can explain and defend all important changes without AI help.
  • If yes, I reviewed AI-assisted code changes line by line before submission.
  • If yes, I ran adequate human verification and recorded evidence (checks run locally or in CI, pass/fail summary, and confirmation I reviewed results).
  • If yes, I added/updated tests and specs where required.
  • If yes, I validated protocol/performance impacts with evidence when applicable.
  • If yes, I verified licensing and provenance compliance.

AI Usage Disclosure

  • substantial_ai_assistance: yes
  • scope: bug-fix suggestions, compiler code structure clarification
  • affected_files_or_subsystems: compiler/fory_compiler/frontend/proto/translator.py, compiler/fory_compiler/ir/ast.py, compiler/fory_compiler/ir/validator.py
  • human_verification: I have run the tests locally and review the changes
  • performance_verification: N/A
  • provenance_license_confirmation: Apache-2.0-compatible provenance confirmed; no incompatible third-party code introduced

Does this PR introduce any user-facing change?

N/A.

Benchmark

N/A.

…dation

Signed-off-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
@BaldDemian
Copy link
Copy Markdown
Contributor Author

BaldDemian commented Mar 27, 2026

Current fix cannot handle some complex cases properly, still working on it

@BaldDemian BaldDemian marked this pull request as draft March 27, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant