fix(connect): register v1 service paths for buf v2 config#28
Merged
Conversation
CommitService, GraphService, and DownloadService only had v1beta1 routes registered. Buf CLI with v2 buf.yaml config calls v1 API paths, which fell through to rootHandler returning text/plain — causing "invalid content-type" errors. Add v1 route registrations alongside v1beta1 for all three services, matching the pattern already used by ModuleService. Adds comprehensive tests verifying v1 and v1beta1 paths return application/proto content-type and valid protobuf responses. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- test.yml: run unit tests on PR and push to main - security.yml: weekly govulncheck + dependency review Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ZergsLaw
approved these changes
May 29, 2026
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.
Summary
Fix: buf v2 config content-type mismatch
When
buf dep updateis run with a v2buf.yamlconfig against the proxy, the buf CLI callsv1API paths (buf.registry.module.v1.CommitService/GetCommits). Onlyv1beta1routes were registered for CommitService, GraphService, and DownloadService — thev1paths fell through torootHandler, which returns200 OKwithContent-Type: text/plain; charset=utf-8.This caused the error:
Changes
Add v1 route registrations
Register
v1service paths alongside existingv1beta1paths for CommitService, GraphService, and DownloadService ininternal/connect/api.go, matching the pattern already used by ModuleService.Key files:
internal/connect/api.go— added 3v1route registrationsAdd comprehensive route tests
New test file
internal/connect/api_test.gowith 6 test functions covering:rootHandlerapplication/protowith valid protobuf on both v1 and v1beta1 pathsKey files:
internal/connect/api_test.go— new test file (424 lines)Verification
go test ./internal/connect/— 28 subtests, 0 failures)application/proto(nottext/plain)🤖 Generated with Claude Code