Skip to content

feat(sdk/go): expose include_provenance and fix dead query_results json tag#2731

Open
r266-tech wants to merge 1 commit into
volcengine:mainfrom
r266-tech:r266-sdk-go-include-provenance
Open

feat(sdk/go): expose include_provenance and fix dead query_results json tag#2731
r266-tech wants to merge 1 commit into
volcengine:mainfrom
r266-tech:r266-sdk-go-include-provenance

Conversation

@r266-tech

Copy link
Copy Markdown
Contributor

Summary

Two related gaps in the Go SDK's retrieval surface, both verified against main:

  1. include_provenance could not be requested from Go. The server's FindRequest/SearchRequest accept include_provenance: bool = False and use model_config = ConfigDict(extra="forbid"), but FindOptions/SearchOptions had no field for it and the request payloads never sent it — so a Go caller literally could not ask for retrieval provenance.

  2. FindResult.QueryResults had a dead JSON tag. It was tagged json:"query_results,omitempty", but the server's to_dict(include_provenance=True) emits the per-query results under the top-level provenance key (openviking_cli/retrieve/types.py: result["provenance"] = [...]). The server never emits query_results, so QueryResults was always silently empty.

Changes

  • FindOptions / SearchOptions: add IncludeProvenance bool (defaults false).
  • Find / Search: send include_provenance: true only when set — absent when false, matching the extra="forbid" contract and mirroring how level/since/until are wired in fix(sdk/go): expose search date and level filters #2703.
  • FindResult.QueryResults: fix the JSON tag query_resultsprovenance so it actually populates.
  • Tests: Find and Search each assert the flag is sent when true, omitted when unset, and that a provenance response parses into QueryResults.

Backward compatibility

The previous query_results tag was dead — the server never emitted that key, so QueryResults was always empty. With omitempty, the marshaled output is unchanged for any FindResult produced by this SDK/server; the change only makes the field start populating from the real provenance key.

Follow-up to #2703 (Go retrieval date/level parity).

…on tag

Go callers could not request retrieval provenance (server FindRequest/
SearchRequest accept include_provenance with extra=forbid, but FindOptions/
SearchOptions had no field and never sent it). Separately, FindResult.
QueryResults was tagged json:"query_results" while the server emits per-
query results under the top-level "provenance" key, so it was always empty.

Add IncludeProvenance to FindOptions/SearchOptions, send it only when set,
and fix the result tag to "provenance". Follow-up to volcengine#2703.
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🏅 Score: 95
🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant