@aarwitz/tapp 0.17.26 → 0.17.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tapp",
3
3
  "description": "Give Claude hands and eyes on iOS, Android, and web apps, with exploration, replayable flows, evidence, and deterministic CI gates.",
4
- "version": "0.17.26",
4
+ "version": "0.17.27",
5
5
  "author": {
6
6
  "name": "Aaron Horowitz",
7
7
  "url": "https://github.com/aarwitz"
@@ -24,7 +24,7 @@
24
24
  "command": "npx",
25
25
  "args": [
26
26
  "-y",
27
- "@aarwitz/tapp@0.17.26",
27
+ "@aarwitz/tapp@0.17.27",
28
28
  "mcp"
29
29
  ],
30
30
  "cwd": "${CLAUDE_PROJECT_DIR}"
@@ -32,7 +32,7 @@ const LINK_CHECK_TIMEOUT_MS = 10_000;
32
32
 
33
33
  // What an audit does and does not look at. Spelled out so a report never borrows the exploration
34
34
  // run's "checked for" list and claims clicks that never happened.
35
- export function auditScope({ linksChecked = { total: 0, checked: 0 }, pages = 1 } = {}) {
35
+ export function auditScope({ linksChecked = { total: 0, checked: 0 }, pages = 1, wiringUnverifiable = [] } = {}) {
36
36
  const checkedFor = [
37
37
  "controls that were never alive: dead in-page anchors, placeholder links, aria-controls naming nothing, buttons with no handler/form/link",
38
38
  "images that failed to load",
@@ -52,6 +52,10 @@ export function auditScope({ linksChecked = { total: 0, checked: 0 }, pages = 1
52
52
  "app-specific business logic, content accuracy, privacy, brand, visual quality",
53
53
  pages > 1 ? `pages beyond the ${pages} audited` : "pages other than the one audited (pass --pages N to crawl same-origin links)",
54
54
  ];
55
+ if (wiringUnverifiable.length) {
56
+ const reasons = [...new Set(wiringUnverifiable)];
57
+ notChecked.unshift(`dead controls and placeholder links on ${wiringUnverifiable.length} page(s) where the check would accuse working controls: ${reasons.join("; ")}`);
58
+ }
55
59
  return { checkedFor, notChecked };
56
60
  }
57
61
 
@@ -105,6 +109,14 @@ async function auditPageHealth(page) {
105
109
  const src = img.getAttribute("src") || "";
106
110
  if (!src || src.startsWith("data:")) continue;
107
111
  if (img.complete && img.naturalWidth === 0) {
112
+ // A 1×1 (or hidden) image that failed is a tracking pixel the visitor never sees, not a
113
+ // broken picture on the page; a failed image lays out as a 16px placeholder box even when
114
+ // it was meant to be invisible, so a cross-origin, query-string, alt-less one is a beacon.
115
+ const box = img.getBoundingClientRect();
116
+ if (box.width <= 2 || box.height <= 2) continue;
117
+ let crossOrigin = false;
118
+ try { crossOrigin = new URL(src, location.href).origin !== location.origin; } catch { /* keep */ }
119
+ if (crossOrigin && /\?/.test(src) && !img.hasAttribute("alt")) continue;
108
120
  findings.push({ kind: "broken_image", src: src.slice(0, 160), alt: (img.getAttribute("alt") || "").slice(0, 80), selector: visible(img) ? tag(img) : null });
109
121
  }
110
122
  }
@@ -167,14 +179,25 @@ async function checkLinks(context, links, { limit, pageUrl }) {
167
179
  const pathOf = (() => { try { return new URL(href).pathname; } catch { return href; } })();
168
180
  try {
169
181
  let res = await context.request.fetch(href, { method: "HEAD", maxRedirects: 5, timeout: LINK_CHECK_TIMEOUT_MS, failOnStatusCode: false });
170
- if ([405, 501, 403].includes(res.status())) {
182
+ // Some servers refuse HEAD outright, and some answer 404/5xx to HEAD for pages that GET
183
+ // fine. Only a GET is allowed to call a link broken.
184
+ if ([405, 501, 403, 404, 410].includes(res.status()) || res.status() >= 500) {
171
185
  res = await context.request.fetch(href, { method: "GET", maxRedirects: 5, timeout: LINK_CHECK_TIMEOUT_MS, failOnStatusCode: false });
172
186
  }
173
187
  const status = res.status();
174
188
  if (status === 404 || status === 410) findings.push({ type: "broken_link", severity: "medium", title: `Link ${where} → ${pathOf} answers ${status}`, target: href, url: href });
175
189
  else if (status >= 500) findings.push({ type: "broken_link", severity: "high", title: `Link ${where} → ${pathOf} answers ${status}`, target: href, url: href });
176
190
  } catch (error) {
177
- findings.push({ type: "broken_link", severity: "low", title: `Link ${where} → ${pathOf} could not be fetched (${String(error?.message || error).split("\n")[0].slice(0, 80)})`, target: href, url: href });
191
+ // One dropped connection is not a broken link; a second is worth a low-severity note.
192
+ await new Promise((r) => setTimeout(r, 1000));
193
+ try {
194
+ const retry = await context.request.fetch(href, { method: "GET", maxRedirects: 5, timeout: LINK_CHECK_TIMEOUT_MS, failOnStatusCode: false });
195
+ const status = retry.status();
196
+ if (status === 404 || status === 410) findings.push({ type: "broken_link", severity: "medium", title: `Link ${where} → ${pathOf} answers ${status}`, target: href, url: href });
197
+ else if (status >= 500) findings.push({ type: "broken_link", severity: "high", title: `Link ${where} → ${pathOf} answers ${status}`, target: href, url: href });
198
+ } catch (again) {
199
+ findings.push({ type: "broken_link", severity: "low", title: `Link ${where} → ${pathOf} could not be fetched twice (${String(again?.message || again).split("\n")[0].slice(0, 80)})`, target: href, url: href });
200
+ }
178
201
  }
179
202
  }
180
203
  };
@@ -252,6 +275,8 @@ async function auditOnePage(context, target, { timeoutMs, linkCheckLimit, captur
252
275
  title: controls.title,
253
276
  controlsExamined: controls.controlCount,
254
277
  linksChecked: { total: links.total, checked: links.checked },
278
+ // Why the wiring-dependent checks were skipped on this page, if they were.
279
+ ...(controls.wiringUnverifiable ? { wiringUnverifiable: controls.wiringUnverifiable } : {}),
255
280
  findings,
256
281
  links: health.links,
257
282
  };
@@ -276,14 +301,14 @@ export function auditCaptureId(now = new Date()) {
276
301
  return `web-audit-${now.getFullYear()}${p(now.getMonth() + 1)}${p(now.getDate())}-${p(now.getHours())}${p(now.getMinutes())}${p(now.getSeconds())}`;
277
302
  }
278
303
 
279
- function finalizeCapture(capture, { startUrl, pages, findings, robotsBlocked, linksChecked }) {
304
+ function finalizeCapture(capture, { startUrl, pages, findings, robotsBlocked, linksChecked, wiringUnverifiable = [] }) {
280
305
  capture.emit("COMPLETE", { actions: 0, screens: pages.length, credentialsProvided: false, credentialsUsed: false, timedOut: false, stop: "audit-complete", readOnly: true, robotsBlocked });
281
306
  capture.close();
282
307
  const markers = path.join(capture.dir, "ocqa-markers.txt");
283
308
  const report = buildQaReport(markers, { platform: "web", target: startUrl });
284
309
  if (!report) return null;
285
310
  // The exploration report's coverage floor and wording assume clicks; an audit has none by design.
286
- const scope = auditScope({ linksChecked, pages: pages.length });
311
+ const scope = auditScope({ linksChecked, pages: pages.length, wiringUnverifiable });
287
312
  const counts = report.deterministicFindingCounts || report.findingCounts || { critical: 0, high: 0, medium: 0, low: 0 };
288
313
  Object.assign(report, {
289
314
  kind: "tapp-structural-audit",
@@ -307,6 +332,25 @@ function finalizeCapture(capture, { startUrl, pages, findings, robotsBlocked, li
307
332
  return report;
308
333
  }
309
334
 
335
+ // The same defect seen on several pages (site-wide navigation, a footer, a missing viewport
336
+ // meta) is one issue. Keyed by type and target; the title is the first one seen.
337
+ export function dedupeSiteIssues(findings = []) {
338
+ const byKey = new Map();
339
+ for (const f of findings) {
340
+ const key = `${f.type}|${f.target ?? f.title}`;
341
+ const page = f.screen || f.url || "";
342
+ const existing = byKey.get(key);
343
+ if (existing) {
344
+ if (page && !existing.pages.includes(page)) existing.pages.push(page);
345
+ existing.occurrences += 1;
346
+ continue;
347
+ }
348
+ byKey.set(key, { type: f.type, severity: f.severity, title: f.title, target: f.target ?? null, evidence: f.evidence || null, pages: page ? [page] : [], occurrences: 1 });
349
+ }
350
+ const rank = { critical: 0, high: 1, medium: 2, low: 3 };
351
+ return [...byKey.values()].sort((a, b) => (rank[a.severity] ?? 4) - (rank[b.severity] ?? 4) || b.pages.length - a.pages.length);
352
+ }
353
+
310
354
  // Audit a site: the start page and, with pages > 1, same-origin links discovered on audited pages
311
355
  // (breadth-first, robots.txt honoured, one request at a time with a pause between pages).
312
356
  export async function auditWebSite({
@@ -380,24 +424,31 @@ export async function auditWebSite({
380
424
  }
381
425
 
382
426
  const findings = results.flatMap((r) => r.findings);
427
+ const issues = dedupeSiteIssues(findings);
383
428
  const bySeverity = { critical: 0, high: 0, medium: 0, low: 0 };
384
429
  for (const f of findings) if (f.severity in bySeverity) bySeverity[f.severity] += 1;
385
- const scope = auditScope({ linksChecked: { total: linksTotal, checked: linksChecked }, pages: results.length });
430
+ const wiringUnverifiable = results.map((r) => r.wiringUnverifiable).filter(Boolean);
431
+ const scope = auditScope({ linksChecked: { total: linksTotal, checked: linksChecked }, pages: results.length, wiringUnverifiable });
386
432
  const summary = {
387
433
  kind: "tapp-structural-audit",
388
434
  readOnly: true,
389
435
  url: start.href,
390
436
  pagesAudited: results.length,
437
+ pagesWithUnverifiableWiring: wiringUnverifiable.length,
391
438
  pagesQueued: queue.length,
392
439
  robotsBlocked,
393
440
  findingCounts: { ...bySeverity, total: findings.length },
441
+ // One entry per distinct defect across the site, with the pages it appears on: a footer
442
+ // link that answers 404 on six pages is one thing to fix, and one line in an email.
443
+ issues,
444
+ issueCount: issues.length,
394
445
  checkedFor: scope.checkedFor,
395
446
  notChecked: scope.notChecked,
396
447
  pages: results,
397
448
  capture: null,
398
449
  };
399
450
  if (capture) {
400
- finalizeCapture(capture, { startUrl: start.href, pages: results, findings, robotsBlocked, linksChecked: { total: linksTotal, checked: linksChecked } });
451
+ finalizeCapture(capture, { startUrl: start.href, pages: results, findings, robotsBlocked, linksChecked: { total: linksTotal, checked: linksChecked }, wiringUnverifiable });
401
452
  summary.capture = { id: capture.id, path: capture.dir, report: path.join(capture.dir, "report.html"), provenance };
402
453
  fs.writeFileSync(path.join(capture.dir, "audit.json"), JSON.stringify(summary, null, 2));
403
454
  }
@@ -144,15 +144,22 @@ export async function installWebListenerTracking(context) {
144
144
  // button works. Keep their source text: it is the only way to tell which
145
145
  // controls such a handler actually claims.
146
146
  const delegatedKey = Symbol.for("tapp.delegatedClickHandlers");
147
+ // How many click handlers the page attached anywhere: zero means its scripts have not run
148
+ // (deferred hydration), and "nothing is listening on this button" says nothing about the button.
149
+ const countKey = Symbol.for("tapp.clickListenerCount");
150
+ window[countKey] = 0;
147
151
  const add = EventTarget.prototype.addEventListener;
148
152
  const remove = EventTarget.prototype.removeEventListener;
149
153
  EventTarget.prototype.addEventListener = function tappTrackedAdd(type, listener, options) {
154
+ if (type === "click" && listener) window[countKey] += 1;
150
155
  if (type === "click" && this instanceof Element && listener) {
151
156
  if (!this[key]) Object.defineProperty(this, key, { value: new Set(), configurable: true });
152
157
  this[key].add(listener);
153
158
  }
154
- if (type === "click" && listener && (this === document || this === window)) {
155
- const target = this === window ? window : document;
159
+ // Delegation targets: document, window, and the two elements a site-wide handler sits on.
160
+ const global = this === document || this === window || (document.body && this === document.body) || this === document.documentElement;
161
+ if (type === "click" && listener && global) {
162
+ const target = this === window ? window : this === document ? document : this;
156
163
  if (!target[delegatedKey]) Object.defineProperty(target, delegatedKey, { value: new Set(), configurable: true });
157
164
  try { target[delegatedKey].add(String(listener).slice(0, 4000)); } catch { /* exotic handler */ }
158
165
  }
@@ -1208,7 +1215,10 @@ export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDi
1208
1215
  export function auditFindingsFromControls(controls = []) {
1209
1216
  const findings = [];
1210
1217
  for (const control of controls) {
1211
- const where = control.label || control.identifier || control.selector || "(unlabelled)";
1218
+ // Never name a control by its evidence selector; an unlabelled control is said to be one.
1219
+ const where = control.label
1220
+ || (control.identifier && /[#\[]/.test(control.identifier) ? control.identifier : "")
1221
+ || `unlabelled <${control.tag || "control"}>`;
1212
1222
  if (control.kind === "dead_anchor") {
1213
1223
  findings.push({ type: "anchor_missing", severity: "medium",
1214
1224
  title: `In-page link “${where}” points at #${control.fragment}, which is not on the page`, target: control.href });
@@ -1236,8 +1246,24 @@ export async function auditStructuralControls(page) {
1236
1246
  const style = window.getComputedStyle(el);
1237
1247
  return style.visibility !== "hidden" && style.display !== "none" && el.getClientRects().length > 0;
1238
1248
  };
1239
- const name = (el) => (el.getAttribute("aria-label") || el.textContent || el.getAttribute("value") || "").replace(/\s+/g, " ").trim().slice(0, 80);
1249
+ const name = (el) => {
1250
+ const labelledBy = (el.getAttribute("aria-labelledby") || "").split(/\s+/).map((id) => id && document.getElementById(id)?.textContent).filter(Boolean).join(" ");
1251
+ const inner = el.querySelector("img[alt], svg[aria-label], [title]");
1252
+ const raw = el.getAttribute("aria-label") || labelledBy || el.textContent || el.getAttribute("title") || (inner && (inner.getAttribute("alt") || inner.getAttribute("aria-label") || inner.getAttribute("title"))) || el.getAttribute("value") || "";
1253
+ return String(raw).replace(/\s+/g, " ").trim().slice(0, 80);
1254
+ };
1240
1255
  const selectorFor = (el) => el.id ? `#${el.id}` : el.getAttribute("data-testid") ? `[data-testid="${el.getAttribute("data-testid")}"]` : el.tagName.toLowerCase();
1256
+ // A short class is the best name an icon-only control has ("a.social-facebook").
1257
+ const classHint = (el) => { const c = [...el.classList].find((x) => /^[a-z][a-z0-9_-]{2,30}$/i.test(x) && !/^(active|btn|button|link|icon|item|elementor|wp|fa|fas|fab|far)$/i.test(x)); return c ? `${el.tagName.toLowerCase()}.${c}` : ""; };
1258
+ // Natively interactive without any script: the browser wires these itself.
1259
+ const nativelyWired = (el) => Boolean(el.closest("summary, details, select, option, label, input, textarea, video[controls], audio[controls]"));
1260
+ // A control that hosts a shadow root, or sits inside a third-party widget mount (accessibility
1261
+ // overlays, chat bubbles), is wired by that widget's own script where no page-level record
1262
+ // can see it.
1263
+ const widgetWired = (el) => {
1264
+ for (let node = el; node && node !== document.body; node = node.parentElement) if (node.shadowRoot) return true;
1265
+ return Boolean(el.closest('[id*="userway" i], [class*="userway" i], [id*="accessib" i], [class*="accessib" i], [id*="acsb" i], [class*="acsb" i], [id*="chat" i][class*="widget" i], iframe'));
1266
+ };
1241
1267
  // Some controls are wired in CSS, not JavaScript: a menu that opens while
1242
1268
  // its trigger is hovered or focused has no listener to find, and calling
1243
1269
  // it dead is wrong. Collect the selectors that some rule reacts to — the
@@ -1276,10 +1302,9 @@ export async function auditStructuralControls(page) {
1276
1302
  // this way (an outside-click closer, say) claims nothing and is ignored,
1277
1303
  // rather than excusing every unwired control on the page.
1278
1304
  const delegatedSelectors = [];
1279
- for (const source of [
1280
- ...(document[Symbol.for("tapp.delegatedClickHandlers")] || []),
1281
- ...(window[Symbol.for("tapp.delegatedClickHandlers")] || []),
1282
- ]) {
1305
+ const delegatedKey = Symbol.for("tapp.delegatedClickHandlers");
1306
+ const globalSources = [document, window, document.body, document.documentElement].flatMap((t) => [...((t && t[delegatedKey]) || [])]);
1307
+ for (const source of globalSources) {
1283
1308
  for (const m of String(source).matchAll(/\.(?:closest|matches)\(\s*["'`]([^"'`]+)["'`]/g)) {
1284
1309
  delegatedSelectors.push(m[1]);
1285
1310
  }
@@ -1287,44 +1312,105 @@ export async function auditStructuralControls(page) {
1287
1312
  const claimedByDelegate = (el) => delegatedSelectors.some((selector) => {
1288
1313
  try { return el.matches(selector) || Boolean(el.closest(selector)); } catch { return false; }
1289
1314
  });
1315
+ // jQuery registers one dispatcher per element and keeps `$(root).on("click", ".sel", fn)`'s
1316
+ // selector in its own registry, so neither the per-element listener record nor the handler's
1317
+ // source text says which controls it claims. WordPress/Elementor/Bootstrap sites wire menus,
1318
+ // accordions, sliders and review widgets this way; read the registry directly.
1319
+ const jq = window.jQuery && typeof window.jQuery._data === "function" ? window.jQuery : null;
1320
+ const jqHandlers = (node) => {
1321
+ let events;
1322
+ try { events = jq._data(node, "events"); } catch { events = null; }
1323
+ return events ? [...(events.click || []), ...(events.touchstart || []), ...(events.touchend || [])] : [];
1324
+ };
1325
+ const jqWired = (el) => {
1326
+ if (!jq) return false;
1327
+ for (let node = el; node; node = node.parentElement) {
1328
+ for (const h of jqHandlers(node)) {
1329
+ if (!h.selector) return true; // a direct handler on the control or an ancestor
1330
+ try { if (el.matches(h.selector) || el.closest(h.selector)) return true; } catch { /* bad selector */ }
1331
+ }
1332
+ }
1333
+ for (const h of jqHandlers(document)) {
1334
+ if (!h.selector) continue;
1335
+ try { if (el.matches(h.selector) || el.closest(h.selector)) return true; } catch { /* bad selector */ }
1336
+ }
1337
+ return false;
1338
+ };
1339
+ // Everything that makes a control "alive": the same test for a button and for a link whose
1340
+ // href is a placeholder — a wired `<a href="#">` is a JavaScript control, not a dead link.
1341
+ const isWired = (el) => {
1342
+ if (nativelyWired(el) || widgetWired(el)) return true;
1343
+ for (let node = el; node && node !== document.body; node = node.parentElement) {
1344
+ if ((node[key] && node[key].size > 0) || typeof node.onclick === "function" || node.hasAttribute("onclick")) return true;
1345
+ }
1346
+ if (el.matches("button[type=submit], input[type=submit]") && el.closest("form")) return true;
1347
+ if (el.closest("label")) return true; // a label drives its own control
1348
+ if (opensSomethingOnHoverOrFocus(el)) return true;
1349
+ if (claimedByDelegate(el)) return true;
1350
+ if (jqWired(el)) return true;
1351
+ return false;
1352
+ };
1290
1353
 
1354
+ // Some sites delay every script until the first user interaction (WP Rocket, Perfmatters,
1355
+ // Flying Scripts). A read-only audit never interacts, so on such a page nothing is wired yet
1356
+ // and every control would be called dead. Detect the pattern and skip the wiring-dependent
1357
+ // checks; the report says they were not checked.
1358
+ const deferredScripts = document.querySelectorAll('script[type="rocketlazyloadscript"], script[data-rocket-type], script[type="pmdelayedscript"], script[type="javascript/blocked"], script[data-type="lazy"], script[type="lazy"]').length;
1359
+ const jqueryTagWithoutJquery = !window.jQuery && Boolean(document.querySelector('script[src*="jquery"]'));
1360
+ const generator = (document.querySelector('meta[name="generator"]')?.getAttribute("content") || "").toLowerCase();
1361
+ // Wix renders every control server-side and hydrates each component on its own schedule;
1362
+ // what has a handler at audit time is not what has one for a visitor.
1363
+ const lazyHydrationBuilder = generator.includes("wix") || Boolean(document.querySelector("#SITE_CONTAINER, [data-wix-site]"));
1364
+ const scriptsDeferred = deferredScripts > 0 || jqueryTagWithoutJquery;
1365
+ const clickListenerCount = window[Symbol.for("tapp.clickListenerCount")] || 0;
1366
+ const inlineHandlers = document.querySelectorAll("[onclick]").length;
1367
+ // A page with no scripts at all is static: a dead button there is dead. The hydration rule
1368
+ // is for pages that load scripts and attached nothing by the time the audit looked.
1369
+ const loadsScripts = document.querySelectorAll("script[src]").length > 0;
1370
+ // A global click handler whose source exposes no selector: delegation we cannot read.
1371
+ const opaqueGlobalHandlers = globalSources.filter((src) => !/\.(?:closest|matches)\(\s*["'`]/.test(String(src))).length;
1291
1372
  const dead = [];
1292
1373
  for (const el of document.querySelectorAll("a[href], button, [role=button], [aria-controls]")) {
1293
1374
  if (!visible(el)) continue;
1294
1375
  const label = name(el);
1376
+ const identifier = /^[a-z]+$/.test(selectorFor(el)) ? (classHint(el) || selectorFor(el)) : selectorFor(el);
1377
+ const tag = el.tagName.toLowerCase();
1295
1378
  const href = el.getAttribute("href");
1296
1379
  const ariaControls = el.getAttribute("aria-controls");
1297
1380
  if (ariaControls && !document.getElementById(ariaControls)) {
1298
- dead.push({ element: el, kind: "dangling_aria_controls", label, selector: selectorFor(el), controls: ariaControls });
1381
+ dead.push({ element: el, kind: "dangling_aria_controls", label, identifier, tag, selector: identifier, controls: ariaControls });
1299
1382
  continue;
1300
1383
  }
1301
1384
  if (href != null) {
1302
1385
  if (href === "#" || href.trim() === "" || /^javascript:\s*(void\(0\))?;?$/i.test(href)) {
1303
- dead.push({ element: el, kind: "placeholder_link", label, selector: selectorFor(el), href });
1386
+ if (!isWired(el)) dead.push({ element: el, kind: "placeholder_link", label, identifier, tag, selector: identifier, href });
1304
1387
  } else if (href.startsWith("#")) {
1305
1388
  const fragment = decodeURIComponent(href.slice(1));
1306
1389
  const found = fragment && (document.getElementById(fragment) || document.getElementsByName(fragment).length > 0);
1307
- if (!found) dead.push({ element: el, kind: "dead_anchor", label, selector: selectorFor(el), href, fragment });
1390
+ if (!found && !isWired(el)) dead.push({ element: el, kind: "dead_anchor", label, identifier, tag, selector: identifier, href, fragment });
1308
1391
  }
1309
1392
  continue;
1310
1393
  }
1311
1394
  // A button with nothing behind it: no listener on itself or an ancestor, no inline
1312
- // handler, and not a submit inside a form.
1313
- let wired = false;
1314
- for (let node = el; node && node !== document.body; node = node.parentElement) {
1315
- if ((node[key] && node[key].size > 0) || typeof node.onclick === "function" || node.hasAttribute("onclick")) { wired = true; break; }
1316
- }
1317
- if (!wired && el.matches("button[type=submit], input[type=submit]") && el.closest("form")) wired = true;
1318
- if (!wired && el.closest("label")) wired = true; // a label drives its own control
1319
- if (!wired && opensSomethingOnHoverOrFocus(el)) wired = true;
1320
- if (!wired && claimedByDelegate(el)) wired = true;
1321
- if (!wired) dead.push({ element: el, kind: "unwired_control", label, selector: selectorFor(el) });
1395
+ // handler, not a submit inside a form, not CSS-, delegation- or jQuery-wired.
1396
+ if (!isWired(el)) dead.push({ element: el, kind: "unwired_control", label, identifier, tag, selector: identifier });
1322
1397
  }
1323
1398
 
1324
1399
  for (let i = 0; i < dead.length; i += 1) {
1325
1400
  if (dead[i].element) { dead[i].element.setAttribute("data-tapp-audit", String(i + 1)); dead[i].selector = `[data-tapp-audit="${i + 1}"]`; delete dead[i].element; }
1326
1401
  }
1327
- return { dead, controlCount: document.querySelectorAll("a[href], button, [role=button]").length, title: document.title };
1402
+ // Whether "no handler found" means anything on this page. Deferred scripts, or a page that
1403
+ // attached no click handler at all, make the check blind; three or more "dead" controls
1404
+ // under a global handler we cannot read is the signature of unreadable delegation
1405
+ // (Squarespace, Wix once hydrated), not of three dead buttons — a dead button is rare.
1406
+ const wiringDependent = dead.filter((d) => d.kind !== "dangling_aria_controls");
1407
+ let wiringUnverifiable = "";
1408
+ if (scriptsDeferred) wiringUnverifiable = "the page defers its scripts until a user interacts";
1409
+ else if (lazyHydrationBuilder && wiringDependent.length) wiringUnverifiable = "the site builder (Wix) hydrates controls lazily after rendering them";
1410
+ else if (loadsScripts && clickListenerCount === 0 && inlineHandlers === 0 && wiringDependent.length) wiringUnverifiable = "the page attached no click handler at all at audit time (deferred hydration)";
1411
+ else if (opaqueGlobalHandlers > 0 && wiringDependent.length >= 3) wiringUnverifiable = "a site-wide click handler the audit cannot read claims the controls";
1412
+ const kept = wiringUnverifiable ? dead.filter((d) => d.kind === "dangling_aria_controls") : dead;
1413
+ return { dead: kept, controlCount: document.querySelectorAll("a[href], button, [role=button]").length, title: document.title, scriptsDeferred, wiringUnverifiable: wiringUnverifiable || null };
1328
1414
  });
1329
1415
  }
1330
1416
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aarwitz/tapp",
3
- "version": "0.17.26",
3
+ "version": "0.17.27",
4
4
  "mcpName": "io.github.aarwitz/tapp",
5
5
  "description": "Let coding agents verify UI changes on real iOS, Android, and web surfaces, then enforce reviewed proof in deterministic CI.",
6
6
  "license": "MIT",