Skip to content

feat(sdk/go): expose grep level_limit to control traversal depth#2915

Merged
qin-ctx merged 3 commits into
volcengine:mainfrom
r266-tech:feat/sdk-go-grep-level-limit
Jul 1, 2026
Merged

feat(sdk/go): expose grep level_limit to control traversal depth#2915
qin-ctx merged 3 commits into
volcengine:mainfrom
r266-tech:feat/sdk-go-grep-level-limit

Conversation

@r266-tech

Copy link
Copy Markdown
Contributor

Summary

The server's grep endpoint accepts a level_limit (traversal depth; GrepRequest.level_limit: int = 10, validated and passed into service.fs.grep(level_limit=...)), and the Python client exposes it — but the Go SDK's GrepOptions had 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

  • GrepOptions gains LevelLimit *int.
  • Grep forwards payload["level_limit"] only when set, mirroring NodeLimit's omit-when-nil pattern (so the server default is preserved when unset).

Compatibility

LevelLimit is 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_uri scoping). 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 body
  • TestGrepOmitsLevelLimitWhenUnset — the field is omitted when unset

Verified locally: go build ./..., go vet, go test . all pass; gofmt clean. Continues the sdk/go client-parity lane (#2897).

r266-tech added 3 commits July 1, 2026 09:21
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 qin-ctx merged commit 846a620 into volcengine:main Jul 1, 2026
2 of 3 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants