Skip to content

fix(sentry): drop injected og:type meta probe noise (KODY-CLOUDFLARE-46) - #1316

Merged
kody-bot merged 1 commit into
mainfrom
cursor/sentry-triage-kody-cloudflare-kody-cloudflare-46-1e01
Aug 8, 2026
Merged

kody-bot merged 1 commit into
mainfrom
cursor/sentry-triage-kody-cloudflare-kody-cloudflare-46-1e01

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Aug 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

Filters a one-off Mobile Safari client noise event from KODY-CLOUDFLARE-46: injected global code unguardedly reading document.querySelector("meta[property='og:type']").content on /guides/what-is-kody.

Root cause

  • Stack is a single global code frame on the document URL (not a Kody bundle).
  • App code only writes og:type in document-head / SSR; it never reads it via querySelector.
  • Guides (and many auth routes) intentionally omit managed OG tags, so the probe throws when the meta is absent.
  • Same class of browser/content-script noise as prior filters (Twitter in-app CONFIG, wallet/__firefox__ globals, etc.).

Fix

Narrow client beforeSend filter in sentry-browser-filters.ts:

  1. Safari wording: null is not an object (evaluating 'document.querySelector(…og:type…).content')
  2. Stack function must be global code

Unit coverage in sentry-browser-filters.node.test.ts.

Status

  • Squash-merged as e93230b8; production redeployed via #1317 after a flaky post-merge E2E ECONNREFUSED on main blocked the first deploy.
  • Sentry issue marked ignored (filtered outcome).
  • Prod health: 01b3c1ad.

Risk

Low / composes — observability filter only; no product behavior change.

System recap — composes existing primitives (low risk)

Mode: recap · Base: main @ 12efe549 · Head: e5b8fda9

Classification: composes — extends the existing browser Sentry noise filter chain only; no primitive contracts change.

Primitives touched

Primitive Group Impact
app-ui surfaces composes — new narrow beforeSend drop for injected og:type probes

System map

Browser Sentry still boots from the client entry; this PR only adds one more drop predicate before envelopes leave the page.

Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).

flowchart LR
	appUi["app-ui<br/>Browser app (Remix 3)"]:::touched
	appUi -->|"beforeSend: drop og:type global-code TypeError"| appUi
	classDef touched fill:#1a7f37,color:#fff
	classDef extended fill:#9a6700,color:#fff
	classDef added fill:#cf222e,color:#fff
	classDef untouched fill:#57606a,color:#fff
Loading

Change flow

sequenceDiagram
	participant Injected as Injected global code
	participant Box as Browser Sentry beforeSend
	participant Sentry as Sentry ingest
	Injected->>Box: TypeError og:type querySelector.content
	Box-->>Box: match wording + global code frame
	Box--xSentry: drop event
Loading
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Bug Fixes

    • Reduced noisy error reporting from Safari-specific og:type metadata probes.
    • Preserved reporting for similar errors originating from application code.
    • Improved browser error filtering to consistently ignore matching probe-related events.
  • Documentation

    • Updated error-filtering documentation with details about injected og:type probes and related cases.

Filter Mobile Safari / content-script TypeErrors that unguardedly read
document.querySelector("meta[property='og:type']").content from global
code on the document URL (KODY-CLOUDFLARE-46). Kody never reads og:type
this way; match requires the Safari evaluating wording and a global code
frame.
@kentcdodds
kentcdodds marked this pull request as ready for review August 8, 2026 14:11
@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The browser Sentry filters now detect Safari og:type metadata probe errors with a global code stack frame and drop them. Tests cover matching events, app-bundle errors, and aggregate filtering. Sentry initialization comments document the new noise pattern and related issue references.

Changes

OG-type Sentry filtering

Layer / File(s) Summary
Implement and wire the OG-type filter
packages/worker/client/sentry-browser-filters.ts
The filter recognizes Safari og:type query-selector .content errors and drops events only when their stack includes global code. The aggregate browser filter applies the new predicate.
Validate and document filtering behavior
packages/worker/client/sentry-browser-filters.node.test.ts, packages/worker/client/sentry-init.ts
Tests cover matching Safari errors, nonmatching app-bundle errors, and aggregate filtering. Sentry comments document the injected og:type probes and related issue references.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • kentcdodds/kody#1006: Adds and tests another browser Sentry noise filter in the same filtering pipeline.
  • kentcdodds/kody#1164: Modifies the same browser filtering module for a different injected-browser noise pattern.
  • kentcdodds/kody#1304: Adds a narrowly scoped Sentry noise filter with stack-condition matching.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly identifies the Sentry fix and the injected og:type probe noise it removes.
Description check ✅ Passed The description explains the intent, root cause, fix, risk, affected systems, and unit coverage, but does not state executed test commands.
✨ 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 cursor/sentry-triage-kody-cloudflare-kody-cloudflare-46-1e01

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.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-1316.kody-a99.workers.dev

Worker: kody-pr-1316
D1: kody-pr-1316-db
KV: kody-pr-1316-oauth-kv

Mocks:

@kody-bot
kody-bot merged commit e93230b into main Aug 8, 2026
18 checks passed
@kody-bot
kody-bot deleted the cursor/sentry-triage-kody-cloudflare-kody-cloudflare-46-1e01 branch August 8, 2026 14:17
kody-bot pushed a commit that referenced this pull request Aug 8, 2026
* fix(sentry): drop injected og:type meta probe noise

Filter Mobile Safari / content-script TypeErrors that unguardedly read
document.querySelector("meta[property='og:type']").content from global
code on the document URL (KODY-CLOUDFLARE-46). Kody never reads og:type
this way; match requires the Safari evaluating wording and a global code
frame.

* chore: re-trigger main validate after flaky E2E

Post-merge Validate on #1316 failed with Playwright ECONNREFUSED to the
local webserver (infra flake; PR CI and pre-push E2E were green). Empty
commit to re-run push Validate so production deploy can proceed.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
kody-bot pushed a commit that referenced this pull request Aug 8, 2026
* fix(sentry): drop injected og:type meta probe noise

Filter Mobile Safari / content-script TypeErrors that unguardedly read
document.querySelector("meta[property='og:type']").content from global
code on the document URL (KODY-CLOUDFLARE-46). Kody never reads og:type
this way; match requires the Safari evaluating wording and a global code
frame.

* chore: re-trigger main validate after flaky E2E

Post-merge Validate on #1316 failed with Playwright ECONNREFUSED to the
local webserver (infra flake; PR CI and pre-push E2E were green). Empty
commit to re-run push Validate so production deploy can proceed.

* test(e2e): fail fast when wrangler dies and upload its logs

When the Playwright webServer exits mid-suite, remaining tests were burning
CI retries on ECONNREFUSED. Probe /health before each test, abort auth retries
immediately on connection refused, and upload logs.local/ from the E2E job on
failure so the next empty [WebServer] ERROR is diagnosable.

* test(e2e): cap auth request timeouts to remaining retry budget

Address CodeRabbit feedback: each /auth attempt now uses the leftover
retry budget as its Playwright request timeout so the default 30s API
timeout cannot overrun the 15s login retry window.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
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