fix(stripe): keep customer email export org scoped#2250
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe standalone script exporting paid Stripe customers without orgs is removed and its npm script entry deleted; the org-email export script ( ChangesScript Consolidation and Status-Based Export
Sequence DiagramsequenceDiagram
participant CLI as Client (CLI)
participant SB as Supabase
participant ST as Stripe
participant CSV as CSV Exporter
CLI->>SB: fetch orgs and member emails
CLI->>ST: fetch paid invoice coverage for customer IDs
ST-->>CLI: paid coverage summaries
CLI->>CLI: synthesize never_paid summaries for missing IDs (if requested)
CLI->>CLI: filter/combine summaries per status filter
CLI->>CSV: write composed customerSummaries to CSV
CSV-->>CLI: CSV file written
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
scripts/export_stripe_six_month_org_emails.ts (1)
39-40: ⚡ Quick winUse camelCase for new constant identifiers
Line 39-40 introduces
DEFAULT_STATUS_FILTERandSTATUS_FILTERSin UPPER_SNAKE_CASE. Please rename these to camelCase (for example,defaultStatusFilter,statusFilters) to align with repository naming rules.As per coding guidelines, "
**/*.{ts,tsx,js}: Use camelCase for variable and function names".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/export_stripe_six_month_org_emails.ts` around lines 39 - 40, Rename the UPPER_SNAKE_CASE constants DEFAULT_STATUS_FILTER and STATUS_FILTERS to camelCase (e.g., defaultStatusFilter and statusFilters) throughout the file and any usages; keep the original values and the `as const` type assertion on STATUS_FILTERS (now statusFilters). Update all references (including any exports or imports) to use the new identifiers so no references break, and ensure any linter/type checks pass after the rename.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/export_stripe_six_month_org_emails.ts`:
- Around line 368-375: The current call to buildPaidCustomerSummaries applies
minMonths regardless of statusFilter, causing --status=all to exclude paid orgs
below the threshold; change the call so minMonths is only passed when
statusFilter !== 'all' (e.g. compute an args object where minMonths is omitted
or undefined for statusFilter === 'all') so that buildPaidCustomerSummaries
returns all paid customers for the "all" cohort before merging with
buildNeverPaidCustomerSummaries; update the invocation in the block that defines
paidCustomerSummaries (and keep nowMs unchanged).
---
Nitpick comments:
In `@scripts/export_stripe_six_month_org_emails.ts`:
- Around line 39-40: Rename the UPPER_SNAKE_CASE constants DEFAULT_STATUS_FILTER
and STATUS_FILTERS to camelCase (e.g., defaultStatusFilter and statusFilters)
throughout the file and any usages; keep the original values and the `as const`
type assertion on STATUS_FILTERS (now statusFilters). Update all references
(including any exports or imports) to use the new identifiers so no references
break, and ensure any linter/type checks pass after the rename.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 989bb0e9-0752-4d4e-8620-51afb5b28fd1
📒 Files selected for processing (3)
package.jsonscripts/export_stripe_paid_customers_without_org.tsscripts/export_stripe_six_month_org_emails.ts
💤 Files with no reviewable changes (2)
- package.json
- scripts/export_stripe_paid_customers_without_org.ts
|



Summary (AI generated)
--status=paid|active|canceled|never_paid|all.email,paid_duration_months, andactive_paying.Motivation (AI generated)
The export should stay focused on emails for people in Capgo orgs, with filtering handled by one script option instead of a separate no-org export path.
Business Impact (AI generated)
This avoids producing the wrong customer cohort and keeps the Stripe export aligned with retention and customer outreach use cases for org members.
Test Plan (AI generated)
bunx eslint --no-ignore scripts/export_stripe_six_month_org_emails.ts scripts/stripe_paid_invoice_export_utils.tsbun --bun tsc --noEmit --ignoreConfig --skipLibCheck --allowImportingTsExtensions --moduleResolution bundler --module ESNext --target ESNext scripts/export_stripe_six_month_org_emails.ts scripts/stripe_paid_invoice_export_utils.tsgit diff --checkbun scripts/export_stripe_six_month_org_emails.ts --helpbun run cli:build && vue-tsc --noEmitSummary by CodeRabbit