feat(sdk/go): expose grep level_limit to control traversal depth#2915
Merged
Conversation
The server validates+consumes level_limit (default 10) and the Python client exposes it, but the Go SDK could not send it, so Go callers were silently pinned to the default traversal depth. Add LevelLimit *int, forwarded only when set (mirrors NodeLimit).
qin-ctx
approved these changes
Jul 1, 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
The server's grep endpoint accepts a
level_limit(traversal depth;GrepRequest.level_limit: int = 10, validated and passed intoservice.fs.grep(level_limit=...)), and the Python client exposes it — but the Go SDK'sGrepOptionshad no way to send it. Go callers were therefore silently pinned to the default depth and could not do shallow (perf) or deeper greps.Change
GrepOptionsgainsLevelLimit *int.Grepforwardspayload["level_limit"]only when set, mirroringNodeLimit's omit-when-nil pattern (so the server default is preserved when unset).Compatibility
LevelLimitis an additive optional field. Per the SDK's convention, options structs are constructed with keyed literals (as in all SDK tests/examples), and this follows the same additive shape as the merged #2897 (target_uriscoping). Adding a struct field only affects unkeyed positional literals, which Go's compatibility rules permit and the SDK does not use.Tests
TestGrepForwardsLevelLimit— the value reaches the request bodyTestGrepOmitsLevelLimitWhenUnset— the field is omitted when unsetVerified locally:
go build ./...,go vet,go test .all pass;gofmtclean. Continues the sdk/go client-parity lane (#2897).