[codex] Fix preview dummy payments customer types#1398
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
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)
📝 WalkthroughWalkthroughUpdates dummy payments seeding to be type-driven and exports Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
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)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
Greptile SummaryThis PR fixes a config coherence bug in preview dummy payments seed data: products ( Confidence Score: 5/5Safe to merge — targeted fix with a regression test covering the exact failure mode. All products and items are correctly aligned to customerType "team" matching their product lines. The export is clean, types are tightened, and the new regression test validates the fix end-to-end with inline snapshots. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[buildDummyPaymentsSetup] --> B[paymentsProducts]
B --> P1["starter\ncustomerType: team\nproductLineId: workspace"]
B --> P2["growth\ncustomerType: team\nproductLineId: workspace"]
B --> P3["regression-addon\ncustomerType: team\nproductLineId: add_ons"]
A --> C[paymentsBranchOverride]
C --> PL1["workspace productLine\ncustomerType: team ✓"]
C --> PL2["add_ons productLine\ncustomerType: team ✓"]
C --> IT["items: studio_seats, review_passes,\nautomation_minutes, snapshot_credits\ncustomerType: team ✓"]
C --> B
A --> D["paymentsEnvironmentOverride\ntestMode: true"]
E[seed-dummy-data.test.ts] --> A
E --> F{getConfigOverrideErrors\ngetIncompleteConfigWarnings}
F --> G["status: ok ✓"]
Reviews (1): Last reviewed commit: "fix preview dummy payments customer type..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Fixes preview dummy payments seed data so the configured payments products/items are team-scoped and consistent with their team-scoped product lines, preventing unrelated environment override writes from failing validation.
Changes:
- Export
buildDummyPaymentsSetup()and update dummy payments products/items tocustomerType: "team". - Add a Vitest regression test ensuring the generated branch payments override has no override errors or incomplete-config warnings.
- Document the root-cause warning in
.claude/CLAUDE-KNOWLEDGE.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/backend/src/lib/seed-dummy-data.ts | Exports dummy payments setup helper; aligns seeded payments config customer types to team-scoped. |
| apps/backend/src/lib/seed-dummy-data.test.ts | Adds regression test validating dummy payments branch override passes config override validation. |
| .claude/CLAUDE-KNOWLEDGE.md | Documents why preview environment override writes could fail due to product/product-line customerType mismatch. |
Comments suppressed due to low confidence (1)
apps/backend/src/lib/seed-dummy-data.ts:110
PaymentsSetup.paymentsProductsis now typed asRecord<string, Config>, butTransactionsSeedOptions.paymentsProductsis stillRecord<string, unknown>, which drops type safety when passing the same object intoseedDummyTransactions. Consider updatingTransactionsSeedOptions.paymentsProductstoRecord<string, Config>(or a more specific product snapshot type) so uses likeresolveProduct(...)stay consistently typed.
type TransactionsSeedOptions = {
prisma: PrismaClientTransaction,
tenancyId: string,
teamNameToId: Map<string, string>,
userEmailToId: Map<string, string>,
paymentsProducts: Record<string, unknown>,
};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Updated `PaymentsSetup` and `TransactionsSeedOptions` types to use a more specific `PaymentsProducts` type instead of a generic `Record<string, Config>`. - Adjusted the seeding logic for dummy transactions to correctly resolve customer IDs for teams instead of users. - Enhanced the dummy data generation for payments to ensure better alignment with the updated type definitions.
Summary
Fixes preview dummy payments seed data so seeded products and items match their team-scoped product lines.
Root Cause
The preview seed configured
workspaceandadd_onsproduct lines withcustomerType: "team", but the products inside those lines (starter,growth, andregression-addon) were configured ascustomerType: "user". Environment override writes validate against the rendered branch config, so unrelated environment updates could fail with a product/product-line customer type warning.Changes
Validation
Passed in the original checkout with dependencies installed:
STACK_SKIP_TEMPLATE_GENERATION=true pnpm exec vitest run --config vitest.config.ts src/lib/seed-dummy-data.test.ts --reporter=verbose --maxWorkers=1 --minWorkers=1pnpm -C apps/backend lint src/lib/seed-dummy-data.ts src/lib/seed-dummy-data.test.tspnpm -C apps/backend typecheckThe temporary clean worktree used for this PR did not have
node_modules, so dependency-backed commands were not rerun there.Summary by CodeRabbit
Improvements
Tests
Documentation