Skip to content

Add campaign recipient CSV export and failure filters - #49

Merged
purpshell merged 1 commit into
devfrom
codex/campaign-recipient-export-cli
Oct 5, 2026
Merged

purpshell merged 1 commit into
devfrom
codex/campaign-recipient-export-cli

Conversation

@purpshell

@purpshell purpshell commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Campaign recipient pages now expose normalized failure reasons and a paged CSV response. This CLI change adds campaign recipients list --reason and campaign 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 --force is set.

Contract source: polymorfa/polymorfa#331 at 1c9bf4242. SDK implementation: polymorfa/sdks#309 at 8d5cf6512; 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.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Comment @coderabbitai help to get the list of available commands.

@purpshell

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T06:06:55.261287Z 9540bc8 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 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".

Comment thread src/services/campaigns.ts
params: ExportCampaignRecipientsParams,
maxPages = 500,
): Promise<CampaignRecipientCsvResult> {
const chunks: string[] = []

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Comment on lines +107 to +108
if (result.nextCursor !== null)
process.stderr.write(`Continue with --cursor ${result.nextCursor}\n`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@purpshell
purpshell merged commit 5025c1d into dev Oct 5, 2026
2 of 3 checks passed
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.

1 participant