Skip to content

Gate hosted coderouter on Pro - #9699

Merged
lawrencecchen merged 1 commit into
mainfrom
feat/coderouter-pro-billing-sentry
Aug 6, 2026
Merged

lawrencecchen merged 1 commit into
mainfrom
feat/coderouter-pro-billing-sentry

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • gates hosted coderouter session issuance on local authoritative cmux Pro state
  • principal-scopes route tokens and revokes them on all inactive subscription update paths
  • leaves self-hosted deployments explicitly billing-independent
  • adds coderouter-only, privacy-scrubbed Sentry with manaflow source-map uploads

Testing

  • bun run typecheck
  • bun run db:check
  • 47 focused billing/coderouter/Sentry tests
  • production free-user rejection and self-host integration coverage
  • production Sentry ingest, grouping, environment/release tags, and 2,796 uploaded source-map files

Demo

  • Ratatui Ctrl-C flow and production CLI were verified in cmux; no video is needed for this backend-focused change.

Review trigger

@coderabbitai review

Checklist

  • No Stripe query on model traffic hot path
  • Billing/storage failures fail closed
  • Secrets and PII are excluded from Sentry
  • Migrations applied using expand/deploy/contract ordering
  • Living architecture document updated

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR adds principal-scoped CodeRouter tokens, hosted Pro entitlement checks, subscription-triggered token revocation, and Sentry event filtering and scrubbing. It also adds injectable route dependencies, database migrations, environment validation, UI messaging, and tests.

Changes

CodeRouter entitlements and observability

