Fix revoke failing due to incorrect annotation type in Pick()#49
Fix revoke failing due to incorrect annotation type in Pick()#49c1-dev-bot[bot] wants to merge 2 commits intomainfrom
Conversation
The Revoke method was using annos.Pick(&structpb.Struct{}) to extract
grant metadata, but WithGrantMetadata() stores it as a GrantMetadata
protobuf message (which wraps structpb.Struct). Since Pick() uses
MessageIs() to match by protobuf type URL, it never found a matching
annotation and returned (false, nil). The nil error was then incorrectly
wrapped with %w, producing the malformed error message:
"annotation does not exist: %!w(<nil>)"
Fix: Pick the correct v2.GrantMetadata type, then extract the inner
Metadata struct from it. Also fix the error message to not wrap nil.
Whitespace formatting in the generated JSON changed due to Go version differences. Update the committed file to match.
|
Claude finished @c1-dev-bot[bot]'s task in 1m 16s —— View job PR Review: Fix revoke failing due to incorrect annotation type in Pick()Blocking Issues: 0 | Suggestions: 0
Security IssuesNone found. Correctness IssuesNone found. The fix is correct:
SuggestionsNone. The This is a clean, focused bug fix that correctly addresses the root cause. |
Summary
baton-linear: annotation does not exist: %!w(<nil>)Revoke()usedannos.Pick(&structpb.Struct{})butWithGrantMetadata()stores metadata asv2.GrantMetadata(a different protobuf type).Pick()usesMessageIs()to match by type URL, so it never found the annotation.v2.GrantMetadatatype, then extract the innerMetadatastruct. Also fixes nil error wrapping that produced the malformed%!w(<nil>)in the error message.Test plan
go build ./...passes (confirmed locally)go vet ./...passes (confirmed locally)Automated PR Notice
This PR was automatically created by c1-dev-bot as a potential implementation.
This code requires: