Skip to content

fix(webapp): downgrade expected user-input error logs to warn#3523

Merged
d-cs merged 11 commits intomainfrom
sentry-wrapper-bypass
May 5, 2026
Merged

fix(webapp): downgrade expected user-input error logs to warn#3523
d-cs merged 11 commits intomainfrom
sentry-wrapper-bypass

Conversation

@d-cs
Copy link
Copy Markdown
Collaborator

@d-cs d-cs commented May 5, 2026

dac9c83bd added ignoreErrors: /^ServiceValidationError(?::|$)/ in
apps/webapp/sentry.server.ts to drop SVEs before they reach Sentry. The
filter only matches when the captured event's type is
ServiceValidationError, but nine call sites in the webapp catch SVE (and
analogous user-input error types — OutOfEntitlementError,
CreateDeclarativeScheduleError, QueryError) and call
logger.error("wrapper message", { error: e }) before the type check.
The captured event is then titled with the wrapper message, with the inner
error buried in extra.error — invisible to the SDK filter. Result: a
steady stream of expected user-input failures escalating as error-level
events when they should be warn.

Each catch block now type-discriminates first, logs expected types at warn,
and keeps unknown-error fall-throughs at error. For service sites that
wrap into SVE (createBackgroundWorker, createDeploymentBackgroundWorkerV4),
the inner error is logged at error before wrapping — mirrors the
waitpointCompletionPacket.server.ts pattern from dac9c83bd.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 5, 2026

⚠️ No Changeset found

Latest commit: f4c563f

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
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d1803e6d-a00f-4008-85e9-1a85d61a9433

📥 Commits

Reviewing files that changed from the base of the PR and between 817ef6b and 3c06288.

📒 Files selected for processing (6)
  • .server-changes/sentry-wrapper-bypass-fix.md
  • apps/webapp/app/routes/api.v1.query.ts
  • apps/webapp/app/routes/api.v3.batches.$batchId.items.ts
  • apps/webapp/app/routes/api.v3.batches.ts
  • apps/webapp/app/v3/services/createBackgroundWorker.server.ts
  • apps/webapp/app/v3/services/createDeploymentBackgroundWorkerV4.server.ts
✅ Files skipped from review due to trivial changes (1)
  • apps/webapp/app/v3/services/createDeploymentBackgroundWorkerV4.server.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/webapp/app/routes/api.v3.batches.ts
  • apps/webapp/app/v3/services/createBackgroundWorker.server.ts
  • apps/webapp/app/routes/api.v3.batches.$batchId.items.ts
📜 Recent review details
⏰ 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). (17)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx}

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

**/*.{ts,tsx}: Use types over interfaces for TypeScript
Avoid using enums; prefer string unions or const objects instead

Files:

  • apps/webapp/app/routes/api.v1.query.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}

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

Use zod for validation in packages/core and apps/webapp

Files:

  • apps/webapp/app/routes/api.v1.query.ts
**/*.{ts,tsx,js,jsx}

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

Use function declarations instead of default exports

Files:

  • apps/webapp/app/routes/api.v1.query.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)

**/*.ts: When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs
Do not use high-cardinality attributes in OTEL metrics such as UUIDs/IDs (envId, userId, runId, projectId, organizationId), unbounded integers (itemCount, batchSize, retryCount), timestamps (createdAt, startTime), or free-form strings (errorMessage, taskName, queueName)
When exporting OTEL metrics via OTLP to Prometheus, be aware that the exporter automatically adds unit suffixes to metric names (e.g., 'my_duration_ms' becomes 'my_duration_ms_milliseconds', 'my_counter' becomes 'my_counter_total'). Account for these transformations when writing Grafana dashboards or Prometheus queries

Files:

  • apps/webapp/app/routes/api.v1.query.ts
apps/webapp/**/*.{ts,tsx}

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

