Detect Breaking Changes Between Two Versions of a Protobuf Schema
Last updated: November 29, 2026
Quick Overview
Given the old and new definitions of a message as maps from field number to (name, type, label), write a checker that lists every change that would break existing wire-format clients or generated code.
0
0
0 solved
Given the old and new definitions of a message as maps from field number to (name, type, label), write a checker that lists every change that would break existing wire-format clients or generated code.
Google runs almost everything on Protocol Buffers, and API reviews and CI linters block incompatible schema changes. This onsite question tests whether you understand that wire compatibility is keyed by field number and type, while source compatibility also depends on names.
What the Interviewer Expects
- Key compatibility on field numbers, not names
- Flag removed fields that are not reserved
- Flag number reuse and incompatible type changes
- Distinguish wire breaks from source-only breaks
- Know which type changes are wire safe such as int32 to int64
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- Why is changing int32 to sint32 unsafe even though both are integers?
- How would you check enum value changes?
- What about renaming a field in a JSON based API?
- How would you roll out a truly breaking change?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Input: old, new as {number: (name, type, label)} plus new_reserved_numbers and new_reserved_names. Labels are optional, repeated, required.
Report:
- Wire break: field removed wit...
High-Level Design
Protobuf encodes each field as (number << 3 | wire_type) followed by the value. Readers ignore unknown numbers, so adding optional fields is always safe. Danger comes from an old reader seeing a num...