Skip to content

fix(validator): resolve breaking --against tags containing slashes as git refs#9

Merged
daniel-garcia merged 1 commit into
mainfrom
fix-breaking-against-tag
Jun 10, 2026
Merged

fix(validator): resolve breaking --against tags containing slashes as git refs#9
daniel-garcia merged 1 commit into
mainfrom
fix-breaking-against-tag

Conversation

@daniel-garcia

Copy link
Copy Markdown
Contributor

Found cutting the second release of an API (v1.0.0-alpha.2): finalize's breaking re-validation failed with a spurious BREAKING_CHANGE even with zero proto changes.

ProtoValidator.Breaking decided 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 against as 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-unused isGitRef.

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.

… 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.
@daniel-garcia daniel-garcia merged commit 121b60f into main Jun 10, 2026
8 checks passed
@daniel-garcia daniel-garcia deleted the fix-breaking-against-tag branch June 10, 2026 17:06
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