diff --git a/CHANGELOG.md b/CHANGELOG.md index 25778a5..ede1af4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ ## [Unreleased] +Packages: `runtime-browser` 1.11.0, `otlp-ingester` 1.21.0. + +### Silent failures: clicks and forms that do nothing + +- `runtime-browser`: reports three failures that throw no error, on by default. A dead click is a click on a button, link or `[role=button]` after which nothing happens within 1.5 s. A rage click is three dead clicks on one control within 2 s. A rejected form is one refused twice, by the browser's own validation or by a 400, 409 or 422 answer to its submit. Each is an `outcome` event with severity `warning`, at most once per control per page load and at most 20 per page load. +- `runtime-browser`: turn it off with `initAutterBrowser({ ..., captureInteractions: false })`. `captureActions: false` turns it off too. Dead clicks also need the request hooks (`captureNetworkFailures`). +- `runtime-browser`: name a control with `data-autter-action`, and leave out a control whose clicks are meant to do nothing with `data-autter-ignore`. Clicks inside an element with `data-autter-ignore` are not watched. +- `runtime-browser`: `trackGoal(name, props?)` sends a `track_event` named `goal:`. The name is 1 to 80 letters, digits, `_`, `.` or `-`; any other name is ignored with one `console.warn`. +- `otlp-ingester`: groups the signals by a `control-v1` fingerprint of the group (`click` for dead and rage clicks, `submit` for rejected forms), the route template and the control key. Dead and rage clicks on one control form one issue. An event with a missing or malformed context is stored as a plain outcome. +- No new event type is added. The signals travel as existing `outcome` events, so older relays and ingesters store them as ordinary outcomes. + ## [1.23.1] - 2026-11-27 Packages: `runtime-browser` 1.10.1, `runtime-node` 1.19.1, `runtime-edge` 1.6.1, `runtime-next` 1.12.1, `runtime-cli` 1.6.1, `otlp-ingester` 1.20.1. No code changes from 1.23.0. diff --git a/adapters/python/compat.py b/adapters/python/compat.py index a8aa0d1..d73f9d9 100644 --- a/adapters/python/compat.py +++ b/adapters/python/compat.py @@ -355,6 +355,15 @@ "sdks": { "@autter/runtime-node": "1.14.0" } + }, + { + "id": "browser-interactions", + "title": "Silent browser failures (dead clicks, rage clicks, rejected forms) grouped by control (control-v1)", + "ingester": "1.21.0", + "migrations": [], + "sdks": { + "@autter/runtime-browser": "1.11.0" + } } ] } diff --git a/docs/COMPATIBILITY.md b/docs/COMPATIBILITY.md index 8236413..1d30ee1 100644 --- a/docs/COMPATIBILITY.md +++ b/docs/COMPATIBILITY.md @@ -157,6 +157,7 @@ SDKs you have installed and the ingester you point it at. | Server bundles symbolicated, with source context lines (`server_source_maps`) | 1.11.0+ | 1.9.0+ | 1.9.0+ | – | 1.4.0+ | `/v1/sourcemaps` | | | Wrapped errors grouped with their root cause (cause-v1) (`cause_fingerprint`) | 1.11.0+ | 1.9.0+ | 1.9.0+ | – | 1.4.0+ | | | | Cache-aware LLM cost (prompt-cache reads and writes) (`llm_cache_tokens`) | 1.16.0+ | 1.14.0+ | – | – | – | | `0024-llm-cache-tokens` | +| Silent browser failures (dead clicks, rage clicks, rejected forms) grouped by control (control-v1) (`browser-interactions`) | 1.21.0+ | – | – | 1.11.0+ | – | | | Notes: diff --git a/docs/CONTINUOUS-DETECTION.md b/docs/CONTINUOUS-DETECTION.md index eee9c03..b407507 100644 --- a/docs/CONTINUOUS-DETECTION.md +++ b/docs/CONTINUOUS-DETECTION.md @@ -168,6 +168,38 @@ enough evidence to prepare a PR. Never put a server key in the browser bundle. All automatically prepared fixes are draft PRs. Repository owners can turn expanded detection or automatic drafts off in Runtime Overview. +## Silent browser failures + +A page can fail without throwing: a button that does nothing, a control +clicked over and over, a form rejected again and again. The browser SDK reports +these as three warning-level error types, so they never count as crashes or +errors: + +| Error type | Meaning | +| --- | --- | +| `DeadClick` | a click on a control produced no visible effect | +| `RageClick` | rapid repeated clicks on one control | +| `FormRejected` | a form submission refused repeatedly | + +They travel as the existing `outcome` event (`severity: "warning"`, name +`autter.interaction.`), so an older relay +or ingester still stores them as ordinary outcomes. The context carries +`autter.interaction`, `autter.control` (a stable key such as +`click:main>form>button.2`, only `[a-z0-9:>_.-]`, at most 160 characters), +`autter.control.route` (the route with ids collapsed, e.g. `/orders/:id`) and +the click counts. An event whose context is missing or malformed is stored as a +plain outcome. + +Occurrences group by the `control-v1` fingerprint: sha256 of `control-v1`, +the group, the route and the control key, joined with a NUL byte, cut to 32 hex +characters. The group is `click` for `DeadClick` and `RageClick` (one issue for +both) and `submit` for `FormRejected`. An explicit fingerprint set in the SDK +still wins. `autter.interaction.blocked: true` marks a signal the SDK suspects +is noise (offline, a blocked script). + +A goal is a `track_event` named `goal:`; it is counted on the route +`event:goal:` like any other event. + ## Rollout order Deploy the ingester first so it creates the profile and source map ClickHouse diff --git a/package-lock.json b/package-lock.json index 61879e4..090c40d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6718,7 +6718,7 @@ }, "packages/otlp-ingester": { "name": "@autter/otlp-ingester", - "version": "1.20.1", + "version": "1.21.0", "license": "MIT", "dependencies": { "@clickhouse/client": "^1.12.0", @@ -6744,7 +6744,7 @@ }, "packages/runtime-browser": { "name": "@autter/runtime-browser", - "version": "1.10.1", + "version": "1.11.0", "license": "MIT", "devDependencies": { "@size-limit/preset-small-lib": "^11.1.6", diff --git a/packages/otlp-ingester/package.json b/packages/otlp-ingester/package.json index 18501ac..9347bb6 100644 --- a/packages/otlp-ingester/package.json +++ b/packages/otlp-ingester/package.json @@ -1,6 +1,6 @@ { "name": "@autter/otlp-ingester", - "version": "1.20.1", + "version": "1.21.0", "description": "Self-hostable OTLP + browser-error ingest service for Autter Runtime: normalises telemetry into a per-repo ClickHouse data model", "license": "MIT", "type": "module", diff --git a/packages/otlp-ingester/src/compat-manifest.json b/packages/otlp-ingester/src/compat-manifest.json index 97b60ac..bdf9197 100644 --- a/packages/otlp-ingester/src/compat-manifest.json +++ b/packages/otlp-ingester/src/compat-manifest.json @@ -213,6 +213,13 @@ "ingester": "1.16.0", "migrations": ["0024-llm-cache-tokens"], "sdks": { "@autter/runtime-node": "1.14.0" } + }, + { + "id": "browser-interactions", + "title": "Silent browser failures (dead clicks, rage clicks, rejected forms) grouped by control (control-v1)", + "ingester": "1.21.0", + "migrations": [], + "sdks": { "@autter/runtime-browser": "1.11.0" } } ] } diff --git a/packages/otlp-ingester/src/compat.test.ts b/packages/otlp-ingester/src/compat.test.ts index ebbed61..062ee27 100644 --- a/packages/otlp-ingester/src/compat.test.ts +++ b/packages/otlp-ingester/src/compat.test.ts @@ -151,3 +151,15 @@ test("docs/COMPATIBILITY.md's table is the manifest (node scripts/compat-table.m const table = compatTableMarkdown(); for (const feature of COMPAT_MANIFEST.features) assert.ok(table.includes(`(\`${feature.id}\`) | ${feature.ingester}+ |`), feature.id); }); + +test("browser-interactions rides the existing outcome event type: no new type, no migration", () => { + const feature = COMPAT_MANIFEST.features.find((f) => f.id === "browser-interactions"); + assert.ok(feature); + assert.deepEqual(feature.migrations, []); + assert.ok(feature.sdks["@autter/runtime-browser"]); + assert.equal(feature.browserEvents, undefined); + assert.ok(browserPayloadSchema.safeParse({ + version: 1, service: "s", environment: "e", + events: [{ type: "outcome", timestamp: new Date().toISOString(), name: "autter.interaction.dead_click", severity: "warning" }], + }).success); +}); diff --git a/packages/otlp-ingester/src/fingerprint-control.test.ts b/packages/otlp-ingester/src/fingerprint-control.test.ts new file mode 100644 index 0000000..65f682c --- /dev/null +++ b/packages/otlp-ingester/src/fingerprint-control.test.ts @@ -0,0 +1,46 @@ +import assert from "node:assert/strict"; +import { test } from "node:test"; +import { CONTROL_V1, controlFingerprint, controlV1Of, interactionSignalOf } from "./fingerprint-control.js"; +import { occurrenceIdentity } from "./fingerprint-v3.js"; +import type { RuntimeOccurrenceInput } from "./types.js"; + +// Fixed vectors: control-v1 = sha256("control-v1" \0 group \0 route \0 control).hex()[:32]. +// The platform mirrors them; changing one regroups every interaction issue. +const VECTORS: Array<{ group: "click" | "submit"; route: string; control: string; fingerprint: string }> = [ + { group: "click", route: "/orders/:id", control: "click:main>form>button.2", fingerprint: "c2909d332b3df78ff9402a6a3ba1b5da" }, + { group: "submit", route: "/orders/:id", control: "click:main>form>button.2", fingerprint: "bec869ea714cc7374cb7c37b289071be" }, + { group: "click", route: "/settings", control: "click:save-settings", fingerprint: "36adbd2da1ee5dbfa74d79b82ad9092a" }, + { group: "submit", route: "/signup", control: "submit:main>form.0", fingerprint: "c8fd298e38b4185e8f40deb7c9266486" }, +]; + +test("control-v1 fixed vectors", () => { + for (const v of VECTORS) assert.equal(controlFingerprint(v), v.fingerprint, `${v.group} ${v.route} ${v.control}`); +}); + +function occurrence(context: Record, errorType = "DeadClick"): RuntimeOccurrenceInput { + return { + source: "browser", severity: "warning", service: "web", environment: "prod", release: null, + errorType, message: "Clicking click:save-settings did nothing", stack: null, route: "/settings", + method: null, statusCode: null, traceId: null, sessionId: "s1", attributes: { context }, occurredAt: new Date(0), + }; +} + +test("control-v1 candidate comes right after manual-v1 and before frames-v3, legacy kept", () => { + const o = occurrence({ "autter.interaction": "dead_click", "autter.control": "click:save-settings", "autter.control.route": "/settings" }); + const id = occurrenceIdentity(o, []); + assert.deepEqual(id.candidates.map((c) => c.scheme), [CONTROL_V1, "frames-v3", "message-v1"]); + assert.equal(id.candidates[0]!.fingerprint, "36adbd2da1ee5dbfa74d79b82ad9092a"); + assert.equal(id.legacy.scheme, "message-v1"); + const manual = occurrenceIdentity({ ...o, fingerprintOverride: ["mine"] }, []); + assert.deepEqual(manual.candidates.slice(0, 2).map((c) => c.scheme), ["manual-v1", CONTROL_V1]); +}); + +test("no control-v1 for a server error, a generic type or a malformed context", () => { + const ok = { "autter.interaction": "dead_click", "autter.control": "click:save-settings", "autter.control.route": "/settings" }; + assert.equal(controlV1Of({ ...occurrence(ok), source: "server" }), null); + assert.equal(controlV1Of(occurrence(ok, "OutcomeFailure")), null); + assert.equal(controlV1Of(occurrence({ ...ok, "autter.control": "Click:Save" })), null); + assert.equal(interactionSignalOf({ ...ok, "autter.control.route": "settings" }), null); + assert.equal(interactionSignalOf({ ...ok, "autter.control.route": "/" + "a".repeat(300) }), null); + assert.equal(interactionSignalOf({ ...ok, "autter.interaction": "toString" }), null); +}); diff --git a/packages/otlp-ingester/src/fingerprint-control.ts b/packages/otlp-ingester/src/fingerprint-control.ts new file mode 100644 index 0000000..24a8ea4 --- /dev/null +++ b/packages/otlp-ingester/src/fingerprint-control.ts @@ -0,0 +1,86 @@ +import { createHash } from "node:crypto"; +import type { RuntimeOccurrenceInput } from "./types.js"; + +/** + * Silent-failure signals from the browser SDK (runtime-browser ≥ the version + * in the `browser-interactions` compat entry) arrive as the existing + * `outcome` event type, with the interaction named in the event context: + * + * context["autter.interaction"] dead_click | rage_click | form_rejected + * context["autter.control"] control key, ^[a-z0-9:>_.-]{1,160}$ + * context["autter.control.route"] route template, starts with "/", ≤ 300 chars + * + * A valid triple makes the occurrence an *interaction signal*: its errorType + * is DeadClick / RageClick / FormRejected and it carries a `control-v1` + * fingerprint, so every occurrence on one control of one route groups into + * one issue: + * + * sha256("control-v1" \0 group \0 routeTemplate \0 controlKey).hex()[:32] + * + * `group` is "click" for dead_click and rage_click (one issue for both) and + * "submit" for form_rejected. No service in the input: the platform keys + * issues per service already, and the contract fixes these four parts. + * Anything malformed is not an interaction signal and stays a plain outcome. + */ +export const CONTROL_V1 = "control-v1"; + +export const INTERACTION_ERROR_TYPES = { + dead_click: "DeadClick", + rage_click: "RageClick", + form_rejected: "FormRejected", +} as const; + +export type InteractionKind = keyof typeof INTERACTION_ERROR_TYPES; + +const INTERACTION_GROUP: Record = { + dead_click: "click", + rage_click: "click", + form_rejected: "submit", +}; + +const CONTROL_KEY = /^[a-z0-9:>_.-]{1,160}$/; +const MAX_ROUTE_LENGTH = 300; + +export interface InteractionSignal { + kind: InteractionKind; + errorType: (typeof INTERACTION_ERROR_TYPES)[InteractionKind]; + group: "click" | "submit"; + control: string; + route: string; +} + +/** The interaction signal a browser event's context describes, or null. */ +export function interactionSignalOf(context: unknown): InteractionSignal | null { + if (typeof context !== "object" || context === null || Array.isArray(context)) return null; + const bag = context as Record; + const kind = bag["autter.interaction"]; + if (typeof kind !== "string" || !Object.hasOwn(INTERACTION_ERROR_TYPES, kind)) return null; + const control = bag["autter.control"]; + if (typeof control !== "string" || !CONTROL_KEY.test(control)) return null; + const route = bag["autter.control.route"]; + if (typeof route !== "string" || !route.startsWith("/") || route.length > MAX_ROUTE_LENGTH) return null; + const k = kind as InteractionKind; + return { kind: k, errorType: INTERACTION_ERROR_TYPES[k], group: INTERACTION_GROUP[k], control, route }; +} + +/** The `control-v1` fingerprint (32 lowercase hex) of an interaction signal. */ +export function controlFingerprint(signal: Pick): string { + return createHash("sha256") + .update([CONTROL_V1, signal.group, signal.route, signal.control].join("\u0000")) + .digest("hex") + .slice(0, 32); +} + +/** + * The control-v1 fingerprint and its parts for an occurrence, or null when it + * is not an interaction signal. Only browser outcomes of the three interaction + * error types qualify, so a server error with the same attributes never does. + */ +export function controlV1Of( + input: Pick, +): { fingerprint: string; parts: string[] } | null { + if (input.source !== "browser") return null; + const signal = interactionSignalOf(input.attributes?.context); + if (!signal || input.errorType !== signal.errorType) return null; + return { fingerprint: controlFingerprint(signal), parts: [signal.group, signal.route, signal.control] }; +} diff --git a/packages/otlp-ingester/src/fingerprint-v3.ts b/packages/otlp-ingester/src/fingerprint-v3.ts index 915e153..ab60e7e 100644 --- a/packages/otlp-ingester/src/fingerprint-v3.ts +++ b/packages/otlp-ingester/src/fingerprint-v3.ts @@ -2,6 +2,7 @@ import { createHash } from "node:crypto"; import { causeTexts } from "./cause-chain.js"; import { normalizeMessage, occurrenceFingerprint } from "./fingerprint.js"; import { manualFingerprint } from "./fingerprint-override.js"; +import { CONTROL_V1, controlV1Of } from "./fingerprint-control.js"; import { parseStackFrames } from "./stack-frames.js"; import type { FingerprintCandidate, @@ -179,8 +180,8 @@ export interface OccurrenceIdentity { /** * The candidate list the sink carries (contract §1/§4), in precedence order: - * manual-v1 (SDK override) → code-v1 (valid error code) → frames-v3 → - * message-v1 (legacy) → cause-v1 (RF-06). + * manual-v1 (SDK override) → control-v1 (browser interaction signal) → + * code-v1 (valid error code) → frames-v3 → message-v1 (legacy) → cause-v1 (RF-06). * A coded error's legacy identity IS code-v1, which outranks every auto * scheme, so its list is [manual-v1?, code-v1]; an uncoded one is * [manual-v1?, frames-v3, message-v1, cause-v1?]. @@ -210,6 +211,11 @@ export function occurrenceIdentity( const candidates: FingerprintCandidate[] = []; const manual = manualFingerprint(input); if (manual) candidates.push({ scheme: "manual-v1", fingerprint: manual }); + // Browser interaction signals (dead/rage click, rejected form) group by + // control; the candidate outranks the automatic schemes, which stay after + // it so a platform that does not know control-v1 falls back to them. + const control = controlV1Of(input); + if (control) candidates.push({ scheme: CONTROL_V1, fingerprint: control.fingerprint }); let record: FingerprintRecord | null = null; let causeRecord: FingerprintRecord | null = null; if (legacy.scheme === "code-v1") { diff --git a/packages/otlp-ingester/src/normalize-browser.test.ts b/packages/otlp-ingester/src/normalize-browser.test.ts index 3be7c32..d8a44f8 100644 --- a/packages/otlp-ingester/src/normalize-browser.test.ts +++ b/packages/otlp-ingester/src/normalize-browser.test.ts @@ -1,6 +1,7 @@ import { test } from "node:test"; import assert from "node:assert/strict"; import { browserPayloadSchema, normalizeBrowserPayload } from "./normalize-browser.ts"; +import { controlV1Of } from "./fingerprint-control.ts"; function contextOf(payload: unknown): Record { const result = normalizeBrowserPayload( @@ -99,3 +100,76 @@ test("CSP violations become error occurrences with action context", () => { assert.equal(result.occurrences[0]?.severity, "error"); assert.equal((result.occurrences[0]?.attributes?.context as Record)["autter.action"], "click:send-email"); }); + +function interactionOccurrence( + name: string, + interaction: string, + control: string, + route: string, + extra: Record = {}, + severity: string = "warning", +) { + const result = normalizeBrowserPayload({ + version: 1, service: "web", environment: "prod", sessionId: "sess-1", + events: [{ + type: "outcome", timestamp: "2026-01-01T00:00:00.000Z", severity, name, + message: `Clicking ${control} did nothing`, route: "/orders/42", + context: { "autter.interaction": interaction, "autter.control": control, "autter.control.route": route, "autter.control.clicks": 3, "autter.control.dead": 3, ...extra }, + }], + } as unknown as Parameters[0]); + return result; +} + +test("interaction outcomes become DeadClick / RageClick / FormRejected warnings with control-v1", () => { + const dead = interactionOccurrence("autter.interaction.dead_click", "dead_click", "click:main>form>button.2", "/orders/:id", { "autter.interaction.blocked": true }); + const o = dead.occurrences[0]!; + assert.equal(o.errorType, "DeadClick"); + assert.equal(o.severity, "warning"); + assert.equal(o.message, "Clicking click:main>form>button.2 did nothing"); + assert.equal(o.sessionId, "sess-1"); + const ctx = o.attributes?.context as Record; + assert.equal(ctx["autter.interaction.blocked"], true); + assert.equal(ctx["autter.control.clicks"], 3); + assert.equal(controlV1Of(o)?.fingerprint, "c2909d332b3df78ff9402a6a3ba1b5da"); + // a warning is never a counted error + assert.equal(dead.metricPoints.reduce((n, p) => n + p.errorCount, 0), 0); + // even when a sender says error + const loud = interactionOccurrence("autter.interaction.dead_click", "dead_click", "click:a", "/", {}, "error"); + assert.equal(loud.occurrences[0]!.severity, "warning"); + assert.equal(loud.metricPoints.length, 0); +}); + +test("dead and rage clicks on one control and route share a fingerprint; form_rejected and other routes differ", () => { + const fp = (kind: string, control: string, route: string) => + controlV1Of(interactionOccurrence(`autter.interaction.${kind}`, kind, control, route).occurrences[0]!)!.fingerprint; + const control = "click:main>form>button.2"; + assert.equal(fp("dead_click", control, "/orders/:id"), fp("rage_click", control, "/orders/:id")); + assert.notEqual(fp("form_rejected", control, "/orders/:id"), fp("dead_click", control, "/orders/:id")); + assert.notEqual(fp("dead_click", control, "/orders"), fp("dead_click", control, "/orders/:id")); + assert.equal(interactionOccurrence("x", "rage_click", control, "/orders/:id").occurrences[0]!.errorType, "RageClick"); + assert.equal(interactionOccurrence("x", "form_rejected", control, "/orders/:id").occurrences[0]!.errorType, "FormRejected"); +}); + +test("a malformed interaction context stays an ordinary outcome", () => { + for (const [control, route] of [["Click:Save", "/a"], ["click:a b", "/a"], ["x".repeat(161), "/a"], ["click:a", "a"], ["click:a", "/" + "r".repeat(300)]] as const) { + const o = interactionOccurrence("checkout", "dead_click", control, route).occurrences[0]!; + assert.equal(o.errorType, "OutcomeFailure", `${control} ${route.length}`); + assert.equal(o.severity, "warning"); + assert.match(o.message, /^checkout: /); + assert.equal(controlV1Of(o), null); + } +}); + +test("goal: track events count on the route event:goal:", () => { + const result = normalizeBrowserPayload({ + version: 1, service: "web", environment: "prod", + events: [{ type: "track_event", timestamp: "2026-01-01T00:00:00.000Z", name: "goal:signup_completed", message: "" }], + } as unknown as Parameters[0]); + assert.equal(result.occurrences.length, 0); + assert.equal(result.metricPoints[0]?.route, "event:goal:signup_completed"); + assert.equal(result.metricPoints[0]?.requestCount, 1); + assert.ok(browserPayloadSchema.safeParse({ + version: 1, service: "web", environment: "prod", + events: [{ type: "track_event", timestamp: "2026-01-01T00:00:00.000Z", name: "goal:signup_completed" }], + }).success); +}); diff --git a/packages/otlp-ingester/src/normalize-browser.ts b/packages/otlp-ingester/src/normalize-browser.ts index a541125..58028d5 100644 --- a/packages/otlp-ingester/src/normalize-browser.ts +++ b/packages/otlp-ingester/src/normalize-browser.ts @@ -3,6 +3,7 @@ import { liftErrorFields } from "./error-fields.js"; import { fingerprintOverrideOf } from "./fingerprint-override.js"; import { sanitizeRuntimeContext } from "./context.js"; import { normalizeRoute } from "./fingerprint.js"; +import { interactionSignalOf } from "./fingerprint-control.js"; import { scrubText } from "./redact.js"; import { breadcrumbsField } from "./breadcrumbs.js"; import { browserDebugIds } from "./source-maps.js"; @@ -250,11 +251,17 @@ export function normalizeBrowserPayload( continue; } - const severity = asSeverity( - event.severity, - TYPE_TO_SEVERITY[event.type] ?? "error", - ); const context = event.context ? scrubContext(event.context) : undefined; + // Silent-failure signals ride the `outcome` type (no new event type, so + // old relays and schemas pass them): a valid interaction context makes + // the event a DeadClick / RageClick / FormRejected warning that groups + // by control (control-v1, fingerprint-control.ts). Malformed: a plain outcome. + const interaction = event.type === "outcome" ? interactionSignalOf(context) : null; + // An interaction signal is a warning whatever the sender says: it is + // never a crash or a counted error (no error_count rollup below). + const severity = interaction + ? "warning" + : asSeverity(event.severity, TYPE_TO_SEVERITY[event.type] ?? "error"); // runtime-browser 1.8.0 sends an Error passed to `console.error` with // the log line as `autter.log.message` only (its bundle is size-capped): // mark it the way the server SDKs mark a caught error. @@ -275,8 +282,9 @@ export function normalizeBrowserPayload( environment: payload.environment, release: payload.release ?? null, errorType: - event.errorType ?? TYPE_TO_ERROR_TYPE[event.type] ?? "Error", - message: event.type === "outcome" ? `${(event.name ?? "outcome").replace(EMAIL_VALUE_RE, REDACTED)}: ${event.message.replace(EMAIL_VALUE_RE, REDACTED)}` + interaction?.errorType ?? event.errorType ?? TYPE_TO_ERROR_TYPE[event.type] ?? "Error", + message: interaction ? event.message.replace(EMAIL_VALUE_RE, REDACTED) + : event.type === "outcome" ? `${(event.name ?? "outcome").replace(EMAIL_VALUE_RE, REDACTED)}: ${event.message.replace(EMAIL_VALUE_RE, REDACTED)}` : event.type === "request_failure" ? `${normalizeRoute((event.name ?? "request").split("?")[0]!.replace(EMAIL_VALUE_RE, REDACTED))}: ${event.message}` : event.message || "Unknown error", stack: event.stack ?? null, diff --git a/packages/otlp-ingester/src/types.ts b/packages/otlp-ingester/src/types.ts index e66da11..5b5475c 100644 --- a/packages/otlp-ingester/src/types.ts +++ b/packages/otlp-ingester/src/types.ts @@ -180,7 +180,7 @@ export interface FrameSymbolication { /** * Every grouping scheme an issue identity can come from (contract §1). * The ingester computes `manual-v1`, `code-v1`, `frames-v3`, `message-v1` - * and `cause-v1` (RF-06); `rule-v1` and `external-v1` exist only on the + * `cause-v1` (RF-06) and `control-v1` (browser interaction signals); `rule-v1` and `external-v1` exist only on the * platform. */ export type FingerprintSchemeV2 = @@ -190,6 +190,7 @@ export type FingerprintSchemeV2 = | "frames-v3" | "message-v1" | "cause-v1" + | "control-v1" | "external-v1"; export interface FingerprintCandidate { diff --git a/packages/runtime-browser/README.md b/packages/runtime-browser/README.md index a4f506b..635812b 100644 --- a/packages/runtime-browser/README.md +++ b/packages/runtime-browser/README.md @@ -98,6 +98,61 @@ initAutterBrowser({ }); ``` +## Silent failures + +Some failures throw nothing. The tracker notices three of them, on by default: + +- **Dead click**: a button, link or `[role=button]` was clicked and, within + 1.5 s, nothing happened: no change to the page, no request, no navigation, + no focus change, no scroll. +- **Rage click**: three or more dead clicks on the same control within 2 s. +- **Form rejected**: the same form was rejected twice, by the browser's own + validation or by a 400, 409 or 422 answer to its submit. A successful + submit starts the count again. + +Each is an `outcome` event with severity `warning` (`errorType` `DeadClick`, +`RageClick` or `FormRejected`), at most once per control per page load and at +most 20 per page load. It carries: + +| Context key | Value | +| --- | --- | +| `autter.interaction` | `dead_click`, `rage_click` or `form_rejected` | +| `autter.control` | The control's name, e.g. `click:save-settings` or `click:main>form>button.2` | +| `autter.control.route` | The route with ids collapsed: `/orders/:id` | +| `autter.control.clicks` / `autter.control.dead` | Clicks (or submits) on this page load, and how many did nothing (or were rejected) | +| `autter.interaction.blocked` | `true` when the page was offline or a script or request had already failed | + +The control is named from its `data-autter-action` attribute when it has one, +otherwise from tag names only: its ancestors' tags and its position among its +siblings. Text, values, ids, classes, hrefs and other attributes are never +read or sent (a link's href is checked only for `mailto:`, `tel:`, `sms:` and +`javascript:`, which are skipped). + +Give controls stable names, and leave out the ones that are meant to do nothing: + +```html + +
…a widget whose clicks change nothing on the page…
+``` + +Clicks inside ``, `