apps/webapp/**/*.{ts,tsx}: Access environment variables through the env export of env.server.ts instead of directly accessing process.env
Use subpath exports from @trigger.dev/core package instead of importing from the root @trigger.dev/core path

Use named constants for sentinel/placeholder values (e.g. const UNSET_VALUE = '__unset__') instead of raw string literals scattered across comparisons

Files:

  • apps/webapp/app/routes/api.v1.query.ts
{apps,internal-packages}/**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (CLAUDE.md)

Use pnpm run typecheck to verify changes in apps and internal packages (apps/*, internal-packages/*) instead of build, which proves almost nothing about correctness

Files:

  • apps/webapp/app/routes/api.v1.query.ts
{package.json,**/*.{ts,tsx,js}}

📄 CodeRabbit inference engine (CLAUDE.md)

Pin Zod to version 3.25.76 exactly across the entire monorepo - never use a different version or version range

Files:

  • apps/webapp/app/routes/api.v1.query.ts
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js}: Import from @trigger.dev/core using subpaths only, never the root export
Always import tasks from @trigger.dev/sdk, never from @trigger.dev/sdk/v3 or deprecated client.defineJob
Add crumbs to code using // @Crumbs comments or `// `#region` `@crumbs blocks for debug tracing during development

Files:

  • apps/webapp/app/routes/api.v1.query.ts
**/*.{ts,tsx,js,jsx,json,md,css,scss}

📄 CodeRabbit inference engine (AGENTS.md)

Code formatting is enforced using Prettier. Run pnpm run format before committing

Files:

  • apps/webapp/app/routes/api.v1.query.ts
🧠 Learnings (2)
📚 Learning: 2026-03-22T13:26:12.060Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3244
File: apps/webapp/app/components/code/TextEditor.tsx:81-86
Timestamp: 2026-03-22T13:26:12.060Z
Learning: In the triggerdotdev/trigger.dev codebase, do not flag `navigator.clipboard.writeText(...)` calls for `missing-await`/`unhandled-promise` issues. These clipboard writes are intentionally invoked without `await` and without `catch` handlers across the project; keep that behavior consistent when reviewing TypeScript/TSX files (e.g., usages like in `apps/webapp/app/components/code/TextEditor.tsx`).

Applied to files:

  • apps/webapp/app/routes/api.v1.query.ts
📚 Learning: 2026-03-22T19:24:14.403Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3187
File: apps/webapp/app/v3/services/alerts/deliverErrorGroupAlert.server.ts:200-204
Timestamp: 2026-03-22T19:24:14.403Z
Learning: In the triggerdotdev/trigger.dev codebase, webhook URLs are not expected to contain embedded credentials/secrets (e.g., fields like `ProjectAlertWebhookProperties` should only hold credential-free webhook endpoints). During code review, if you see logging or inclusion of raw webhook URLs in error messages, do not automatically treat it as a credential-leak/secrets-in-logs issue by default—first verify the URL does not contain embedded credentials (for example, no username/password in the URL, no obvious secret/token query params or fragments). If the URL is credential-free per this project’s conventions, allow the logging.

Applied to files:

  • apps/webapp/app/routes/api.v1.query.ts
🪛 LanguageTool
.server-changes/sentry-wrapper-bypass-fix.md

[grammar] ~6-~6: Ensure spelling is correct
Context: ...: fix --- Stop nine catch sites in the webapp from escalating expected user-input fai...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (3)
.server-changes/sentry-wrapper-bypass-fix.md (1)

6-10: Changelog entry is clear and aligned with the implementation.

The note accurately captures the wrapper-bypass fix and expected warn/error behavior split.

apps/webapp/app/routes/api.v1.query.ts (2)

64-73: Good split for expected QueryError path.

Type-checking before logging and downgrading this branch to warn with HTTP 400 matches the PR objective and avoids Sentry escalation noise.


81-82: 500 fallback remains appropriately generic.

Keeping the unknown-error branch as a fixed message with HTTP 500 is the right separation from user-input failures.


Walkthrough

The PR updates error handling in nine webapp route handlers and two backend services. Catch blocks were refactored to distinguish expected, user-facing errors (ServiceValidationError, OutOfEntitlementError, CreateDeclarativeScheduleError, QueryError) — which are now logged at warn level and return 4xx responses — from unexpected failures, which remain logged at error level and return 500 responses. A changelog entry (.server-changes/sentry-wrapper-bypass-fix.md) documents that these sites no longer escalate expected input errors to error-level Sentry events.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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 accurately describes the main change: downgrading expected user-input error logs to warn level to fix Sentry wrapper-bypass issues.
Description check ✅ Passed The description is thorough and covers the problem, solution, and affected areas; however, the Testing and Screenshots sections of the template are incomplete or missing.
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 sentry-wrapper-bypass

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@d-cs d-cs self-assigned this May 5, 2026
d-cs and others added 4 commits May 5, 2026 10:16
…rs to warn

ServiceValidationError and CreateDeclarativeScheduleError are user-facing
validation failures returned as 4xx; they shouldn't surface in Sentry. Move
type discrimination before the log call and split the SVE/CDSE branches at
warn level. Real 5xx errors continue to log at error.

Refs the ignoreErrors filter added in dac9c83; closes the wrapper-bypass
gap on TRIGGER-CLOUD-2S.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…rkers to warn

Same wrapper-bypass pattern as the projects-scoped sibling; both feed
TRIGGER-CLOUD-2S. Type-discriminate before the log; warn for SVE and
CreateDeclarativeScheduleError, error for unknown.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closes the wrapper-bypass gap on TRIGGER-CLOUD-38 (Batch trigger error,
755 events in 48h). Customer-facing 422 paths now log at warn; only the
500 fall-through escalates to Sentry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Same wrapper-bypass shape as the v1 sibling. Customer-facing 422 paths
now log at warn; only the 500 fall-through escalates to Sentry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@d-cs d-cs force-pushed the sentry-wrapper-bypass branch from 31286c1 to 3c7dceb Compare May 5, 2026 09:16
coderabbitai[bot]

This comment was marked as resolved.

@d-cs d-cs force-pushed the sentry-wrapper-bypass branch from 993fa70 to 817ef6b Compare May 5, 2026 09:25
d-cs and others added 6 commits May 5, 2026 10:36
Customer-facing 422 paths now log at warn; only the 500 fall-through
escalates to Sentry. Rate-limit (BatchProcessingError 429) branch above
is unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…s to warn

Closes the wrapper-bypass gap on TRIGGER-CLOUD-103 (Stream batch items
error, 1052 events in 48h). Customer-facing 4xx paths (invalid item
shape, invalid JSON in stream body) now log at warn; only the 500
fall-through escalates to Sentry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
QueryError surfaces customer SQL problems and is returned as 400; not a
system bug. Type-discriminate before the log call; warn for QueryError,
error for unknown failures.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ker to warn

Customer schedule-config failures (typically invalid cron) get rethrown
to the route handler as ServiceValidationError; that's a 4xx, not a
system bug. Split the SVE branch out and log at warn before rethrowing.
Non-SVE failures still log at error before being wrapped, mirroring
dac9c83's waitpointCompletionPacket.server.ts pattern so visibility
survives the SDK-level SVE filter.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…kgroundWorkerV4 to warn

Mirrors the createBackgroundWorker fix; same wrap-into-SVE shape, same
split: warn + rethrow for SVE, error + wrap-and-throw for unknown.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@d-cs d-cs force-pushed the sentry-wrapper-bypass branch from 817ef6b to 3c06288 Compare May 5, 2026 09:36
@d-cs d-cs marked this pull request as ready for review May 5, 2026 10:09
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@d-cs d-cs merged commit 14920ce into main May 5, 2026
43 checks passed
@d-cs d-cs deleted the sentry-wrapper-bypass branch May 5, 2026 10:31
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.

2 participants