Skip to content

Remove the batch --stream flag#30

Merged
jclusso merged 2 commits into
masterfrom
batch-stream-ndjson
Jun 4, 2026
Merged

Remove the batch --stream flag#30
jclusso merged 2 commits into
masterfrom
batch-stream-ndjson

Conversation

@jclusso
Copy link
Copy Markdown
Member

@jclusso jclusso commented Jun 4, 2026

Why

--stream on batch verify / batch get doesn't meaningfully stream. For an already-completed batch — the normal case when you get one — the completed API payload drops the top-level total/processed counts, so the progress gate s.Total > 0 never fires and the command emits a single {"event":"complete",...,"emails":[...]} line. That's effectively --json wrapped in an envelope, not streaming.

There's nothing to stream for a completed batch: the API returns the whole emails array in one response (large batches return a download_file URL, not inline rows). The only genuinely useful piece — NDJSON result rows — is already achievable with the built-in --jq:

emailable batch get <id> --wait --jq '.emails[]'
emailable batch get <id> --wait --jq '.emails[] | select(.state == "deliverable") | .email'

Since --stream is unreleased, removing it is cleaner than redefining it.

What

  • Drop the --stream flag from batch verify and batch get.
  • Remove batchStreamer, the emit* helpers, newStreamerIfEnabled, and applyStreamImplications.
  • Simplify waitForCompletion back to a plain poller (progress bar on stderr, as before).
  • batch get --wait now honors --quiet for the polling UI, matching batch verify.
  • Document the --jq '.emails[]' NDJSON recipe (paired with --wait) in the README and the emailable skill.

All tests pass.

The --stream flag on `batch verify` and `batch get` never earned its place. For an already-completed batch — the normal case when you `get` one — the completed API payload drops the top-level total/processed counts, so the progress gate never fired and the command emitted a single `{"event":"complete",...,"emails":[...]}` line. That's just `--json` wrapped in an envelope, not streaming.

There's nothing to stream for a completed batch: the API returns the whole `emails` array in one response. And the NDJSON-rows shape that would have been useful is already achievable with the built-in `--jq`:

  emailable batch get <id> --jq '.emails[]'

Since --stream is unreleased, remove it rather than redefine it. This drops batchStreamer, the emit* helpers, newStreamerIfEnabled, and applyStreamImplications, and simplifies waitForCompletion back to a plain poller whose progress bar writes to stderr. README and the emailable skill now document the `--jq '.emails[]'` recipe for NDJSON output.
Copilot AI review requested due to automatic review settings June 4, 2026 16:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the unreleased --stream flag from batch verify / batch get, deleting the NDJSON “event streaming” implementation and simplifying batch polling back to a plain --wait workflow, while documenting --jq '.emails[]' as the preferred NDJSON row output approach.

Changes:

  • Removed the --stream flag and associated streaming/event-emission code paths from batch commands.
  • Simplified waitForCompletion to a non-streaming poller (UI progress on stderr when not in JSON mode).
  • Updated README and the Emailable skill docs to recommend NDJSON row output via --jq on the completed batch payload.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
skills/emailable/SKILL.md Removes --stream guidance; documents NDJSON row output via --jq '.emails[]'.
README.md Removes --stream docs and replaces “NDJSON streaming” section with the --jq '.emails[]' recipe.
cmd/jq_test.go Removes tests specific to filtering --stream event envelopes.
cmd/batch.go Deletes --stream flag handling and streamer helpers; simplifies waitForCompletion signature/logic.
cmd/batch_e2e_test.go Removes end-to-end and helper/unit tests that validated --stream behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment thread skills/emailable/SKILL.md Outdated
Comment thread cmd/batch.go Outdated
- `batch get --wait` now suppresses the polling UI under --quiet, matching `batch verify` (the --quiet help promises to suppress progress).
- README and skill NDJSON recipes pair `.emails[]` with --wait, since a still-verifying batch has no `emails` field and `.emails[]` would error under --jq.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@jclusso jclusso merged commit 19185ee into master Jun 4, 2026
3 of 4 checks passed
@jclusso jclusso deleted the batch-stream-ndjson branch June 4, 2026 17:35
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