Skip to content

Conversation

@nicktrn
Copy link
Collaborator

@nicktrn nicktrn commented Oct 14, 2025

Also improves logs to distinguish between billing request failure modes

@changeset-bot
Copy link

changeset-bot bot commented Oct 14, 2025

⚠️ No Changeset found

Latest commit: d92731f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 14, 2025

Walkthrough

  • apps/webapp/app/services/platform.v3.server.ts: Updated error log messages across multiple service functions to distinguish "no success" responses from caught exceptions (e.g., "Error getting current plan - no success" and "Error getting current plan - caught error"). Control flow and return values unchanged.
  • apps/webapp/app/v3/runEngine.server.ts: Added logger imports and runtime guards when reading billing/plan data. Changed fallback behavior: if no plan is returned, log a warning and return isPaying: true and type: "paid"; if v3Subscription is missing, log a warning and return isPaying: false and type: "free"; if v3Subscription.plan is missing, log a warning, preserve the incoming isPaying value and set type based on it. Normal path now reads v3Subscription.isPaying and v3Subscription.plan.type without prior optional defaulting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The description only notes improved logging and omits all required sections from the repository’s template, including the issue reference, checklist, testing steps, changelog entry, and screenshots, making it largely incomplete. Please update the pull request description to follow the template by adding the “Closes #” reference, completing the checklist, detailing the steps you took to test the change, including a concise changelog entry, and attaching any relevant screenshots.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly captures the primary change of defaulting to a paid placement on billing errors within the engine component and follows the conventional commit style, making it clear and specific enough for a teammate to understand the main intent of the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/placement-tag-defaults

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57a3438 and d92731f.

📒 Files selected for processing (1)
  • apps/webapp/app/v3/runEngine.server.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always prefer using isomorphic code like fetch, ReadableStream, etc. instead of Node.js specific code
For TypeScript, we usually use types over interfaces
Avoid enums
No default exports, use function declarations

Files:

  • apps/webapp/app/v3/runEngine.server.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

We use zod a lot in packages/core and in the webapp

Files:

  • apps/webapp/app/v3/runEngine.server.ts
apps/webapp/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

When importing from @trigger.dev/core in the webapp, never import the root package path; always use one of the documented subpath exports from @trigger.dev/core’s package.json

Files:

  • apps/webapp/app/v3/runEngine.server.ts
{apps/webapp/app/**/*.server.{ts,tsx},apps/webapp/app/routes/**/*.ts}

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

Access environment variables only via the env export from app/env.server.ts; do not reference process.env directly

Files:

  • apps/webapp/app/v3/runEngine.server.ts
apps/webapp/app/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

Modules intended for test consumption under apps/webapp/app/**/*.ts must not read environment variables; accept configuration via options instead

Files:

  • apps/webapp/app/v3/runEngine.server.ts
🧬 Code graph analysis (1)
apps/webapp/app/v3/runEngine.server.ts (1)
apps/webapp/app/v3/tracer.server.ts (1)
  • logger (106-111)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (5)
apps/webapp/app/v3/runEngine.server.ts (5)

8-8: LGTM!

The logger import is necessary for the new runtime guards and warning logs below.


133-139: LGTM!

The guard for missing v3Subscription is appropriate. Defaulting to free tier is conservative and the warning log surfaces this data consistency issue.


142-149: Addresses previous review concern.

The implementation now ensures isPaying and type are consistent by deriving type from the isPaying flag. This resolves the potential contradiction flagged in the previous review (Option 1: align type with isPaying).


151-155: Confirm union typing of plan.v3Subscription.plan.type
Ensure in @trigger.dev/platform’s BillingClient.currentPlan response the v3Subscription.plan.type property is strictly "free" | "paid" and not a general string. If it isn’t, add a type guard or validation to enforce the expected union.


124-130: Approve default-to-paid fallback; verify billing failure alerts
I found Prometheus ServiceMonitor CRDs but no alerting rules for billing warnings—ensure alerts exist for engine.getCurrentPlan: no plan.


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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f646168 and 57a3438.

📒 Files selected for processing (2)
  • apps/webapp/app/services/platform.v3.server.ts (8 hunks)
  • apps/webapp/app/v3/runEngine.server.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always prefer using isomorphic code like fetch, ReadableStream, etc. instead of Node.js specific code
For TypeScript, we usually use types over interfaces
Avoid enums
No default exports, use function declarations

Files:

  • apps/webapp/app/v3/runEngine.server.ts
  • apps/webapp/app/services/platform.v3.server.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

We use zod a lot in packages/core and in the webapp

Files:

  • apps/webapp/app/v3/runEngine.server.ts
  • apps/webapp/app/services/platform.v3.server.ts
apps/webapp/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

When importing from @trigger.dev/core in the webapp, never import the root package path; always use one of the documented subpath exports from @trigger.dev/core’s package.json

Files:

  • apps/webapp/app/v3/runEngine.server.ts
  • apps/webapp/app/services/platform.v3.server.ts
{apps/webapp/app/**/*.server.{ts,tsx},apps/webapp/app/routes/**/*.ts}

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

Access environment variables only via the env export from app/env.server.ts; do not reference process.env directly

Files:

  • apps/webapp/app/v3/runEngine.server.ts
  • apps/webapp/app/services/platform.v3.server.ts
apps/webapp/app/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

Modules intended for test consumption under apps/webapp/app/**/*.ts must not read environment variables; accept configuration via options instead

Files:

  • apps/webapp/app/v3/runEngine.server.ts
  • apps/webapp/app/services/platform.v3.server.ts
🧬 Code graph analysis (1)
apps/webapp/app/v3/runEngine.server.ts (2)
packages/trigger-sdk/src/v3/index.ts (1)
  • logger (40-40)
apps/webapp/app/v3/tracer.server.ts (1)
  • logger (106-111)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (5)
apps/webapp/app/v3/runEngine.server.ts (4)

8-8: LGTM!

The logger import is appropriately sourced from the service layer and enables the enhanced logging throughout this file.


124-131: Verify the business implications of defaulting to paid on billing errors.

This change intentionally defaults to paid placement when the billing service is unavailable or returns no plan data. While this prevents service degradation for paying customers during billing outages, it could also allow free-tier users to access paid resources if billing checks fail.

Confirm this trade-off aligns with your risk tolerance and business requirements. You may also want to consider:

  • Monitoring the frequency of "engine.getCurrentPlan: no plan" warnings to detect billing service issues early
  • Implementing circuit breakers or alerts when this fallback is triggered repeatedly

133-140: LGTM!

The guard and logging appropriately handle the edge case where subscription data is missing.


151-155: LGTM!

Removing the optional chaining is safe because the guard at lines 142-149 ensures plan.v3Subscription.plan exists before reaching this point. The added comment clarifies the expected code path.

apps/webapp/app/services/platform.v3.server.ts (1)

208-208: LGTM!

The enhanced error logging consistently distinguishes between "no success" responses (API returned an error response) and "caught error" scenarios (exception thrown during execution). This improves observability and debugging by making failure modes explicit.

Also applies to: 224-224, 235-235, 241-241, 282-282, 287-287, 365-365, 370-370, 399-399, 404-404, 423-423, 428-428, 451-451, 458-458

@nicktrn nicktrn merged commit 5781783 into main Oct 15, 2025
31 checks passed
@nicktrn nicktrn deleted the fix/placement-tag-defaults branch October 15, 2025 09:32
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