Skip to content

fix(cli): apply jq filters to batch command output - #4257

Open
rudycelekli wants to merge 2 commits into
Tencent:mainfrom
rudycelekli:fix/cli-batch-jq-20261013
Open

rudycelekli wants to merge 2 commits into
Tencent:mainfrom
rudycelekli:fix/cli-batch-jq-20261013

Conversation

@rudycelekli

Copy link
Copy Markdown

Summary

Batch commands ignored --jq and emitted the entire envelope even when callers requested a projection. Route JSON/NDJSON batch output through the existing filter using the same envelope construction, preserving verdicts, per-item results, counters, and exit status.

Validation

  • Six real SDK/HTTP document-delete regressions cover JSON/NDJSON and successful, partially failed, and fully failed batches. All six fail against the original source and pass with this change.
  • Full CLI go test -count=1 ./... and go vet ./... pass.
  • golangci-lint 2.12.2, run --new-from-rev=origin/main --concurrency=2 --timeout=2m ./..., passes from cli/.

Validation uses temporary configuration and synthetic loopback HTTP, with no live customer services. Full backend checks remain blocked by uncached backend dependencies; these results cover the CLI module. Developed and reviewed with AI assistance.

Copilot AI balanced review requested due to automatic review settings October 13, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Empty recursive uploads still bypass EmitBatch and ignore --jq.

1 open finding
What changed in this PR

Routes batch JSON/NDJSON output through the existing jq filter while preserving the canonical envelope.

Changes:

  • Extracts reusable batch-envelope construction.
  • Applies --jq filtering in EmitBatch.
  • Adds six document-delete regression cases.
File Description
cli/​internal/​output/​batch.go Extracts canonical envelope construction.
cli/​internal/​cmdutil/​batch.go Applies jq filters to batch envelopes.
cli/​cmd/​doc/​delete_jq_test.go Tests JSON/NDJSON batch projections.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cli/internal/cmdutil/batch.go
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>

This branch has not been deployed

No deployments
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