Skip to content

compilers/protobuf: revive the Protocol Buffers compiler from #21 against the current contract #469

Open

Description

@fuad-daoud

What exists

A complete Protocol Buffers / gRPC compiler was drafted in #21 (branch feat/protobuf-compiler, head 2345b07, +10,170 lines across 67 files). It lowers proto2, proto3 and the 2023 edition through github.com/bufbuild/protocompile: messages and enums into the ID-keyed registry, field numbers onto Property.WireID, oneof as a WireTagged union behind a Flatten wrapper, repeated/map as hoisted containers, the well-known types, extensions and reserved ranges — with a conformance corpus under testdata/conformance/protobuf and goldens under testdata/golden/protobuf. The PR body is the design record; read it before starting over.

It was opened 2026-07-21, last pushed 2026-07-23, and has not been reviewed. README milestone 5 places the Protobuf compiler after AsyncAPI and GraphQL, so this is the tracking issue for that row, not a request to land the draft now.

Why the draft cannot land as it stands

Measured against main at e1e92a0 (166 commits ahead of the draft's base):

What reviving it needs

  1. Rebase is not the shape of the work — start a fresh branch from main and port the lowering, using the draft as the reference for the proto→IR mapping decisions.
  2. Implement Detect (a .proto source is recognisable from syntax = / edition = at the top; bounded sniff, same discipline as compilers/openapi/detect.go).
  3. Lay it out as compilers/protobuf + compilers/protobuf/internal/*, each internal package with its own archtest rules entry; use compilers/compile for naming and IDs rather than a local grammar.
  4. Regenerate the goldens at the current IRVersion and re-derive the conformance matrix witnesses (docs/ir-spec-matrix.md row keys) for the rows Protobuf can express.
  5. Run the full oracle sweep: go run ./cmd/morphic-harness testdata/conformance/protobuf.

Decision needed

Whether #21 stays open as a draft or is closed with this issue as its pointer. Either way the branch should not be deleted — the design work in it is the asset.

Refs #21.

Activity

  1. added
    priority:P4Refactors, tests, CI, hostile-input hardening, cosmetic diagnostics, other formats
    on Oct 19, 2026
  2. OmarAlJarrah commented on Oct 19, 2026

    @OmarAlJarrah
    Member

    What reviving the draft costs at c387e25c, measured by copying compilers/protobuf from origin/feat/protobuf-compiler into main and building it:

    • IR breakage. 24 compile errors on IR symbols:
      • 12 from ir.Extensions, replaced by Unmodeled entries that carry a reason and provenance;
      • 11 from Provenance.Pointer, now a jsontext.Pointer;
      • 1 from MapT.Key, now a pointer.
        A mechanical rename then surfaces 2 more, at UnmodeledEntry construction sites, each needing a reason decided per key.
    • Contract. The draft implements Formats and Compile only. compilers.Compiler now also requires Detect, DecodeOptions and SourceTable.
    • Banned JSON package. 3 files import encoding/json v1, which archtest bans.
    • No home. Two draft constructs have no IR field on main either: an input-only union, and a non-finite default (spike: evaluate first-class IR representation for input-only unions and non-finite numeric values #25).

    The issue text names only Detect. The harness and the conformance matrix also take only the OpenAPI compiler today (#968).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:P4Refactors, tests, CI, hostile-input hardening, cosmetic diagnostics, other formatstype:featureNew capability or enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions