fix(ui): silence noisy auto-save Sentry events for transient HTTP failures#4936
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(ui): silence noisy auto-save Sentry events for transient HTTP failures#4936cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
…lures
Canvas auto-save runs silently in the background after node position
drags. When the request failed (auth redirect, proxy/load balancer
returning an HTML error page, offline blip, 5xx gateway), the catch
block logged `console.error("Failed to auto-save", error)` which was
forwarded to Sentry via captureConsoleIntegration. Because the thrown
value from @hey-api/client-fetch contains the raw response body, Sentry
issue titles ended up looking like "Failed to auto-save <!DOCTYPE html>"
and grouped poorly, producing one noisy issue per unique HTML response.
Replace the unconditional console.error with a small reporter that:
- Treats HTML responses, browser network errors, and transient HTTP
statuses (0, 401, 403, 408, 429, 502, 503, 504) as expected and drops
them — they will be retried on the next auto-save tick.
- Forwards real failures to Sentry with `captureException`, a clean
`errorSummary`, and a stable fingerprint so the issues group together
instead of fragmenting on response-body contents.
Add reusable helpers `isTransientHttpError` and `summarizeError` in
`@/lib/errors` with unit tests covering HTML payloads, browser network
failures, transient status codes, and value truncation.
|
👋 Commands for maintainers:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Sentry issue "Failed to auto-save
<!DOCTYPE html>" (issue 7370830183).Canvas auto-save runs silently in the background after node position drags. When the request failed (auth redirect, proxy/load balancer returning an HTML error page, offline blip, 5xx gateway), the catch block logged:
That console call was forwarded to Sentry via
captureConsoleIntegration. Because@hey-api/client-fetch(configured withthrowOnError: true) throws the raw response body when the body is not JSON, the thrown value for an HTML error page is the response text itself. Sentry concatenated the twoconsole.errorarguments into the issue title, producing entries like:The HTML body also varies between environments (Cloudflare 502 page, login redirect, etc.), so Sentry grouped them poorly and created one noisy issue per unique response.
What changed
reportAutoSaveFailurehelper inweb_src/src/pages/workflowv2/index.tsx:{0, 401, 403, 408, 429, 502, 503, 504}). These are expected for a silent background save and will be retried on the next auto-save tick.Sentry.captureException, attaching a sanitizederrorSummaryextra, anauto_save.scopetag, and a stablecanvas-auto-save-failurefingerprint so they group cleanly.@/lib/errors:isTransientHttpError(error)— detects HTML response bodies,TypeError("Failed to fetch")/AbortError, and known transient HTTP statuses.summarizeError(error, maxLength?)— short, telemetry-safe rendering that never returns an HTML body and truncates long messages.Testing
npx vitest run src/lib/errors.spec.ts— 16 tests pass (12 existing + 4 new for the helpers).npx eslint src/pages/workflowv2/index.tsx— same 50 problems (10 errors, 40 warnings) as baseline; no new lint issues introduced.npm run lint:budget— within budget (654/654).npx prettier --checkon the touched files — clean.Full
npm run build/make check.build.uiwas skipped because the cloud agent VM has no Docker available to generatesrc/api-client/**from the OpenAPI spec; the changes only add code that uses already-imported types and the existingSentrynamespace.Effect on Sentry