Skip to content

fix(apps): use brand-agnostic adopter config imports#387

Open
diego-artificerinnovations wants to merge 3 commits into
developfrom
diego/issues-380-381-adopter-config-imports
Open

fix(apps): use brand-agnostic adopter config imports#387
diego-artificerinnovations wants to merge 3 commits into
developfrom
diego/issues-380-381-adopter-config-imports

Conversation

@diego-artificerinnovations
Copy link
Copy Markdown
Contributor

Summary

Fixes #380 and #381.

#380 — Replace deprecated BEAKERSTACK_METER_AI_SUMMARIZE in apps/*

The BEAKERSTACK_METER_AI_SUMMARIZE constant was deprecated in favour of METER_AI_SUMMARIZE (brand-agnostic) in adopter/config/billing.ts. Six files in apps/ still imported the old name. Updated all of them to use METER_AI_SUMMARIZE.

#381 — Replace hardcoded branding in apps/* test assertions

Five test files asserted against hardcoded template branding values ("Beaker Stack", "beakerstack", the template GitHub URL). After npm run rename only adopter/ is updated, leaving these assertions stale. Each hardcoded value is replaced with the corresponding import from @adopter/config/*:

File Old New
BillingScreens.test.tsx "Beaker Stack web app" branding.displayName + " web app"
adminUsageColumns.test.ts 'beakerstack' billingConfig.productId
useDemoCollections.test.tsx 'beakerstack' (×3) appIdentity.productId
DashboardPage.test.tsx hardcoded GitHub URL landingConfig.finalCta.secondaryCta!.href
SignupInvitePage.test.tsx 'beakerstack' billingConfig.productId

Test plan

  • Type-check passes locally (npm run type-check) — confirmed clean in pre-commit hook
  • ESLint passes — confirmed clean in pre-commit hook
  • CI unit tests green

🤖 Generated with Claude Code

Replace deprecated BEAKERSTACK_METER_AI_SUMMARIZE with METER_AI_SUMMARIZE
in all apps/* billing screens. Update test assertions in apps/* to import
from @adopter/config/* so they stay correct after npm run rename.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot temporarily deployed to pr-387-preview May 25, 2026 04:13 Inactive
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 25, 2026

CI Coverage & Test Summary

Metric Coverage Covered / Total
Statements 99.89% 20706 / 20728
Branches 98.46% 4992 / 5070
Functions 99.87% 752 / 753
Lines 99.90% 20696 / 20717

Suites: 64 passed, 0 failed (64 total) · Tests: 665 passed, 0 failed (665 total)

✅ All reported test suites passed.

Coverage artifacts: coverage-summary, coverage-packages.


Updated at: May 31, 2026 at 12:22 PM PDT

@ZappoMan ZappoMan requested a review from Copilot May 25, 2026 04:13
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 25, 2026

Component Status Link
🌐 Web View logs
🗄️ Database
💳 Billing ✅ Deployed
📱 Mobile ✅ Deployed

Last deployed: 12:22 PDT


📱 Mobile preview: Channel pr-387

📱 Mobile Preview (OTA Updates)

No native code changes detected - using OTA updates only.

⚠️ Note: This app requires a Development Build (Expo Go will not work due to native Google OAuth).

Step 1: Install Development Build (one-time setup)

  1. Build: npm run mobile:build:dev:ios (or mobile:build:dev:android)
  2. Download from Expo dashboard
  3. Install: EAS_BUILD_PATH=~/Downloads/BeakerStack.ipa npm run mobile:install:dev:ios (iOS) or EAS_BUILD_PATH=~/Downloads/BeakerStack.apk npm run mobile:install:dev:android (Android)

Step 2: Load PR Preview Update

  1. Open the development build on your device/simulator
  2. Shake device (or Cmd+D on iOS / Cmd+M on Android) → "Enter URL manually"
  3. Paste the update URL: https://u.expo.dev/23c5e522-5341-4342-85f5-f2e46dd6087f?channel-name=pr-387
  4. The app will reload with the JavaScript bundle from channel pr-387

Note: You must use the full URL format - just entering the channel name (pr-387) will not work.

Alternative: For local development, use: cd apps/mobile && npx expo start --dev-client, then press 'i' for iOS simulator.

📖 See Mobile Build Testing Guide for detailed instructions.

Copy link
Copy Markdown

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

This PR makes the apps/mobile and apps/web template code resilient to npm run rename -- --preserve-upstream by removing BeakerStack-prefixed billing meter imports and by replacing hardcoded branding/product-id expectations in app tests with values sourced from @adopter/config/*.

Changes:

  • Replaced BEAKERSTACK_METER_AI_SUMMARIZE imports/usages with the brand-agnostic METER_AI_SUMMARIZE in billing screens/pages and a related web billing test.
  • Updated several apps/* unit tests to assert against adopter config values (billingConfig.productId, appIdentity.productId, branding.displayName, landingConfig URLs) instead of hardcoded template strings.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apps/web/src/pages/billing/BillingUsagePage.tsx Switches meter constant import to brand-agnostic METER_AI_SUMMARIZE.
apps/web/src/pages/billing/BillingPlansPage.tsx Updates useUsage call to use METER_AI_SUMMARIZE.
apps/web/src/pages/billing/BillingOverviewPage.tsx Updates useUsage call to use METER_AI_SUMMARIZE.
apps/web/src/pages/tests/SignupInvitePage.test.tsx Uses billingConfig.productId in expected request body.
apps/web/src/pages/tests/DashboardPage.test.tsx Uses landingConfig for the expected GitHub link href.
apps/web/src/billing/tests/useDemoCollections.test.tsx Uses appIdentity.productId in expected RPC args.
apps/web/src/billing/tests/beakerstackBillingConfig.test.ts Updates test to use METER_AI_SUMMARIZE constant.
apps/web/src/admin/tests/adminUsageColumns.test.ts Uses billingConfig.productId for expected admin product id.
apps/mobile/src/screens/billing/BillingUsageScreen.tsx Switches meter constant import to brand-agnostic METER_AI_SUMMARIZE.
apps/mobile/src/screens/billing/BillingOverviewScreen.tsx Updates useUsage call to use METER_AI_SUMMARIZE.
apps/mobile/tests/screens/billing/BillingScreens.test.tsx Uses branding.displayName in the payment-failed banner assertion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/mobile/__tests__/screens/billing/BillingScreens.test.tsx
Comment thread apps/web/src/pages/__tests__/DashboardPage.test.tsx
Copy link
Copy Markdown
Contributor

@ZappoMan ZappoMan left a comment

Choose a reason for hiding this comment

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

Review summary

Solid direction for #380/#381 — the METER_AI_SUMMARIZE migration and config-driven product-id assertions look correct, and CI is green.

Two Copilot findings remain open (replied inline). One additional issue below on the Dashboard GitHub link test.

Scope note: This PR covers the listed apps/* files well. Hardcoded branding elsewhere in apps/* (e.g. beakerstack_free plan ids in other test fixtures) is out of scope for #381 but may be worth a follow-up.

Comment thread apps/web/src/pages/__tests__/DashboardPage.test.tsx Outdated
- BillingScreens.test.tsx: replace new RegExp(branding.displayName) with
  plain string to avoid metacharacter injection on rebrand
- DashboardPage.test.tsx: add explicit toBeDefined() guard; drop non-null assertion
- DemoBanner.tsx: read View on GitHub href from landingConfig.finalCta
  .secondaryCta instead of hardcoding

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ling test

The payment-failed banner renders the display name mid-sentence; exact
string matching fails. Switching to exact:false preserves safe plain-string
assertion without regex metacharacter risk.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@ZappoMan ZappoMan left a comment

Choose a reason for hiding this comment

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

Re-reviewed after follow-up commits — all prior feedback is addressed.

  • METER_AI_SUMMARIZE migration and config-driven test assertions look correct
  • BillingScreens uses safe plain-string matching (exact: false)
  • DashboardPage test has an explicit guard; DemoBanner shares the same landingConfig source
  • CI green

LGTM.

@github-actions
Copy link
Copy Markdown
Contributor

End 2 End - Test Results

Summary

Metric Count
✅ Passed 49
☑️ Passed after retry 0
⚠️ Skipped 4
❌ Failed 0
⏱️ Total Duration 0.75 min

By category

Category Passed Failed Skipped
admin 13 0 0
auth 12 0 0
billing 7 0 4
marketing 7 0 0
navigation 3 0 0
profile 2 0 0
waitlist 5 0 0

Test Environment

🌐 Domain: https://deploy.beakerstack.com/pr-387/

View workflow run

Details

Test Status Duration
admin (13 passed)
admin/access.spec.ts › Admin access › admin can open users page from overview ✅ passed 0.05 min
admin/access.spec.ts › Admin access › allows admin users to view admin overview ✅ passed 0.04 min
admin/access.spec.ts › Admin access › overview shows operator cards ✅ passed 0.05 min
admin/access.spec.ts › Admin access › redirects non-admin users to not authorized ✅ passed 0.04 min
admin/marketing-email.spec.ts › Admin marketing email settings › loads settings form ✅ passed 0.02 min
admin/navigation.spec.ts › Admin navigation › sidebar footer links to dashboard ✅ passed 0.01 min
admin/navigation.spec.ts › Admin navigation › sidebar reaches all admin sections ✅ passed 0.02 min
admin/navigation.spec.ts › Admin navigation › user menu Admin link opens admin overview ✅ passed 0.03 min
admin/users.spec.ts › Admin users › lists a newly created user in the table ✅ passed 0.03 min
admin/users.spec.ts › Admin users › searches by email and opens detail drawer ✅ passed 0.04 min
admin/waitlist-settings.spec.ts › Admin waitlist settings › updates signup mode and saves settings ✅ passed 0.04 min
admin/waitlist.spec.ts › Admin waitlist › approves a pending entry from the detail drawer ✅ passed 0.02 min
admin/waitlist.spec.ts › Admin waitlist › invites by email from admin panel ✅ passed 0.02 min
auth (12 passed)
auth/forgot-password.spec.ts › Forgot password › shows expired link notice when expired query param is set ✅ passed 0.01 min
auth/forgot-password.spec.ts › Forgot password › submits reset request and shows confirmation message ✅ passed 0.04 min
auth/forgot-password.spec.ts › Forgot password › validates email is required ✅ passed 0.01 min
auth/login-validation.spec.ts › Login validation › links to signup from login page ✅ passed 0.03 min
auth/login-validation.spec.ts › Login validation › requires email and password before submit ✅ passed 0.03 min
auth/login.spec.ts › Login › signs in seeded user and lands on dashboard ✅ passed 0.04 min
auth/logout.spec.ts › Logout › signs out from user menu and returns to landing ✅ passed 0.04 min
auth/protected-routes.spec.ts › Protected routes › redirects unauthenticated billing visit to home ✅ passed 0.02 min
auth/protected-routes.spec.ts › Protected routes › redirects unauthenticated dashboard visit to home ✅ passed 0.02 min
auth/protected-routes.spec.ts › Protected routes › redirects unauthenticated profile visit to home ✅ passed 0.02 min
auth/signup-invite.spec.ts › Signup invite › shows invalid invite message when token is missing ✅ passed 0.02 min
auth/signup.spec.ts › Signup › creates an account or prompts for email confirmation ✅ passed 0.04 min
billing (7 passed, 4 skipped)
billing/billing-stripe.spec.ts › Billing Stripe flows › loads invoices page after upgrade ⚠️ skipped 0.00 min
billing/billing-stripe.spec.ts › Billing Stripe flows › schedules downgrade to Free after Pro subscription ⚠️ skipped 0.00 min
billing/billing-stripe.spec.ts › Billing Stripe flows › shows annual switch option for paid plan ⚠️ skipped 0.00 min
billing/billing-stripe.spec.ts › Billing Stripe flows › upgrades Free to Pro via Stripe Checkout ⚠️ skipped 0.00 min
billing/metered-usage.spec.ts › Billing metered usage › reaches collection limit on free plan ✅ passed 0.02 min
billing/metered-usage.spec.ts › Billing metered usage › shows add item control on dashboard demo ✅ passed 0.02 min
billing/metered-usage.spec.ts › Billing metered usage › simulates AI summarize and reflects usage on billing page ✅ passed 0.01 min
billing/navigation.spec.ts › Billing navigation › navigates across billing tabs ✅ passed 0.04 min
billing/overview.spec.ts › Billing overview › shows billing hub with current plan context ✅ passed 0.02 min
billing/plans.spec.ts › Billing plans › lists available plans for authenticated users ✅ passed 0.02 min
billing/usage.spec.ts › Billing usage › shows usage meters and plan limits ✅ passed 0.02 min
marketing (7 passed)
marketing/landing-nav.spec.ts › Marketing landing navigation › header links reach landing sections and auth CTAs ✅ passed 0.04 min
marketing/landing.spec.ts › Marketing landing › navigates to signup from Get started CTA ✅ passed 0.03 min
marketing/landing.spec.ts › Marketing landing › shows hero content and signup CTA ✅ passed 0.03 min
marketing/policies.spec.ts › Policy pages › renders Privacy Policy ✅ passed 0.02 min
marketing/policies.spec.ts › Policy pages › renders Refunds Policy ✅ passed 0.02 min
marketing/policies.spec.ts › Policy pages › renders Terms of Service ✅ passed 0.02 min
marketing/pricing.spec.ts › Marketing pricing section › renders plan tiers and signup CTAs in open mode ✅ passed 0.03 min
navigation (3 passed)
navigation/admin-menu.spec.ts › Admin menu navigation › admin user sees Admin link in user menu ✅ passed 0.02 min
navigation/admin-menu.spec.ts › Admin menu navigation › non-admin user does not see Admin link ✅ passed 0.02 min
navigation/user-menu.spec.ts › Authenticated navigation › user menu links reach profile, billing, and dashboard ✅ passed 0.03 min
profile (2 passed)
profile/profile.spec.ts › Profile › edits bio, website, and location then persists after reload ✅ passed 0.02 min
profile/profile.spec.ts › Profile › updates display name from profile editor ✅ passed 0.01 min
waitlist (5 passed)
waitlist/closed-mode.spec.ts › Waitlist closed mode › hides pricing and blocks signup ✅ passed 0.02 min
waitlist/invite-only.spec.ts › Waitlist invite-only mode › blocks public signup without invite token ✅ passed 0.01 min
waitlist/invite-signup.spec.ts › Waitlist invite signup › completes signup from approved invite token ✅ passed 0.04 min
waitlist/pricing-cta.spec.ts › Waitlist pricing CTA › pricing CTA navigates to signup with plan intent ✅ passed 0.01 min
waitlist/public-signup.spec.ts › Waitlist public signup › shows waitlist form and submits email ✅ passed 0.02 min

Updated at: May 31, 2026 at 4:49 PM PDT

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