Quick revision
The short answer
Old clients still map field 5 to discount_percent, and since both fields are numeric with the same wire type, the new server's cents value parses cleanly and is shown as a percentage, so nothing errors. To repair it, move discount_amount_cents to a new number, mark 5 as reserved, release the server, and audit orders priced during the window. To prevent it, reserve numbers and names whenever a field is removed, run a breaking-change check such as buf breaking against the last released schema as a required CI step, keep schemas in a reviewed shared repository or registry, and add semantic validation on clients.
What to remember
In this answer, we saw that reusing field number 5 made old clients decode the new cents value as a percentage, silently, because protobuf carries numbers and wire types but not meanings. We repaired it by moving discount_amount_cents to a new number, reserving 5 and the old name, releasing the server and auditing affected orders, and we prevented a repeat with reservations on every deletion, buf breaking as a required CI step, owned shared schemas, and client-side validation of impossible values.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Old clients still map field 5 to discount_percent, and since both fields are numeric with the same wire type, the new server's cents value parses cleanly and is shown as a percentage, so nothing errors. To repair it, move discount_amount_cents to a new number, mark 5 as reserved, release the server, and audit orders priced during the window. To prevent it, reserve numbers and names whenever a field is removed, run a breaking-change check such as buf breaking against the last released schema as a required CI step, keep schemas in a reviewed shared repository or registry, and add semantic validation on clients.
Why this question is asked
Most production bugs announce themselves with errors. Schema reuse bugs do not: the bytes are valid, the parser is happy, and wrong numbers flow into prices and reports. This scenario is a textbook example, and interviewers use it to check that we understand the wire format well enough to explain the silence, and that we think beyond the code fix to the business impact and the process that let it happen. In this answer, we will reconstruct what the old clients actually decode, fix the schema and assess the damage, and then put layers of prevention in place: reservations, automated checks, schema ownership and semantic validation.
1Why Nothing Failed Loudly
On the wire, a protobuf field is just a number, a wire type and a value. Months ago the pricing service deleted discount_percent = 5. Old clients, built before the deletion, still have field 5 in their generated code as discount_percent. As long as no one sent field 5, they simply saw the default, zero, and no discounts.
The new release added discount_amount_cents = 5. Assume discount_percent was an int32 and the new field is an int64, both encoded as varints. The server now sends field 5 with a value such as 1500, meaning 15 dollars. An old client reads tag 5, varint, looks it up, finds discount_percent, and stores 1500. The parser has no way to know that the meaning changed. The client then applies a 1500 percent discount, or clamps it, or displays nonsense, depending on its code. No exception, no log line, just wrong numbers.
If the wire types had differed, say the old field was a double, the old client would have treated field 5 as unknown and read zero; still silent, still wrong. Either way, number reuse fails quietly.
6 messages in order. Play them, or step through them one at a time.
The parser accepts both; only the meaning differs.
2Repairing the Schema
The fix is to give the new field its own number and put field 5 back off-limits. discount_amount_cents moves to, for example, 12, the next unused number, and field 5 is listed as reserved along with the old name. We release the server first: from that moment it sends field 12, which old clients skip as unknown, and field 5 is never sent again. New clients must be rebuilt with the corrected schema; any new client already released with discount_amount_cents = 5 needs a fast update, because it will no longer receive the value.
Notice that we cannot 'fix' it by moving the old meaning back; the old clients already have the right schema. It is the new field that was wrong.
3Assessing the Damage
Because nothing errored, we have to look for the impact ourselves. The window starts at the release and ends at the fix. For that window, we identify which client versions are affected, from the client version header or user agent, and query orders placed by those versions with a discount. If the client only displayed the discount and the server computed the final price, the harm is confusion and support tickets. If the client sent its computed price back and the server trusted it, some orders were charged the wrong amount and need correction or refunds. This needs to be written up as an incident even though no alert fired, and the business owners need the numbers.
4Preventing It: Reservations and a Breaking-Change Check
The original deletion should have added reserved 5 and reserved 'discount_percent'. With that in the file, the compiler would have rejected discount_amount_cents = 5 on the spot. So the first rule for the team is that every field deletion comes with a reservation, and code review checks it.
Rules that depend on people remembering eventually fail, so we automate. buf breaking compares the proposed schema with the last released one, for example the version tagged at the last release or published in the Buf Schema Registry, and reports incompatible changes. Even if someone deleted the reservation, it would flag that field 5 changed its name and type compared with the released schema. Making it a required CI check on every pull request that touches .proto files means a reuse like this cannot be merged.
- Pull request changes a .proto file
- buf lint passes?YesRun buf breakingNoBlock merge
- Compatible with last released schema?YesRequire review from schema ownersNoBlock merge, show the rule broken
- Merge and publish schema versionregistry keeps the history
4 steps in order. Play them, or step through them one at a time.
5Ownership and Semantic Validation
Schemas shared between teams should live in one place, a shared repository or a schema registry, with an owner per package (for example via a CODEOWNERS file) and review from consumers for changes. Then the people who know what field 5 used to mean see the change before release, and consumers learn about new fields when they are added rather than when something breaks.
Finally, clients should validate meaning, not just syntax. A discount above 100 percent is impossible; a price below zero is impossible. A simple check that rejects or logs such values turns silent corruption into an error that monitoring can catch. In this incident, a client-side check of 0 <= discount_percent <= 100 would have produced an alert within minutes of the release.
6Follow-up questions
Would JSON have protected us here?
Partly. JSON carries field names, so an old client looking for discount_percent would not have found it in a payload that only had discount_amount_cents, and would have seen a default. That avoids the misreading, but it would still have been a silent change in behaviour. Names on the wire help, but they do not replace reserved fields and compatibility checks.
How do you find other reused numbers in existing schemas?
Run buf breaking against older released versions, not only the last one, or walk the Git history of each .proto file and list every number that ever had two different names. Any such number is a time bomb for very old clients and should be reserved.
7Conclusion
In this answer, we saw that reusing field number 5 made old clients decode the new cents value as a percentage, silently, because protobuf carries numbers and wire types but not meanings. We repaired it by moving discount_amount_cents to a new number, reserving 5 and the old name, releasing the server and auditing affected orders, and we prevented a repeat with reservations on every deletion, buf breaking as a required CI step, owned shared schemas, and client-side validation of impossible values.
Open with
Nothing failed because the bytes were perfectly valid. Protobuf only puts field numbers and wire types on the wire. Old clients still have field 5 as discount_percent in their generated code, and both fields are numeric varints, so when the new server sends 1500 cents in field 5, the old client parses it cleanly as a 1500 percent discount.
Then, if they want more
No exception, just wrong data. To repair it, I would move discount_amount_cents to a new, never-used number, put reserved 5 and the old name back in the schema, and release the server, so old clients now skip the new field and stop seeing nonsense.
Then I would treat it as an incident: work out the time window and the affected client versions, and check whether any orders were actually priced with the wrong discount, because if a client's value reached checkout we may owe corrections or refunds.
To prevent it, every deleted field must be reserved, by number and name, so the compiler blocks reuse. On top of that, a breaking-change check like buf breaking against the last released schema runs as a required CI step, so a reuse cannot be merged even if someone forgets.
I would keep schemas in a shared, owned repository or registry with consumer review. And clients should validate meaning: a discount above 100 percent is impossible, and rejecting it would have turned this silent bug into an alert.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Explain why nothing failed loudly, how to repair the situation, and how to prevent it.": https://scrivio-interview-library.netlify.app/architecture/api-design-at-scale/cb3a5004b4/