Use Buf to guard protobuf schema compatibility - #1352
Draft
jwils wants to merge 1 commit into
Draft
Conversation
jwils
force-pushed
the
joshuaw/buf-breaking-validation
branch
from
August 16, 2026 02:15
13518db to
564e268
Compare
jwils
force-pushed
the
joshuaw/buf-breaking-validation
branch
from
August 19, 2026 13:23
564e268 to
97204f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Stable field numbers prevent protobuf data from being reinterpreted, but they do not catch incompatible field-type, syntax, package, or file-option changes. Maintaining those compatibility rules ourselves would duplicate Buf and leave room for subtle gaps.
What
proto_schema_version, defaulting to 1, and record it in the generatedschema.proto.FILEbreaking rules before dumping a changed artifact at the same version.enforce_proto_schema_version falseescape hatch.Risk
This adds a development-time dependency on the Buf CLI whenever an existing
schema.protochanges without a version bump. First-time generation and explicitly versioned breaking changes do not invoke Buf. Projects can temporarily disable enforcement while prototyping.Test plan
script/run_gem_specs elasticgraph-proto_ingestion: 101 examples, 100% line and branch coverage.script/lint,script/type_check,script/spellcheck, documentation coverage, workflow/config validation, README snippet validation, andsite:validate.script/quick_build: 5,291 of 5,292 examples passed; one unrelated datastore acceptance example observed a record from another test environment and passed immediately when rerun in isolation.References