fix(validator): resolve breaking --against tags containing slashes as git refs#9
Merged
Merged
Conversation
… git refs Release tags routinely contain slashes (proto/payments/ledger/v1.0.0), so the 'contains a slash means filesystem path' heuristic passed tags to buf as nonexistent path inputs — buf targeted nothing and finalize reported a spurious BREAKING_CHANGE on every second release of an API. Treat against as a path only when it exists on disk (pinned absolute, since buf runs from the module root); otherwise convert to .git#ref=. Adds a real-git regression test tagging a slash-containing release tag.
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.
Found cutting the second release of an API (
v1.0.0-alpha.2): finalize's breaking re-validation failed with a spuriousBREAKING_CHANGEeven with zero proto changes.ProtoValidator.Breakingdecided ref-vs-path with!strings.Contains(against, "/") || isGitRef(against)— but every apx release tag contains slashes (proto/payments/ledger/v1.0.0), so the previous-version tag was passed to buf as a positional path input →no .proto files were targeted→ exit 1 → misreported as a breaking change. First releases skip the check (no previous version), which is why CI never caught it.Fix: treat
againstas a filesystem path only when it exists on disk (pinned absolute, since buf now runs from the module root); otherwise.git#ref=<against>. Explicit.git#references pass through. Drops the now-unusedisGitRef.Verified:
buf breaking --against .git#ref=proto/infoblox/authz/v1.0.0-alpha.1 --path …exits 0 on the real canonical repo where the old form failed; new real-git regression test (TestProtoValidator_Breaking_AgainstTagWithSlashes); full suite green with a fresh binary.