Skip to content

Add chunk sidecar snapshot list command#337

Open
stiyyagura0901 wants to merge 4 commits into
mainfrom
st/list_snapshots
Open

Add chunk sidecar snapshot list command#337
stiyyagura0901 wants to merge 4 commits into
mainfrom
st/list_snapshots

Conversation

@stiyyagura0901
Copy link
Copy Markdown

Adds chunk sidecar snapshot list --org-id <id> so users can see existing snapshots before creating new ones, avoiding 409 name-conflict errors.

Changes

  • ListSnapshots client method hitting GET /api/v2/sidecar/snapshots
  • chunk sidecar snapshot list subcommand with --org-id and --json flags
  • Fake handler + acceptance tests

stiyyagura0901 and others added 4 commits May 14, 2026 18:00
Extract hook context setup (applyHookContext), hook early-exit checks
(checkHookEarlyExit), and sidecar resolution (resolveSidecarForRun)
into standalone helper functions. This brings the complexity of
newValidateCmd's RunE closure from 31 down to the allowed limit of 30.
Fix: reduce cyclomatic complexity of newValidateCmd (gocyclo lint failure)
@stiyyagura0901 stiyyagura0901 marked this pull request as ready for review May 19, 2026 17:41
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk Assessment

Overall: Low — the change is scoped to a new read-only snapshot listing command plus a small client method, with acceptance coverage for core flows and no breaking or security-sensitive behavior changes; remaining concerns are minor docs/error-handling/test gaps.

Dimension Finding
Blast radius Low-to-moderate surface because this adds the public chunk sidecar snapshot list command and a new CircleCI API client method, and also includes an unrelated validate refactor. No dependency-boundary violations found.
Test coverage Core acceptance coverage exists for happy path, empty list, and missing token. Gaps: no --json coverage for the new machine-readable output and no list API error/auth-specific acceptance case. Focused test run was attempted but blocked by the local Go toolchain (go1.26 unavailable).
Breaking changes No concerns. The PR adds a subcommand and does not change existing command names, flags, defaults, .chunk/ file structure, or existing output contracts.
Security No concerns. The new path is a read-only authenticated GET using existing token handling, with no new dependencies, shell execution, or file-permission changes.
Complexity Low. The new command follows existing sidecar command patterns and respects cmd/ -> internal/ layering. The unrelated validate extraction appears behavior-preserving, but it broadens review scope.

Recommendations: update docs/CLI.md:102 and docs/GETTING_STARTED.md:208 so the new public command is discoverable; add coverage for chunk sidecar snapshot list --json from internal/cmd/sidecar.go:784; and consider mirroring sidecar list auth handling for snapshot list at internal/cmd/sidecar.go:776 because internal/circleci/client.go:149 maps 401/403 to ErrNotAuthorized, but the command currently reports all failures as retryable list errors.

Open in Web View Automation 

Sent by Cursor Automation: chunk-cli risk assessment

Comment thread internal/cmd/validate.go
// applyHookContext sets up the context and streams for hook invocations.
// It returns the updated context and streams, and resets per-session state
// when the hook is running for the first time (not a retry).
func applyHookContext(ctx context.Context, hook *hookContext, streams iostream.Streams) (context.Context, iostream.Streams) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this included?

Copy link
Copy Markdown
Author

@stiyyagura0901 stiyyagura0901 May 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It got added to fix a lint failure on the original commit. newValidateCmd was pushed over the gocyclo complexity limit.

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