Skip to content

[codex] Fix preview dummy payments customer types#1398

Merged
mantrakp04 merged 2 commits intodevfrom
codex/fix-preview-dummy-payments-customer-types
May 1, 2026
Merged

[codex] Fix preview dummy payments customer types#1398
mantrakp04 merged 2 commits intodevfrom
codex/fix-preview-dummy-payments-customer-types

Conversation

@mantrakp04
Copy link
Copy Markdown
Collaborator

@mantrakp04 mantrakp04 commented Apr 30, 2026

Summary

Fixes preview dummy payments seed data so seeded products and items match their team-scoped product lines.

Root Cause

The preview seed configured workspace and add_ons product lines with customerType: "team", but the products inside those lines (starter, growth, and regression-addon) were configured as customerType: "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

  • Mark preview dummy payments products and included items as team-scoped.
  • Export the dummy payments setup helper for focused validation.
  • Add a regression test that validates the generated branch payments override has no config override errors or incomplete config warnings.

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=1
  • pnpm -C apps/backend lint src/lib/seed-dummy-data.ts src/lib/seed-dummy-data.test.ts
  • pnpm -C apps/backend typecheck

The temporary clean worktree used for this PR did not have node_modules, so dependency-backed commands were not rerun there.

Summary by CodeRabbit

  • Improvements

    • Strengthened payment product configuration with tighter typing and validation
    • Normalized product customer types (switched relevant dummy data from user to team) for consistency
  • Tests

    • Added tests validating dummy payments configuration and branch/override validation
  • Documentation

    • Added Q&A documenting a configuration validation failure mode and required consistency for dummy payments data

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stack-auth-hosted-components Ready Ready Preview, Comment Apr 30, 2026 4:44pm
stack-backend Ready Ready Preview, Comment Apr 30, 2026 4:44pm
stack-dashboard Ready Ready Preview, Comment Apr 30, 2026 4:44pm
stack-demo Ready Ready Preview, Comment Apr 30, 2026 4:44pm
stack-docs Ready Ready Preview, Comment Apr 30, 2026 4:44pm
stack-preview-backend Ready Ready Preview, Comment Apr 30, 2026 4:44pm
stack-preview-dashboard Ready Ready Preview, Comment Apr 30, 2026 4:44pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e27a5b65-8f81-435b-892f-8220fcf87c49

📥 Commits

Reviewing files that changed from the base of the PR and between be7a8d7 and 9c84632.

📒 Files selected for processing (1)
  • apps/backend/src/lib/seed-dummy-data.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/backend/src/lib/seed-dummy-data.ts

📝 Walkthrough

Walkthrough

Updates dummy payments seeding to be type-driven and exports buildDummyPaymentsSetup; switches product customerType values from user to team; adds a test validating branch override config; documents a specific environment-override validation failure mode requiring product/customerType consistency.

Changes

Cohort / File(s) Summary
Documentation
.claude/CLAUDE-KNOWLEDGE.md
Adds Q&A documenting the environment-override validation failure mode: overrides validate against rendered branch config and require each product's customerType to match its product line's customerType.
Seed data implementation
apps/backend/src/lib/seed-dummy-data.ts
Makes payments setup type-driven (imports/uses Config types), exports buildDummyPaymentsSetup(), changes products and included items customerType from 'user' to 'team', and adjusts transaction seeding to use team-based customerId.
Tests
apps/backend/src/lib/seed-dummy-data.test.ts
Adds Vitest file that asserts the dummy payments branch override produces no config override errors or incomplete-config warnings (inline snapshot assertions).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • N2D4

Poem

"Hop hop, I checked each payment stream,
Team customers now the new regime,
Types aligned and tests that sing,
Overrides pass — what joy they bring! 🐇💳"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title '[codex] Fix preview dummy payments customer types' directly and clearly summarizes the main fix: aligning customer types in dummy payments data.
Description check ✅ Passed The description provides a clear summary, root cause analysis, detailed changes, and validation steps that align well with the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-preview-dummy-payments-customer-types

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.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 30, 2026

Greptile Summary

This PR fixes a config coherence bug in preview dummy payments seed data: products (starter, growth, regression-addon) and their associated items were declared with customerType: \"user\" while their parent product lines (workspace, add_ons) use customerType: \"team\", causing environment override writes to fail with validation warnings. The fix aligns all products and items to customerType: \"team\", exports buildDummyPaymentsSetup for testability, tightens the PaymentsSetup type from Record<string, unknown> to Record<string, Config>, and adds a regression test that validates no config errors or warnings are produced.

Confidence Score: 5/5

Safe 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

Filename Overview
apps/backend/src/lib/seed-dummy-data.ts Corrects customerType from "user" to "team" on all three products and four items to match their product lines; exports buildDummyPaymentsSetup and tightens PaymentsSetup type.
apps/backend/src/lib/seed-dummy-data.test.ts New regression test that validates the generated payments branch config override produces no errors or incomplete-config warnings.
.claude/CLAUDE-KNOWLEDGE.md Adds a Q&A entry explaining why environment config override writes fail when product and product-line customer types are mismatched.

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 ✓"]
Loading

Reviews (1): Last reviewed commit: "fix preview dummy payments customer type..." | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

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

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 to customerType: "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.paymentsProducts is now typed as Record<string, Config>, but TransactionsSeedOptions.paymentsProducts is still Record<string, unknown>, which drops type safety when passing the same object into seedDummyTransactions. Consider updating TransactionsSeedOptions.paymentsProducts to Record<string, Config> (or a more specific product snapshot type) so uses like resolveProduct(...) 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.

Comment thread apps/backend/src/lib/seed-dummy-data.ts
Comment thread apps/backend/src/lib/seed-dummy-data.ts
@mantrakp04 mantrakp04 requested a review from BilalG1 April 30, 2026 16:27
- 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.
@mantrakp04 mantrakp04 merged commit d2f2fb0 into dev May 1, 2026
35 of 37 checks passed
@mantrakp04 mantrakp04 deleted the codex/fix-preview-dummy-payments-customer-types branch May 1, 2026 16:44
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.

3 participants