Codegen: generate packet types from protocol templates #46

Closed
opened 2026-08-08 08:18:17 +00:00 by hugo · 1 comment
Owner

Objective

Translate PacketSourceGenerator inputs and semantics into deterministic Rust packet type generation.

Deliverables

  • Generate packet IDs/frequencies, blocks, variable/fixed fields, enums, constructors, sizing metadata, and dispatch tables required by the mapped API.
  • Preserve numeric widths, ordering, repetition rules, and unknown/variable block semantics.
  • Produce actionable source-located diagnostics for invalid templates.

Validation

  • Generated catalog matches every pinned C# generated packet API.
  • Representative packet compile fixtures build.
  • Regeneration diff is reviewed and deterministic.

Prerequisite

The fixed API/test gates, Types, StructuredData, and relevant imaging foundations are complete.

Project constraints

  • All LibreMetaverse-specific generation and wire behavior is new native Rust code.
  • Generated Rust is deterministic, checked in, and covered by the fixed public API and semantic tests.
  • No normal build or release may depend on .NET, Roslyn, C# assemblies, or the reference checkout.
## Objective Translate PacketSourceGenerator inputs and semantics into deterministic Rust packet type generation. ## Deliverables - Generate packet IDs/frequencies, blocks, variable/fixed fields, enums, constructors, sizing metadata, and dispatch tables required by the mapped API. - Preserve numeric widths, ordering, repetition rules, and unknown/variable block semantics. - Produce actionable source-located diagnostics for invalid templates. ## Validation - Generated catalog matches every pinned C# generated packet API. - Representative packet compile fixtures build. - Regeneration diff is reviewed and deterministic. ## Prerequisite The fixed API/test gates, Types, StructuredData, and relevant imaging foundations are complete. ## Project constraints - All LibreMetaverse-specific generation and wire behavior is new native Rust code. - Generated Rust is deterministic, checked in, and covered by the fixed public API and semantic tests. - No normal build or release may depend on .NET, Roslyn, C# assemblies, or the reference checkout.
hugo added this to the 07 - Wire codegen milestone 2026-08-08 08:18:17 +00:00
hugo added the enhancement label 2026-08-08 08:18:17 +00:00
hugo closed this issue 2026-08-09 06:09:13 +00:00
Author
Owner

Implemented and pushed in fb7d0c6.

This adds a native Rust parser and deterministic generator for the pinned message template, with source-located PGxxx diagnostics and checked-in packet_catalog.rs output. The generated catalog covers 483 packets and 905 blocks, preserves IDs, frequencies, widths, ordering, repetition, flags, default construction, golden Length metadata, pooling metadata, and known/unknown dispatch. Generation validates the complete packet, block, field, and PacketType shape against the pinned public API catalog; normal builds do not invoke the generator or require .NET, Roslyn, C# assemblies, or the reference checkout.

Verification completed:

  • generator unit tests: 5 passed
  • generated packet catalog tests: 4 passed
  • wire shim tests: 2 passed
  • translated PacketTests.HeaderFlags parity test: passed
  • controlled red suite: 278 passed, 1154 expected failures, baseline current
  • deterministic regeneration: identical hashes across two runs
  • API mapping, shim, coverage, parity, and milestone 06 audits: passed
  • workspace check and Clippy for default/all features: passed
  • rustdoc with warnings denied: passed
  • workspace default/all-feature compile-only test gates: passed
  • locked API compile fixture and package listing: passed

Final review found and corrected native coverage accounting; the report now recognizes all generated native packet and block members.

Implemented and pushed in fb7d0c6. This adds a native Rust parser and deterministic generator for the pinned message template, with source-located PGxxx diagnostics and checked-in packet_catalog.rs output. The generated catalog covers 483 packets and 905 blocks, preserves IDs, frequencies, widths, ordering, repetition, flags, default construction, golden Length metadata, pooling metadata, and known/unknown dispatch. Generation validates the complete packet, block, field, and PacketType shape against the pinned public API catalog; normal builds do not invoke the generator or require .NET, Roslyn, C# assemblies, or the reference checkout. Verification completed: - generator unit tests: 5 passed - generated packet catalog tests: 4 passed - wire shim tests: 2 passed - translated PacketTests.HeaderFlags parity test: passed - controlled red suite: 278 passed, 1154 expected failures, baseline current - deterministic regeneration: identical hashes across two runs - API mapping, shim, coverage, parity, and milestone 06 audits: passed - workspace check and Clippy for default/all features: passed - rustdoc with warnings denied: passed - workspace default/all-feature compile-only test gates: passed - locked API compile fixture and package listing: passed Final review found and corrected native coverage accounting; the report now recognizes all generated native packet and block members.
Sign in to join this conversation.