Repository navigation
fix(report): a captcha-blocked widget reports to nobody - #396
Conversation
`REPORTED_KINDS['captcha-blocked']` was `false`, so the failure that takes the whole widget down produced no event and no red console line — only a warning on the host's own page. Since the challenge gate went live and keyed to a host allowlist, that is the widget's most likely production failure and the one it could not observe. The reason stated beside the flag did not hold for this path: it claimed the report POST is Turnstile-gated, which is true of the visitor-facing report form and false of `captureError`, which posts to the Sentry DSN over `@sentry/browser`'s own fetch transport. The JSDoc now carries the true reason, and the row carries none. Noise is bounded by what is already there: `dedupeIntegration`, `MAX_EVENTS_PER_PAGE`, and a transport that latches off after one refusal. `ERROR_POLICY` is untouched, so the visitor still sees the same message and the same retry. The spec's table now types itself `Record<ErrorKind, boolean>`, so every kind is a row and a seventh kind is a type error rather than an untested one. Watched the new row fail against `false` before keeping it. Closes #387 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXhFSdJJTUYwFBrNyR
…ergence The spec's table iterates `mockErrorKinds`, the enumeration `report.test.ts` and `Fallbacks.test.tsx` already share, instead of a local cast — and lists its rows in `REPORTED_KINDS`' own order, so two hand-kept copies read alike. `Fallbacks.tsx` claimed `REPORTED_KINDS` mirrored the withheld report button. It no longer does, and a line that says otherwise is how the row gets flipped back. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXhFSdJJTUYwFBrNyR
An absence assertion that settles synchronously passes for a row whose event arrives one microtask later, so only the console counters were holding `offline` and `not-found`. Verified: dropping the kind gate from `captureError` alone now reddens both rows on the capture itself. The changelog entry also claimed too much. A host that left `*.sentry.io` out of `connect-src` now makes one refused request on such a page where it made none, which is what that CSP row's own degrade column describes. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXhFSdJJTUYwFBrNyR
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
sahajatlas-design | 02c212f | Nov 12 2026, 04:45 AM |
sydevs-bot
left a comment
There was a problem hiding this comment.
1 question for the reviewer, one per thread.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The diff is the size of its ticket: one row flipped, two false comments corrected, the spec table made exhaustive. Nothing is smuggled in — the Fallbacks.tsx and mocks/errors.ts edits are joined by the change that falsified them. The contract claim holds: docs/embedding.md:904 lists *.sentry.io under connect-src, and :931 says it is reached only after the widget has failed. The open question at report.ts:210 is the right one. One datum it omits: this file's reportIntegrationWarning doc argues per-pageview recurrence as grounds for staying console-only, which favours B or C over A. No blockers.
Findings
should-fix—CHANGELOG.md:151: of the two console lines here, the one naming the fix stays a warning.should-fix—Fallbacks.tsx:239: the rationale lives in two files again, the shape of the fixed defect.consider—report.sentry.test.ts:165:EXPECTEDis already exhaustive, so themockErrorKindsimport adds a second source for the rows.
What was checked
- Read on the branch:
report.tswhole, theERROR_POLICYcaptcha row,mocks/errors.ts, the spec,use-turnstile-guard.ts. - Ladder:
EXPECTEDearns its place, sinceREPORTED_KINDSis module-private; thesetTimeout(0)flush has no synchronous substitute —sdk.clientsfills only after the dynamic import resolves. The import does not. - Contract side:
docs/embedding.md's CSP table and captcha troubleshooting row,public/_headers(no CSP of its own),docs/rules/i18n-and-state.md:350(names onlyofflineandnot-foundas withheld — still true). The two out-of-tree consumers sit outside this session's scope, and no attribute or origin changed. - Grepped every
REPORTED_KINDSandcaptcha-blockedreference for a claim this flip falsifies. The two it corrects are the only two. No preview link to open.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Two console lines carry a captcha-blocked failure, and only the second one changed level. `use-turnstile-guard` warns first, through `reportIntegrationWarning`, with the advice that names both causes and the troubleshooting link. `reportInternalError` then logs the kind, and that is the line now at error level. "the console line is an error rather than a warning" read as if the single line had changed, so a host developer filtering their console to errors would expect the fix in it. It is not there. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYUvKVPgWUBAazYsAy
The defect behind #387 was one claim living in two files, and correcting the copy here rebuilds the thing that went stale. `report.ts`'s `REPORTED_KINDS` doc now states the contrast at the row it governs: the viewer's form is Turnstile-gated, the Sentry DSN's transport is not. `ERROR_POLICY` owns why this row offers no report action, which the block above already says. What the reporter does is not its business. Net against the base this deletes the line and carries no breadcrumb away: the version on main claimed the mirror with no reference at all. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYUvKVPgWUBAazYsAy
`EXPECTED` is `Record<ErrorKind, boolean>`, so typecheck already makes it exhaustive — which is what its own doc claims. Its keys are therefore the same rows, from one source, and match the idiom `mocks/errors.ts` uses a line below `mockErrors`. The import bought nothing: the fixtures went unused, since each row builds its own `atlasError(kind, …)`. It also widened the per-edit hook's spec selection for `src/mocks/errors.ts`, which now stays as it was. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYUvKVPgWUBAazYsAy
|
Three critic findings, all adopted.
The open question on the row still waits on you, now carrying one datum against option A: Lean gate green — lint, typecheck, 2002 tests in 166 files. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
Answered the open question with the recommendation and per-option implications you asked for: A, the built option, stands. Two facts decided it.
Measured for the performance line: the lazily imported Nothing pushed. The branch is already level with 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
One thread, answered and resolved.
Nothing pushed: the answer needed no code change, and the branch is already level with
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
captcha-blockedfailure now sends one Sentry event. It took the whole widget down and told nobody.Fallbacks.tsxrepeated it.Change outline
One row is the whole gate, and the console level reads the same row — so the flip moves two signals.
The claim the row carried was true of one channel and false of the other:
Preview
Contract impact
A host observes two things, both now in
CHANGELOG.md: one more POST to*.sentry.ioafter the widget has already failed, and an error-level console line beside the warning that already named the fix. No parameter, origin, CSP or Permissions-Policy change —connect-src https://*.sentry.ioalready covers it, and a host that left that origin out gets the behaviour its own row already promises (one refused request, then the widget stops for the page's life). Sodocs/embedding.mdneeded no edit — its troubleshooting row already sends a host developer to the console line that names both fixes — and the two in-tree consumers (WeMeditateWeb/lib/atlas-embed.ts, the WordPress templates) need nothing.Test results
.claude/skills/pr-prep/check.sh— lint, typecheck, 2002 tests in 166 files. Re-run after the review revision, unchanged.report.sentry.test.ts21 passed,report.test.ts+Fallbacks60 passedpnpm build+pnpm size— standalone 327.3/330, loader 2.5/3.2, embed 329.2/330 KiB. Measured before the review revision, which touches a changelog line, a comment and a spec, so it emits the same bundle.Manual verification
VITE_SENTRY_DSN, block the challenge — embed on a host no client record lists, or send a CSP withoutframe-src https://cloud.sydevelopers.com— and confirm one event arrives in thesahajatlas-webproject taggedatlas.kind: captcha-blocked.frame-srcto SahajCloud is a plausible candidate to have leftconnect-src *.sentry.ioout too, and then the event is swallowed by the transport's refusal latch. The CSP half of this failure may stay partly invisible from the client side.Notes for reviewer
captcha-blockedembed reports once per broken pageview, accepted becauseconfighas the same profile and Sentry groups the events into one issue. B was declined because a refusedframe-srcnever reaches SahajCloud, so it cannot see the CSP half of this failure; C because its per-visitor latch needs a fifth storage key on the host origin, which throws in the sandboxed embeds likeliest to block the challenge.use-turnstile-guardwarns first, throughreportIntegrationWarning, with the advice naming both causes and the troubleshooting link.reportInternalErrorthen logs the kind, and that is the line now at error level. One table decides both of its signals by design; splitting them would be a change to the seam, not to this row.dedupeIntegration,MAX_EVENTS_PER_PAGEand the transport's one-shot refusal latch were already on this path, and the rule is to name an exposure rather than build machinery against an unmeasured one.sentincrements before the SDK's dedupe, so repeat "Try again" presses spend page-wide event slots on events that are then dropped — a pre-existing property of where the counter lives, and this screen is dead at the top boundary so there is rarely a later distinct failure to starve; moving the counter is a change to the seam. (b) Dropping the new per-kind tag assertion as derivable — it is not: replacingsetTag('atlas.kind', kind)with a constant reddens three rows, and the dedicated tagging case coversconfigonly. (c)vi.waitFor's 50 ms default poll is most of this spec's runtime — true, and a whole-file tidy rather than this row's business.Fallbacks.tsxclaimedREPORTED_KINDSmirrored the withheld report button. The line is gone rather than corrected:report.ts's table doc states the contrast at the row it governs, and a second copy here rebuilds the defect this PR fixes. Against the base that deletes a line and carries no breadcrumb away.@sentry/browsermock assumesloadReporterbuilds aBrowserClient, clones a childScopeper event and tags throughsetTag('atlas.kind', kind), and that the kind gate runs before the SDK import. Verified againstsrc/lib/report.ts:481-497and:533.Detail
Watched red before kept. Three times, each at the site that caused it. The new row fails against
REPORTED_KINDS['captcha-blocked']: false(expected [] to have a length of 1). The per-kind tag assertion fails on its own whensetTag('atlas.kind', kind)becomes a constant (config,captcha-blocked,unknownredden). The withheld rows' absence assertion fails when the kind gate is dropped fromcaptureErroralone (expected [ 'offline' ] to deeply equal []) — before the microtask flush this branch adds, that defect passed. Dropping a kind from the spec's table failspnpm typecheckwith TS2741 rather than passing silently.The alternative, weighed and not taken here. SahajCloud's
/api/atlas/challengealready answers 403 and already knows the parent host, so it could log every refusal with no client traffic at all. That is the cheaper census, in a different repo, and it does not replace this half: only the client knows a visitor actually saw the broken screen. The ticket leaves the roadmap promotion to a human.Privacy, re-verified rather than assumed. No field travels for this kind that was not already travelling for
server,configandunknown:beforeSendrebuildsevent.tagsto three keys andevent.requesttohostPageUrl()(origin and path), and deletesuser,extra,contexts,breadcrumbsand any attachment. The thrown message is a fixed literal, with nocauseforlinkedErrorsto walk. Both console branches pass identical arguments, so the level change discloses nothing new.Review passes.
/simplify(reuse, simplification, efficiency, altitude) and/code-review high— nopr-review-toolkitin a routine./security-reviewran twice, becausesrc/lib/reportis in this repo'ssecurityReview.triggerPattern: no finding either time.comment-lint.mjs: no banned comment added. Per-edit spec selection is unchanged from the base — the spec's rows come from its ownEXPECTEDtable, so nothing imports@/mocks/errorsthere.Closes #387
Generated by Claude Code