Repository navigation
Add campaign recipient CSV export and failure filters - #49
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9540bc8ff3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| params: ExportCampaignRecipientsParams, | ||
| maxPages = 500, | ||
| ): Promise<CampaignRecipientCsvResult> { | ||
| const chunks: string[] = [] |
There was a problem hiding this comment.
Stream completed pages instead of buffering the full export
For large campaigns, this array retains every CSV page and chunks.join('') later creates another full-sized string, so the supported 500-page × 1,000-row export can consume hundreds of megabytes before writing anything. Moreover, if a later page request or validation fails, the function throws before returning, causing all successfully fetched rows and their safe resume cursor to be discarded. Write each validated page incrementally, as the existing call-record exporter does, while tracking the cursor needed to resume after a failure.
Useful? React with 👍 / 👎.
| if (result.nextCursor !== null) | ||
| process.stderr.write(`Continue with --cursor ${result.nextCursor}\n`) |
There was a problem hiding this comment.
Honor the output mode for continuation diagnostics
When a bounded export is run with --quiet, this branch still emits a successful continuation message, contradicting the inherited flag's promise to suppress successful output; with --json, it emits the same human sentence rather than a machine-readable diagnostic. This is observable whenever --max-pages stops before the final page, especially for scripts using a file destination, so route the message through this.outputMode(flags) as the existing calls export command does.
Useful? React with 👍 / 👎.
Campaign recipient pages now expose normalized failure reasons and a paged CSV response. This CLI change adds
campaign recipients list --reasonandcampaign recipients export, which follows cursor pages, writes one CSV header, and supports filters, resume cursors, a page limit, and file output without replacing an existing file unless--forceis set.Contract source: polymorfa/polymorfa#331 at
1c9bf4242. SDK implementation: polymorfa/sdks#309 at8d5cf6512; the CLI was typechecked against that local SDK draft. The CLI's registry dependency and lockfile remain on the last published version. After the API merges and the SDK is published, pin the exact published SDK version and integrity, regenerate the lockfile, rerun the command tests, and then mark this PR ready.Six-part impact: API and public reference are in #331; SDK methods and types are in #309; CLI commands and README are updated here; customer guides and the release record are in #331; release availability remains blocked on publication, deployment, and live acceptance; Admin is unaffected because this adds a customer-scoped recipient read and no staff recipient access.
Validation: 25 campaign-recipient command tests, CLI typecheck and ESLint passed against the local SDK draft. No deployed endpoint was exercised.
Need help on this PR? Tag
@codesmithwith what you need. Autofix is disabled.