Skip to content

fix: make buf lint pass with an explicit DiffPromptResponse exception - #7

Merged
sujal-maheshwari2004 merged 1 commit into
mainfrom
fix/3-buf-lint-diff-response
Oct 18, 2026
Merged

sujal-maheshwari2004 merged 1 commit into
mainfrom
fix/3-buf-lint-diff-response

Conversation

@sujal-maheshwari2004

Copy link
Copy Markdown
Contributor

What was wrong

buf lint exited 100 on main because DiffPromptResponse is the response of both DiffPrompt and DiffCommits:

$ buf lint
proto\priompt\v1\prompt.proto:14:3:"priompt.v1.DiffPromptResponse" is used as the request or response type for multiple RPCs.
proto\priompt\v1\prompt.proto:28:3:"priompt.v1.DiffPromptResponse" is used as the request or response type for multiple RPCs.
proto\priompt\v1\prompt.proto:28:48:RPC response type "DiffPromptResponse" should be named "DiffCommitsResponse" or "PromptServiceDiffCommitsResponse".
exit=100

The fix

I kept the shared type and added targeted // buf:lint:ignore comments on the two RPCs (RPC_REQUEST_RESPONSE_UNIQUE on both, RPC_RESPONSE_STANDARD_NAME on DiffCommits), with a one-line reason.

I also tried the other option the issue mentions, a dedicated DiffCommitsResponse { repeated Change changes = 1; }. It is wire-compatible, but:

  • it changes the Go API: the server's DiffCommits(...) (*pb.DiffPromptResponse, error) and its shared diff() helper would stop compiling on the next proto bump.
  • buf breaking (FILE rules) rejects it:
    prompt.proto:33:48:RPC "DiffCommits" on service "PromptService" changed response type from "priompt.v1.DiffPromptResponse" to "priompt.v1.DiffCommitsResponse".
    alt breaking exit=100
    

With the lint exception, wire format and the Go API stay the same. Regenerated stubs (pinned protocolbuffers/go:v1.36.12, grpc/go:v1.6.2, which match the committed headers) differ only in doc comments in prompt_grpc.pb.go. prompt.pb.go is byte-identical.

CI gets a new buf job that runs buf lint.

Evidence

$ buf lint                                   -> exit 0
$ buf breaking --against '.git#branch=origin/main'  -> exit 0
$ GOWORK=off go build ./... && go vet ./... && go test ./...
ok  github.com/priompt/proto/semdiff
ok  github.com/priompt/proto/validate

Fixes #3

🤖 Generated with Claude Code

DiffPrompt and DiffCommits both return DiffPromptResponse, which trips
RPC_REQUEST_RESPONSE_UNIQUE (and RPC_RESPONSE_STANDARD_NAME on
DiffCommits). Splitting the response into a new DiffCommitsResponse would
be wire-compatible, but it changes the Go API the server and CLI compile
against and fails `buf breaking` (FILE: RPC_SAME_RESPONSE_TYPE). Keep the
shared type and record the exception with targeted buf:lint:ignore
comments on the two RPCs, regenerate the stubs (comment-only change), and
run `buf lint` in CI.

Fixes #3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sujal-maheshwari2004
sujal-maheshwari2004 merged commit e720860 into main Oct 18, 2026
2 checks passed
@sujal-maheshwari2004
sujal-maheshwari2004 deleted the fix/3-buf-lint-diff-response branch October 18, 2026 17:49
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.

buf lint fails: DiffPromptResponse is reused by two RPCs

1 participant