feat(adaptive/traces): add policy CRUD commands#293
Merged
Conversation
Add direct CLI commands for managing Adaptive Traces sampling policies under `adaptive traces policies`, complementing the existing resource adapter (gcx resources get/push/pull/delete) with a more ergonomic provider-specific interface. New commands: - policies list: list all policies (table/wide/json/yaml) - policies get <id>: get a single policy by ID - policies create -f <file>: create from JSON/YAML file or stdin - policies update <id> -f <file>: update by ID from file or stdin - policies delete <id>...: delete with confirmation (--force to skip) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use %w instead of %v for YAML error wrapping (errorlint) - Replace require with assert in HTTP handler (testifylint) - Remove unused newTestCommand function (unused) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
yvrhdn
approved these changes
Mar 31, 2026
7717f5b to
d6fb77e
Compare
radiohead
requested changes
Mar 31, 2026
Collaborator
There was a problem hiding this comment.
Summary
- 1 Critical: TypedCRUD invariant violation (CONSTITUTION.md)
- 3 Major: Non-TTY delete blocking, sequential delete partial-failure, stdout mixing
- 3 Minor: Confusing error message, duplicate opts, unbounded ReadAll
See inline comments for details.
Strengths
- Clean Options pattern adherence
- Good codec + integration test coverage
- Proper
url.PathEscape, safe YAML parsing, context propagation - Correct CLI grammar:
adaptive traces policies {verb}
This comment has been generated by Claude Code
- Use TypedCRUD[Policy] instead of raw client for all policy CRUD ops - Move diagnostic output (Success, Info, prompts) to stderr - Auto-reject delete confirmation in non-TTY contexts with clear error - Collect all delete errors instead of stopping on first failure - Merge duplicate create/update opts into shared policyFileOpts - Use YAML-only parsing (superset of JSON) with cleaner error - Add 10 MB size limit to policy file reads Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adapter-registered resources must use standard CRUD verbs (list, get, create, update, delete). Alternative verbs (show, describe, search) are reserved for provider-only resources without adapters. Also adds missing Validate() to policiesDeleteOpts per Options pattern. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
@radiohead I have added a couple of commits to address all the changes. Please take another look. |
radiohead
approved these changes
Mar 31, 2026
Collaborator
Approved, thank you! |
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
adaptive traces policieslist,get,create,update,deletegcx resources get/push/pull/delete) with a more ergonomic provider-specific interfaceNew Commands
policies listpolicies get <id>policies create -f <file>-)policies update <id> -f <file>policies delete <id>...--forceto skip)Test plan
🤖 Generated with Claude Code