Skip to content

chore: generate protobuf rbs#414

Open
chris-olszewski wants to merge 1 commit intoolszewski/fix_hidden_steep_issuesfrom
olszewski/feat_gen_proto_rbs
Open

chore: generate protobuf rbs#414
chris-olszewski wants to merge 1 commit intoolszewski/fix_hidden_steep_issuesfrom
olszewski/feat_gen_proto_rbs

Conversation

@chris-olszewski
Copy link
Copy Markdown
Member

@chris-olszewski chris-olszewski commented Apr 10, 2026

What was changed

Start generating RBS files for our protobuf messages.

(This does require a new version of protoc which has not been released via grpc-tools gem yet so now maintainers/CI need to acquire protoc themselves)

Note this is on top of #415 as we upped our type checking now that we have types for protobufs and this resulted in finding some preexisting gaps. I moved those changes to their own PR so they don't get lost in the 40k lines of generated protobuf RBS types.

Why?

Previously this was unsupported, but with Protobuf 34.0 protoc can now output RBS files alongside the generated RB files.

Checklist

  1. Closes N/A

  2. How was this tested:
    Stopped excluding the protoc generated message types from type checking.

  3. Any docs updates needed?
    N/A, internal at the moment since we don't ship RBS types with the gem.

@chris-olszewski chris-olszewski force-pushed the olszewski/feat_gen_proto_rbs branch from 6657816 to 490a1a8 Compare April 11, 2026 15:31
@chris-olszewski chris-olszewski changed the base branch from main to olszewski/fix_hidden_steep_issues April 11, 2026 15:31
@chris-olszewski chris-olszewski marked this pull request as ready for review April 11, 2026 15:46
@chris-olszewski chris-olszewski requested a review from a team as a code owner April 11, 2026 15:46
# Protobuf generates overly specific type signatures that result in Steep choking while creating union types.
# To avoid this, we widen them to their supertype e.g. `lookup` taking a String compared to the union type of each
# message type string literal.
def normalize_generated_rbs!(path)
Copy link
Copy Markdown
Member Author

@chris-olszewski chris-olszewski Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlighting this for reviewer as this is probably the riskiest part of the addition. We intentionally widen various aspects of the generated types to work around:

  • Missing RBS definitions from the protobuf gem
  • Steep choking on our codebase with some of the union types.

I don't love the raw string substitution. I have an alternative version of this that uses the rbs to parse and rewrite the file, but I didn't find that to be more legible.

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