Layer / File(s) Summary
Sentry privacy and instrumentation
web/instrumentation.ts, web/next.config.ts, web/services/sentry.ts, web/services/errors.ts, web/tests/coderouter-sentry.test.ts
Sentry filters CodeRouter events, removes sensitive data, captures sanitized errors, and uses deployment metadata.
User-scoped route-token storage
web/db/migrations/*.sql, web/db/schema.ts, web/services/coderouter/repository.ts
Route tokens require a stack user ID, support user-based revocation, and reject unscoped tokens.
Hosted session entitlement flow
web/app/api/coderouter/session/route.ts, web/app/env.ts, web/app/coderouter/page.tsx, web/tests/coderouter-session-route.test.ts
Session handlers add authenticated GET validation, hosted Pro checks, fail-closed entitlement errors, injectable dependencies, and request-derived router URLs. The CodeRouter page describes hosted Pro access and self-hosting.
Subscription-driven token revocation
web/app/api/stripe/webhook/route.ts, web/tests/stripe-webhook-route.test.ts
Inactive subscription updates revoke active CodeRouter route tokens for the affected user.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant SessionRoute
  participant EntitlementStore
  participant RouteTokenRepository
  Client->>SessionRoute: POST session request
  SessionRoute->>EntitlementStore: Check hosted Pro entitlement
  EntitlementStore-->>SessionRoute: Return entitlement status
  SessionRoute->>RouteTokenRepository: Issue user-scoped route token
  RouteTokenRepository-->>SessionRoute: Return token
  SessionRoute-->>Client: Return token and request-derived openaiBaseUrl
Loading

Possibly related PRs

  • manaflow-ai/cmux#9633: Introduces the CodeRouter session route and repository extended by this PR.
  • manaflow-ai/cmux#9692: Adds related CodeRouter route-token lifecycle management tied to account state.
  • manaflow-ai/cmux#9695: Uses the same principal-scoped CodeRouter token authentication and issuance infrastructure.

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (2 errors, 1 warning)

Check name Status Explanation Resolution
Cmux No Hacky Sleeps ❌ Error Production POST adds a fixed Retry-After: 5 response for entitlement-storage failure, creating wall-clock retry timing without an owner signal or cancellation-aware scheduler. Remove the fixed retry delay, or use a bounded, cancellation-aware retry policy driven by an authoritative entitlement-storage readiness signal and covered by tests.
Cmux Full Internationalization ❌ Error The production page adds hard-coded English UI text, and the session API adds English response copy; neither uses next-intl, and no matching entries were added to web/messages/*.json for the 20 loc... Move new page and API copy to next-intl keys, then add translated entries consistently to every locale file listed in web/i18n/routing.ts.
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (22 passed)
Check name Status Explanation
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.
Cmux Swift Actor Isolation ✅ Passed The PR diff contains only TypeScript, TSX, and SQL files; it introduces no production Swift changes or Swift actor-isolation issues.
Cmux Swift Blocking Runtime ✅ Passed The pull request changes only TypeScript, TSX, and SQL files; Git shows no changed Swift paths or Swift patch content, so it introduces no Swift blocking runtime.
Cmux Browser Automation Off-Main ✅ Passed The patch changes only web/Coderouter, database, Sentry, and tests; both browser automation rule paths are unchanged and the diff has no browser/WebKit/socket-worker terms.
Cmux Expensive Synchronous Load ✅ Passed The diff contains only TypeScript, TSX, and SQL files; it adds no production Swift changes or synchronous agent-history loads covered by this check.
Cmux Cache Substitution Correctness ✅ Passed The production diff contains no cache, memoization, or opportunistic-read substitution; route-token and webhook paths use direct database operations, and no history, undo, or snapshot consumer chan...
Cmux Algorithmic Complexity ✅ Passed The production diff adds only linear, bounded event scrubbing and indexed single-query token revocation; it introduces no nested collection scans, per-target rescans, or in-memory joins.
Cmux Swift Concurrency ✅ Passed The patch changes only TypeScript, TSX, and SQL files; no Swift files or Swift concurrency patterns are introduced.
Cmux Swift @Concurrent ✅ Passed The pull request changes no Swift files; all changed paths are TypeScript, TSX, SQL, and related web files, so the Swift @concurrent check is not applicable.
Cmux Swift Package Boundaries ✅ Passed The PR changes only web TypeScript, SQL, and related test files; the parent-to-HEAD diff contains no Swift changes, so the Swift package boundary check is not applicable.
Cmux Swiftpm Lockfiles ✅ Passed The PR diff contains only web TypeScript/TSX and SQL files; it changes no Package.swift, Package.resolved, Xcode project, .gitignore, workflow, or dependency files.
Cmux Swift Logging ✅ Passed The pull request changes no Swift files; the Swift-only diff is empty, so no Swift logging rule violation applies.
Cmux User-Facing Error Privacy ✅ Passed New session errors use generic unauthorized, pro_required, and entitlement_unavailable responses; recovery copy names only cmux Pro and self-hosting, with no upstream messages, secrets, IDs, or imp...
Cmux Swiftui State Layout ✅ Passed The commit changes 15 web/TypeScript, SQL, and test files; it contains no Swift files or SwiftUI state/layout changes.
Cmux Architecture Rethink ✅ Passed The commit changes only TypeScript, TSX, and SQL files; no Swift or Apple-platform paths are changed, so the Swift architecture check is not applicable.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed The PR diff contains no Swift paths; it changes only TypeScript, TSX, and SQL files, so it introduces no Swift auxiliary window shortcut violation.
Cmux Source Artifacts ✅ Passed All 15 changed paths are application/config source, database migrations, or tests; no artifact-like extensions, scratch directories, binaries, or generated output appear in the diff.
Cmux No Test Or Debug Seam In Production Source ✅ Passed The PR changes only web TypeScript, SQL, and configuration files; it contains no Swift diff under a production Sources/ path, so this check is not applicable.
Cmux No Ambient Global State ✅ Passed The pull request changes only TypeScript, TSX, and SQL files; it contains no production Swift changes, so this Swift-specific check is not applicable.
Title check ✅ Passed The title clearly summarizes the primary change: gating hosted Coderouter access on cmux Pro entitlement.
Description check ✅ Passed The description covers the change, rationale, testing, review trigger, and checklist with sufficient detail.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/coderouter-pro-billing-sentry

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

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/app/api/stripe/webhook/route.ts (1)

181-185: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Authorization Bypass (CWE-862): Missing Authorization

Reachability: External

Reachability path
● Entry
  web/tests/stripe-webhook-route.test.ts
│
▼
● Sink
  web/app/api/stripe/webhook/route.ts

Revoke tokens after invoice subscription updates return inactive.

applySubscriptionUpdate classifies past_due as an active Stripe status, but invoice webhook processing can still return scope: "user", isActive: false for unaligned subscription statuses. The invoice branch calls applySubscriptionUpdate without the inactive-user revocation check used in customer.subscription.*; run the same result guard here and cover invoice failures with a regression test.

🤖 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 `@web/app/api/stripe/webhook/route.ts` around lines 181 - 185, Update the
invoice webhook branch around applySubscriptionUpdate to inspect a non-skipped
result with scope "user" and isActive false, and revoke that user’s tokens using
the same guard and revocation path as the customer.subscription.* handling.
Preserve the existing invoice_subscription_unmapped response for skipped results
and processed response for active updates, and add a regression test covering an
inactive invoice update and token revocation.
🤖 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 `@web/app/api/coderouter/session/route.ts`:
- Around line 57-62: Remove the fixed "retry-after": "5" header from the
entitlement_unavailable response in the session route. Keep the 503 status and
no-store cache control, returning the retryable error without a wall-clock retry
policy; do not add sleep-based synchronization or an untested replacement.
- Around line 40-45: Update the entitlement response in the coderouter session
route to obtain the user-facing message, upgrade URL, and self-host URL through
the existing locale-specific localization API rather than hardcoded literals.
Add corresponding catalog entries for every supported locale, preserving the
existing pro_required response structure and keys.

In `@web/app/env.ts`:
- Around line 200-202: Update CODEROUTER_HOSTED_PRO_REQUIRED and the
hostedProRequired() decision so an absent hosted entitlement setting fails
closed instead of returning false; require an explicit configured value or
derive it from authoritative hosting configuration, ensuring authenticated
non-Pro users cannot receive route tokens when hosted enforcement is required.

---

Outside diff comments:
In `@web/app/api/stripe/webhook/route.ts`:
- Around line 181-185: Update the invoice webhook branch around
applySubscriptionUpdate to inspect a non-skipped result with scope "user" and
isActive false, and revoke that user’s tokens using the same guard and
revocation path as the customer.subscription.* handling. Preserve the existing
invoice_subscription_unmapped response for skipped results and processed
response for active updates, and add a regression test covering an inactive
invoice update and token revocation.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 64c0d5c8-748a-4067-9cf2-403ff195963e

📥 Commits

Reviewing files that changed from the base of the PR and between ce79b78 and 5fa8277.

📒 Files selected for processing (14)
  • web/app/api/coderouter/session/route.ts
  • web/app/api/stripe/webhook/route.ts
  • web/app/env.ts
  • web/db/migrations/20260806020000_coderouter_hosted_entitlements/migration.sql
  • web/db/schema.ts
  • web/instrumentation-client.ts
  • web/instrumentation.ts
  • web/next.config.ts
  • web/services/coderouter/repository.ts
  • web/services/errors.ts
  • web/services/sentry.ts
  • web/tests/coderouter-sentry.test.ts
  • web/tests/coderouter-session-route.test.ts
  • web/tests/stripe-webhook-route.test.ts

Comment thread web/app/api/coderouter/session/route.ts Outdated
Comment on lines +40 to +45
{
error: "pro_required",
message: "Hosted coderouter requires cmux Pro.",
upgradeUrl: "https://cmux.com/pricing?from=coderouter",
selfHostUrl: "https://github.com/manaflow-ai/coderouter#self-hosting",
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Localize the entitlement response.

Move the user-facing message and recovery destinations to a locale-specific API source. Add matching entries for every supported locale.

As per coding guidelines, “User-facing text must use localized APIs and matching catalogs.” As per path instructions, apply full-internationalization.md.

🤖 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 `@web/app/api/coderouter/session/route.ts` around lines 40 - 45, Update the
entitlement response in the coderouter session route to obtain the user-facing
message, upgrade URL, and self-host URL through the existing locale-specific
localization API rather than hardcoded literals. Add corresponding catalog
entries for every supported locale, preserving the existing pro_required
response structure and keys.

Sources: Coding guidelines, Path instructions

Comment thread web/app/api/coderouter/session/route.ts
Comment thread web/app/env.ts Outdated
@lawrencecchen
lawrencecchen force-pushed the feat/coderouter-pro-billing-sentry branch from 5fa8277 to 814c225 Compare August 6, 2026 08:23
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 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
`@web/db/migrations/20260806020000_coderouter_hosted_entitlements/migration.sql`:
- Around line 6-7: Update the index creation statement for
"coderouter_route_tokens_user_expiry_idx" to use PostgreSQL’s concurrent
index-building form, and ensure this migration runs through the project’s
non-transactional migration path so token writes remain available during
deployment.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fd87cc76-7711-43b9-835f-013a887fbc63

📥 Commits

Reviewing files that changed from the base of the PR and between ce79b78 and 814c225.

📒 Files selected for processing (14)
  • web/app/api/coderouter/session/route.ts
  • web/app/api/stripe/webhook/route.ts
  • web/app/env.ts
  • web/db/migrations/20260806020000_coderouter_hosted_entitlements/migration.sql
  • web/db/schema.ts
  • web/instrumentation-client.ts
  • web/instrumentation.ts
  • web/next.config.ts
  • web/services/coderouter/repository.ts
  • web/services/errors.ts
  • web/services/sentry.ts
  • web/tests/coderouter-sentry.test.ts
  • web/tests/coderouter-session-route.test.ts
  • web/tests/stripe-webhook-route.test.ts

Comment on lines +6 to +7
CREATE INDEX IF NOT EXISTS "coderouter_route_tokens_user_expiry_idx"
ON "coderouter_route_tokens" ("stack_user_id", "expires_at");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Create this index without blocking token writes.

Line 6 uses normal CREATE INDEX. PostgreSQL blocks writes to coderouter_route_tokens while it builds the index. This can block token authentication, issuance, and revocation during deployment.

Use CREATE INDEX CONCURRENTLY in a non-transactional migration path.

Proposed change
-CREATE INDEX IF NOT EXISTS "coderouter_route_tokens_user_expiry_idx"
+CREATE INDEX CONCURRENTLY IF NOT EXISTS "coderouter_route_tokens_user_expiry_idx"
🧰 Tools
🪛 SQLFluff (4.2.2)

[error] 6-7: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)

🪛 Squawk (2.61.0)

[warning] 6-7: During normal index creation, table updates are blocked, but reads are still allowed. Use concurrently to avoid blocking writes.

(require-concurrent-index-creation)

🤖 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
`@web/db/migrations/20260806020000_coderouter_hosted_entitlements/migration.sql`
around lines 6 - 7, Update the index creation statement for
"coderouter_route_tokens_user_expiry_idx" to use PostgreSQL’s concurrent
index-building form, and ensure this migration runs through the project’s
non-transactional migration path so token writes remain available during
deployment.

Source: Linters/SAST tools

@lawrencecchen
lawrencecchen force-pushed the feat/coderouter-pro-billing-sentry branch from 814c225 to 22890e7 Compare August 6, 2026 08:30
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@lawrencecchen
lawrencecchen force-pushed the feat/coderouter-pro-billing-sentry branch from 22890e7 to aaf9758 Compare August 6, 2026 08:33
@cursor

cursor Bot commented Aug 6, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 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 `@web/app/api/stripe/webhook/route.ts`:
- Around line 165-172: The inactive-user token revocation currently only runs in
the direct subscription-event path. Move the `result.scope === "user" &&
!result.isActive` check and
`dependencies.revokeCoderouterRouteTokens(result.stackUserId)` call into the
shared subscription-processing logic used by `applySubscriptionUpdate`, ensuring
both `invoice.paid` and `invoice.payment_failed` paths execute it while
preserving skipped-result handling.

In
`@web/db/migrations/20260806021000_coderouter_route_token_principals/migration.sql`:
- Around line 6-7: Update the migration around the coderouter_route_tokens
stack_user_id alteration to first add a valid CHECK constraint enforcing
stack_user_id IS NOT NULL, then apply ALTER COLUMN stack_user_id SET NOT NULL so
PostgreSQL can reuse the validated constraint and avoid an exclusive table scan.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ed3c8855-1100-4961-b1d9-4a729c516e95

📥 Commits

Reviewing files that changed from the base of the PR and between ce79b78 and 22890e7.

📒 Files selected for processing (15)
  • web/app/api/coderouter/session/route.ts
  • web/app/api/stripe/webhook/route.ts
  • web/app/env.ts
  • web/db/migrations/20260806020000_coderouter_hosted_entitlements/migration.sql
  • web/db/migrations/20260806021000_coderouter_route_token_principals/migration.sql
  • web/db/schema.ts
  • web/instrumentation-client.ts
  • web/instrumentation.ts
  • web/next.config.ts
  • web/services/coderouter/repository.ts
  • web/services/errors.ts
  • web/services/sentry.ts
  • web/tests/coderouter-sentry.test.ts
  • web/tests/coderouter-session-route.test.ts
  • web/tests/stripe-webhook-route.test.ts

Comment thread web/app/api/stripe/webhook/route.ts Outdated
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@lawrencecchen
lawrencecchen force-pushed the feat/coderouter-pro-billing-sentry branch from aaf9758 to 3832b7a Compare August 6, 2026 08:39

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 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 `@web/services/sentry.ts`:
- Around line 26-30: Update scrubSentryEvent in web/services/sentry.ts:26-30 to
also remove event.user.id before delivery. Update the expectation at
web/tests/coderouter-sentry.test.ts:53 so scrubbing results in no user data,
including the persistent identifier.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 513ebb84-c1cf-4fb8-a186-2875c75953e5

📥 Commits

Reviewing files that changed from the base of the PR and between ce79b78 and aaf9758.

📒 Files selected for processing (14)
  • web/app/api/coderouter/session/route.ts
  • web/app/api/stripe/webhook/route.ts
  • web/app/env.ts
  • web/db/migrations/20260806020000_coderouter_hosted_entitlements/migration.sql
  • web/db/migrations/20260806021000_coderouter_route_token_principals/migration.sql
  • web/db/schema.ts
  • web/instrumentation.ts
  • web/next.config.ts
  • web/services/coderouter/repository.ts
  • web/services/errors.ts
  • web/services/sentry.ts
  • web/tests/coderouter-sentry.test.ts
  • web/tests/coderouter-session-route.test.ts
  • web/tests/stripe-webhook-route.test.ts

Comment thread web/services/sentry.ts Outdated
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 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 `@web/app/coderouter/page.tsx`:
- Around line 19-24: Move the hard-coded user-facing text in the coderouter page
into next-intl locale catalogs, adding message keys for every supported locale
that cover the labels, availability text, and link labels around the referenced
sections. Update the page’s rendering logic to read those keys through the
existing localization API, including the “included with cmux Pro” link text,
while preserving the current links and layout.

In `@web/services/sentry.ts`:
- Around line 20-23: Update the request-header sanitization in the Sentry
beforeSend flow around event.request.headers to remove all headers or retain
only an explicit allowlist of safe diagnostic headers, ensuring opaque x-api-key
credentials cannot reach Sentry. Add a regression test covering an opaque
x-api-key value and verify it is absent from the event sent through beforeSend.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 595a54db-4dcb-4e2d-a343-e4a49e16b235

📥 Commits

Reviewing files that changed from the base of the PR and between ce79b78 and 3832b7a.

📒 Files selected for processing (15)
  • web/app/api/coderouter/session/route.ts
  • web/app/api/stripe/webhook/route.ts
  • web/app/coderouter/page.tsx
  • web/app/env.ts
  • web/db/migrations/20260806020000_coderouter_hosted_entitlements/migration.sql
  • web/db/migrations/20260806021000_coderouter_route_token_principals/migration.sql
  • web/db/schema.ts
  • web/instrumentation.ts
  • web/next.config.ts
  • web/services/coderouter/repository.ts
  • web/services/errors.ts
  • web/services/sentry.ts
  • web/tests/coderouter-sentry.test.ts
  • web/tests/coderouter-session-route.test.ts
  • web/tests/stripe-webhook-route.test.ts

Comment thread web/app/coderouter/page.tsx Outdated
Comment on lines +19 to +24
<a
href="https://cmux.com/pricing?from=coderouter"
className="rounded-full border border-black/10 bg-white px-3 py-1 font-mono text-[11px] text-black/50 transition-colors hover:text-black"
>
included with cmux Pro
</a>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files matching coderouter/page.tsx:"
git ls-files | rg '(^|/)coderouter/page\.tsx$|(^|/)messages/|web/i18n/routing\.ts|next-intl' || true

echo
echo "Target file:"
if git ls-files | grep -q 'web/app/coderouter/page.tsx'; then
  wc -l web/app/coderouter/page.tsx
  cat -n web/app/coderouter/page.tsx
fi

echo
echo "Routing locales:"
if [ -f web/i18n/routing.ts ]; then
  cat -n web/i18n/routing.ts
fi

echo
echo "Message dirs and sample files:"
git ls-files 'web/messages/*' | head -100

Repository: manaflow-ai/cmux

Length of output: 6763


Move the landing-page copy into the locale catalogs.

The labels around lines 19-24, 45-49, and 67-79 are hard-coded, so the page does not read user-facing text from a locale-specific runtime source. Add next-intl message keys covering each supported locale, and use those keys for the labels, availability text, and link labels.

🤖 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 `@web/app/coderouter/page.tsx` around lines 19 - 24, Move the hard-coded
user-facing text in the coderouter page into next-intl locale catalogs, adding
message keys for every supported locale that cover the labels, availability
text, and link labels around the referenced sections. Update the page’s
rendering logic to read those keys through the existing localization API,
including the “included with cmux Pro” link text, while preserving the current
links and layout.

Sources: Coding guidelines, Path instructions

Comment thread web/services/sentry.ts Outdated
@lawrencecchen
lawrencecchen force-pushed the feat/coderouter-pro-billing-sentry branch from 3832b7a to 56125e1 Compare August 6, 2026 08:51
@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Addressed the review findings: removed fixed Retry-After and API prose, made production entitlement configuration mandatory, centralized inactive subscription revocation so invoice paths are covered, removed all Sentry request headers and user identity, added opaque API-key and invoice regression tests, and used a validated CHECK before SET NOT NULL. The hard-coded landing additions were reverted rather than adding untranslated copy.

The non-concurrent index recommendation is intentionally not applied: this project’s Drizzle migrator runs migrations transactionally, where CREATE INDEX CONCURRENTLY is invalid. The expand migration was applied before deployment while this private-beta table contained one token, then the principal-aware app was deployed before the contract migration; there was no meaningful write-availability risk.

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