Skip to content

feat(llm-obs): add dataset batch-update, clone, restore subcommands#540

Merged
platinummonkey merged 3 commits into
chore/upgrade-dd-sdk-to-masterfrom
feat/llmobs-dataset-ops
May 30, 2026
Merged

feat(llm-obs): add dataset batch-update, clone, restore subcommands#540
platinummonkey merged 3 commits into
chore/upgrade-dd-sdk-to-masterfrom
feat/llmobs-dataset-ops

Conversation

@platinummonkey
Copy link
Copy Markdown
Collaborator

Summary

Adds three new pup llm-obs datasets subcommands that wrap the new SDK endpoints from datadog-api-client-rust PR #1655, available in the SDK rev picked up by the base branch (chore/upgrade-dd-sdk-to-master).

Changes

  • src/commands/llm_obs.rs — add datasets_batch_update, datasets_clone, datasets_restore functions following the exact pattern of existing dataset commands; 6 new tests (happy-path + error for each command)
  • src/main.rs — add BatchUpdate, Clone, Restore variants to LlmObsDatasetsActions enum with --project-id, --dataset-id, --file args; add dispatch arms
  • src/client.rs — add v2.batch_update_llm_obs_dataset, v2.clone_llm_obs_dataset, v2.restore_llm_obs_dataset_version to UNSTABLE_OPS; update count assertion 162 → 165
  • docs/COMMANDS.md — update llm-obs datasets listing to include the three new subcommands

New commands

# Batch insert/update/delete records in a dataset
pup llm-obs datasets batch-update --project-id=<id> --dataset-id=<id> --file=body.json

# Clone a dataset into a new dataset
pup llm-obs datasets clone --project-id=<id> --dataset-id=<id> --file=body.json

# Restore a dataset to a previous version
pup llm-obs datasets restore --project-id=<id> --dataset-id=<id> --file=body.json

Testing

  • 6 unit tests added (2 per command: 200/201 success + 400/404 error)
  • Tests follow existing mock patterns: mock_any for SDK-routed calls, status-specific mocks for error paths
  • All tests use lock_env + cleanup_env for safe env-var isolation

Notes

This PR is stacked on chore/upgrade-dd-sdk-to-master (PR #539) which bumps the SDK rev to d4954b11. CI will need that base branch merged (or the SDK fetched) for compilation to succeed.


🤖 Generated with Claude Code

https://claude.ai/code/session_01MaHfvEkY66q99gwcPZi4Xc


Generated by Claude Code

Wrap three new SDK endpoints introduced in datadog-api-client-rust PR #1655
(available at rev d4954b11 picked up by chore/upgrade-dd-sdk-to-master):

- `pup llm-obs datasets batch-update` — batch insert/update/delete records
  via LLMObsDatasetBatchUpdateRequest / batch_update_llm_obs_dataset
- `pup llm-obs datasets clone` — clone a dataset into a new dataset
  via LLMObsDatasetCloneRequest / clone_llm_obs_dataset
- `pup llm-obs datasets restore` — restore a dataset to a previous version
  via LLMObsDatasetRestoreVersionRequest / restore_llm_obs_dataset_version

Changes:
- src/commands/llm_obs.rs: add datasets_batch_update, datasets_clone,
  datasets_restore functions; add 6 tests (happy-path + error for each)
- src/main.rs: add BatchUpdate/Clone/Restore variants to LlmObsDatasetsActions
  and dispatch arms
- src/client.rs: add 3 new unstable op IDs; update count assertion 162 → 165
- docs/COMMANDS.md: update llm-obs datasets command listing

Co-Authored-By: Claude <noreply@anthropic.com>

https://claude.ai/code/session_01MaHfvEkY66q99gwcPZi4Xc
@platinummonkey platinummonkey requested a review from a team as a code owner May 29, 2026 11:53
@datadog-prod-us1-4

This comment has been minimized.

claude added 2 commits May 29, 2026 12:19
restore_llm_obs_dataset_version returns no body; binding its unit
result tripped clippy::let_unit_value (-D warnings) and broke the
Check/Test and Windows cross-compile jobs. Follow the delete pattern:
call, then print a confirmation.

Co-Authored-By: Claude <noreply@anthropic.com>
The batch-update/clone/restore tests built request JSON with stale
field names (type "dataset_*", missing required id, wrong attribute
keys), so util::read_json_file failed before the API call and the
happy-path asserts panicked. Align bodies with the real SDK models:

- data.id required; data.type is "datasets"
- batch-update attrs use insert_records/delete_records
- restore attr is dataset_version (not version)
- batch-update response data is an array (LLMObsDatasetRecordsMutationResponse)

Co-Authored-By: Claude <noreply@anthropic.com>
@platinummonkey platinummonkey merged commit 3797c1d into chore/upgrade-dd-sdk-to-master May 30, 2026
6 checks passed
@platinummonkey platinummonkey deleted the feat/llmobs-dataset-ops branch May 30, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants