RSDK-9718: fix tagger.proto go_package so its descriptor registers correctly#847
Draft
RSDK-9718: fix tagger.proto go_package so its descriptor registers correctly#847
Conversation
…proto path The tagger.proto's go_package pointed at the upstream protoc-gen-gotag package, which registers a different file path (tagger/tagger.proto) than what consuming protos import (tagger/v1/tagger.proto). As a result, generated descriptors for app/v1/robot.proto, app/v1/app.proto, and app/mltraining/v1/ml_training.proto have a transitive dependency on tagger/v1/tagger.proto that is never registered in the running process, breaking gRPC reflection for any service whose descriptor chain reaches this file (notably viam.service.discovery.v1.DiscoveryService). Switch go_package to the regenerated go.viam.com/api/tagger/v1 package so its init() runs and registers tagger/v1/tagger.proto under the path its consumers expect. Regenerate dependents via mise r buf-go. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
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
One-line proto change (plus regenerated
.pb.go) that fixes a long-standing gRPC reflection failure. After this PR, any service whose descriptor chain reachestagger/v1/tagger.proto— notablyviam.service.discovery.v1.DiscoveryService— can be reflected end-to-end. This unblocks RDK-side cleanup tracked in RSDK-9718 and silences a debug log line that fires on everyRobotClientrefresh cycle (~once every 5 s) for every robot configured with a discovery service.The problem
A debug line fires on every
RobotClientrefresh:It is the visible tip of a deeper bug. The same root cause forced three other workarounds in RDK:
module/server.go— special-cased the discovery API to skip reflection lookup.robot/jobmanager/jobmanager.go— TODO suggestingrefClient.AllowMissingFileDescriptors()as a workaround.robot/impl/jobmanager_test.go— discovery job test commented out (Discovery Service is currently excluded … it will be available after a change in the API repo).Root cause
proto/viam/tagger/v1/tagger.protodeclared:That
go_packageoption points to the upstreamprotoc-gen-gotagGo package, not the regenerated copy that lives atgo.viam.com/api/tagger/v1. Theoption go_packagevalue is whatprotoc-gen-gowrites into every dependent.pb.goas the import path for the tagger types. So the generatedapp/v1/robot.pb.go,app/v1/app.pb.go, andapp/mltraining/v1/ml_training.pb.goeach had:The upstream package's
init()registers a different file inprotoregistry.GlobalFiles—tagger/tagger.proto(root path,package tagger) — nottagger/v1/tagger.proto. Meanwhile the regeneratedgo.viam.com/api/tagger/v1/tagger.pb.gopackage, which would registertagger/v1/tagger.protocorrectly, was effectively dead code: it shipped in the module but nothing imported it, so itsinit()never ran.The descriptor chain encoded into the dependents'
.pb.gofiles comes from the proto import (import "tagger/v1/tagger.proto"), not the Go-side blank import. So at runtime the FileDescriptor forapp/v1/robot.protolegitimately liststagger/v1/tagger.protoas a dependency — but no init in the binary ever registers a file by that name. When a gRPC reflection client walks the dep chain ofdiscovery.v1.DiscoveryService→app/v1/robot.proto→tagger/v1/tagger.proto, the server returns NotFound.This is why the bug only surfaces at reflection time and only for service descriptors that transitively reach into
app/v1/*. Wire-format calls to those services have always worked — they don't need the file descriptor.The fix
Change the
go_packageoption to point at the regenerated package:After regenerating, dependents now blank-import
_ "go.viam.com/api/tagger/v1"instead of the upstream package, so the regenerated tagger'sinit()runs and registerstagger/v1/tagger.protounder the path consumers actually look it up by.No proto path or wire-format changes — only the Go import path of dependents (which is generator-managed, not user code).
Verification
mise r buf-goproduced exactly 5 file diffs: the proto change, the regenerated tagger package (raw FileDescriptor bytes encode the newgo_package), and the three dependents flipping their blank import. Diff is +8/-9.go build ./...clean; existing tests unaffected.Spot-check on a tiny program that blank-imports
go.viam.com/api/service/discovery/v1and queries the registry:Returns NotFound on
main. After this change, returnstagger/v1/tagger.proto (package=tagger.v1).End-to-end on RDK (with a local
replacepointing at this branch): the previously-disabled discovery-service job inrobot/impl/jobmanager_test.go::TestJobManagerConfigChangesnow passes — the job hitsFindSymbolonviam.service.discovery.v1.DiscoveryService, succeeds, and the gRPC method invocation goes through cleanly. Thefailed to find symbol for resource APIdebug line no longer fires for the discovery API.Notes
app/model/v1/model.pb.gostill references the upstream tagger package, but its source proto (proto/viam/app/model/v1/model.proto) was deleted in commit87932114(DATA-1524 cleanup). It's an orphaned generated file and not regenerated bybuf-go, so it's untouched here. Out of scope; can be removed in a follow-up if desired.github.com/srikrsna/protoc-gen-gotagGo module dep stays ingo.modbecause that orphan file still imports it. Theprotoc-gen-gotagcodegen binary is unaffected (installed viamise.toml, separate from the runtime module dep).module/server.go, TODO line inrobot/jobmanager/jobmanager.go, commented-out test entry inrobot/impl/jobmanager_test.go) and bumpgo.viam.com/apito the version cut from this PR.Test plan