Skip to content

fix(xlang): close field tag validation gaps - #3984

Merged
chaokunyang merged 7 commits into
apache:mainfrom
chaokunyang:field-tag-int32-followup
Aug 26, 2026
Merged

fix(xlang): close field tag validation gaps#3984
chaokunyang merged 7 commits into
apache:mainfrom
chaokunyang:field-tag-int32-followup

Conversation

@chaokunyang

Copy link
Copy Markdown
Collaborator

Why?

PR #3982 established the signed-int32 field-tag protocol range. Follow-up integration checks found a
small set of validation ownership, exact-schema coverage, and documentation gaps that were not part
of the squash-merged boundary.

This PR completes those paths without changing the field-tag wire format introduced by #3982.

What does this PR do?

  • Rejects duplicate Java native TypeDef tags across the complete inheritance hierarchy.
  • Validates Go field tags before public registration mutates resolver state while continuing to
    ignore unexported fields.
  • Keeps Rust protocol metadata equality independent from local compatible-reader dispatch state.
  • Adds causal C++ remote-compatible and oversized-tag decoder coverage.
  • Adds an exact-schema cross-language fixture for tags 15, 65551, and 536870911 across all
    supported peers, including normal concrete Java test discovery.
  • Runs Kotlin's maximum tag through a real KSP-generated serializer, descriptor, and round trip.
  • Documents the exact field-tag range, uniqueness, stability, and extended encoding rules in the
    protocol, compiler, and runtime schema guides.

Related issues

Follow-up to #3982.

Does this PR introduce any user-facing change?

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Invalid duplicate or out-of-range field-tag schemas are now rejected consistently at their owning
registration or metadata boundary. Existing valid schemas and wire bytes are unchanged.

Test

  • Java native TypeDef, Go registration, C++ metadata, Rust metadata equality, and Kotlin KSP/static
    serializer tests passed.
  • Exact-schema and compatible Java-driven field-tag cases passed against C++, C#, Dart, Go,
    JavaScript, Python, Rust, Scala, and Swift in both Java codegen modes.
  • Dart IDL regeneration, compilation, and Java/Dart semantic round trips passed.
  • Java Spotless, Rust fmt/clippy, Go formatting, C++ formatting, Markdown Prettier, and full diff
    checks passed.

Benchmark

The production changes in this follow-up are Java remote native-TypeDef miss validation, Go
registration-time validation, and Rust FieldInfo equality. None is reached by the steady-state
serialize/deserialize benchmark loops from #3982, so those paired results remain the causal hot-path
evidence. Every measured runtime/path stayed below the +1.0% regression ceiling; the largest
positive paired medians were C++ deserialize at +0.858% and Java static serialize at +0.779%.

@chaokunyang
chaokunyang marked this pull request as ready for review August 26, 2026 04:12
@chaokunyang
chaokunyang merged commit 1e43394 into apache:main Aug 26, 2026
97 checks passed
chaokunyang added a commit that referenced this pull request Aug 26, 2026
## Why?

PR #3984 added an inherited duplicate-tag regression test whose method
name exceeds the repository maximum of 35 characters.

## What does this PR do?

- Renames the test method from `testDecodeRejectsInheritedDuplicateTag`
to `testRejectsInheritedDuplicateTag`.
- Leaves the annotation, test body, coverage, and production code
unchanged.

## Related issues

Follow-up to #3984.

## Does this PR introduce any user-facing change?

- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?

## Test

- `NativeTypeDefEncoderTest#testRejectsInheritedDuplicateTag` passed.

## Benchmark

Test-only rename; no production or benchmark path changes.
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.

2 participants