feat: add lookup resources debugging behavior#682
Open
tstirrat15 wants to merge 2 commits intomainfrom
Open
Conversation
tstirrat15
commented
Apr 25, 2026
| lookupResourcesCmd.Flags().Uint32("page-limit", 0, "limit of relations returned per page") | ||
| lookupResourcesCmd.Flags().String("cursor", "", "resume pagination from a specific cursor token") | ||
| lookupResourcesCmd.Flags().Bool("show-cursor", true, "display the cursor token after pagination") | ||
| lookupResourcesCmd.Flags().Bool("debug", false, "send debug header to spicedb. useful for debugging recursion depth errors") |
Contributor
Author
There was a problem hiding this comment.
I'd welcome bikeshedding on this flag. It feels like it's different from --explain because it's about getting more context out of an exception rather than showing the path taken on a successful request.
| ctx := cmd.Context() | ||
| if cobrautil.MustGetBool(cmd, "debug") { | ||
| log.Info().Msg("debugging requested on LookupResources") | ||
| ctx = requestmeta.AddRequestHeaders(ctx, requestmeta.RequestDebugInformation) |
Contributor
Author
There was a problem hiding this comment.
I'd also welcome bikeshedding on this point - I reached for a header by reflex but it may not be how we want to do things.
|
|
||
| // handleLookupResourcesErr does any additional handling of LR errors. | ||
| // Primarily used to print a traceback when in debug mode. | ||
| func handleLookupResourcesErr(err error) error { |
Contributor
Author
There was a problem hiding this comment.
This feels like it might be worth pushing up into authzed-go - unpacking errors always feels like a pain point of gRPC.
0999a40 to
b51489b
Compare
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.
Description
Zed counterpart to authzed/spicedb#3070. This does the work of submitting the debug arg and then interpreting the trace held in the error message.
What the output looks like
Changes
Will annotate.
Testing
Review.
go workthis together with the code in authzed/spicedb#3070 and run the tests. Note that this is blocked on that PR, so tests will fail until that SHA is pulled into this PR.You can also use the schema and relationships from the tests for a running example - do
go run ./cmd/spicedb/... serve-testingin one window and then go-run thelookup-resourcescall with--debugto see the output.