@aarwitz/tapp 0.17.25 → 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.
- package/.claude-plugin/plugin.json +2 -2
- package/AGENTS.md +21 -0
- package/mcp-server/src/html-report.js +2 -0
- package/mcp-server/src/ios-crash-attribution.js +133 -0
- package/mcp-server/src/report.js +50 -3
- package/mcp-server/src/web-audit.js +58 -7
- package/mcp-server/src/web-explorer.js +108 -22
- package/package.json +3 -2
- package/scripts/attribute-ios-crash.js +29 -0
- package/scripts/quick-capture.sh +7 -0
- package/skills/tapp/SKILL.md +11 -1
|
@@ -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.
|
|
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.
|
|
27
|
+
"@aarwitz/tapp@0.17.27",
|
|
28
28
|
"mcp"
|
|
29
29
|
],
|
|
30
30
|
"cwd": "${CLAUDE_PROJECT_DIR}"
|
package/AGENTS.md
CHANGED
|
@@ -217,3 +217,24 @@ without a coding agent, model, subscription, or API key. AI generation and `asse
|
|
|
217
217
|
and never present another project's capture as this project's evidence or borrow it as a fixture.
|
|
218
218
|
- A clean `tapp_audit` means the page is served without structural defects. It says nothing about
|
|
219
219
|
behaviour, because nothing was clicked; never report it as "the site works".
|
|
220
|
+
|
|
221
|
+
## File feedback on tapp itself — don't just work around it
|
|
222
|
+
|
|
223
|
+
Tapp is still being hardened, and a rough edge in Tapp is not the same thing as a defect in the
|
|
224
|
+
app under test. File it with `tapp_feedback` (or `npx -y @aarwitz/tapp@latest feedback "title"`)
|
|
225
|
+
as soon as you notice, not after you've already found a workaround and moved on — draft only;
|
|
226
|
+
`submit:true` needs the user's OK first, since filing posts a public GitHub issue. File when you
|
|
227
|
+
see any of:
|
|
228
|
+
|
|
229
|
+
- A command's documented or expected behavior doesn't match what happened (a flag silently
|
|
230
|
+
ignored, a field `null`/missing when it should be populated).
|
|
231
|
+
- A crash, hang, or unexplained failure from the underlying platform tooling (simulator, emulator,
|
|
232
|
+
browser) rather than the app under test.
|
|
233
|
+
- You had to invent a workaround to get a straightforward task done.
|
|
234
|
+
- A result that technically succeeded but didn't do what it clearly should have (`ok` with no
|
|
235
|
+
actual state change, `inconclusive` for a reason that doesn't match the documented causes).
|
|
236
|
+
- You're not sure whether something is a real app finding or a Tapp bug — file it rather than
|
|
237
|
+
silently deciding either way.
|
|
238
|
+
|
|
239
|
+
One file per distinct issue. Lean toward filing when unsure: a closed non-issue costs nothing, a
|
|
240
|
+
bug nobody ever reported stays a bug.
|
|
@@ -82,6 +82,8 @@ export function writeHtmlReport(captureDir, { report, label = "", recordingWarni
|
|
|
82
82
|
(f) => `<li>
|
|
83
83
|
<span class="sev" style="background:${SEV_COLOR[f.severity] || "#57606a"}">${esc(f.severity)}</span>
|
|
84
84
|
${esc(f.title)}${f.screen ? ` <span class="dim">— on ${esc(f.screen)}</span>` : ""}${f.url ? ` <span class="dim">— ${esc(f.url)}</span>` : ""}
|
|
85
|
+
${f.crashReport ? `<div class="dim">crash report: ${esc(f.crashReport)}</div>` : ""}
|
|
86
|
+
${f.attributionNote ? `<div class="dim">${esc(f.attributionNote)}</div>` : ""}
|
|
85
87
|
${f.aiAnalysis ? `<div class="ai">why: ${esc(f.aiAnalysis)}</div>` : ""}
|
|
86
88
|
${f.suggestedFix ? `<div class="ai">fix: ${esc(f.suggestedFix)}</div>` : ""}
|
|
87
89
|
${f.evidence && fs.existsSync(path.join(captureDir, f.evidence))
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Who actually crashed.
|
|
2
|
+
//
|
|
3
|
+
// The iOS harness reports `crash` when the app under test stops running mid-run. That is the
|
|
4
|
+
// right observation and the wrong attribution whenever a *simulator system process* died —
|
|
5
|
+
// SpringBoard respawning takes every foreground app with it — and xcodebuild prints the full
|
|
6
|
+
// system crash trace for any simulator-hosted process that dies, not just the app (public
|
|
7
|
+
// issue #30). The desktop app has had a cross-check against the real crash reports in
|
|
8
|
+
// ~/Library/Logs/DiagnosticReports since a false-CRITICAL incident in the field
|
|
9
|
+
// (ExplorationService.findRealCrashReport); this is that check for the CLI/MCP path.
|
|
10
|
+
//
|
|
11
|
+
// The rules are the ones verified against real reports there:
|
|
12
|
+
// - bundleID lives in the header for genuine app crashes, in the body for EXC_GUARD/XPC faults,
|
|
13
|
+
// and in bundleInfo.CFBundleIdentifier sometimes — check all three;
|
|
14
|
+
// - launch-throttle crash variants omit the bundle id entirely; a report whose procPath is in
|
|
15
|
+
// THIS simulator's user-app container is the app, unless it is the XCUITest runner, whose own
|
|
16
|
+
// death is instrumentation failure and never an app crash;
|
|
17
|
+
// - EXC_GUARD is not an app crash.
|
|
18
|
+
import fs from "fs";
|
|
19
|
+
import os from "os";
|
|
20
|
+
import path from "path";
|
|
21
|
+
|
|
22
|
+
export const DEFAULT_REPORTS_DIR = path.join(os.homedir(), "Library", "Logs", "DiagnosticReports");
|
|
23
|
+
export const ATTRIBUTION_FILE = "crash-attribution.json";
|
|
24
|
+
|
|
25
|
+
function parseIps(raw) {
|
|
26
|
+
const nl = raw.indexOf("\n");
|
|
27
|
+
if (nl < 0) return null;
|
|
28
|
+
let header; let body;
|
|
29
|
+
try { header = JSON.parse(raw.slice(0, nl)); } catch { return null; }
|
|
30
|
+
try { body = JSON.parse(raw.slice(nl + 1)); } catch { body = {}; }
|
|
31
|
+
if (!header || typeof header !== "object") return null;
|
|
32
|
+
return { header, body: body && typeof body === "object" ? body : {} };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function classifyCrashReport({ header, body }, { bundleId, simulatorUdid } = {}) {
|
|
36
|
+
const matchedBundle = (typeof body.bundleID === "string" && body.bundleID)
|
|
37
|
+
|| (typeof header.bundleID === "string" && header.bundleID)
|
|
38
|
+
|| (body.bundleInfo && typeof body.bundleInfo.CFBundleIdentifier === "string" ? body.bundleInfo.CFBundleIdentifier : null)
|
|
39
|
+
|| null;
|
|
40
|
+
const procPath = typeof body.procPath === "string" ? body.procPath : "";
|
|
41
|
+
const procName = String(body.procName || header.name || header.app_name || "").trim();
|
|
42
|
+
const lower = procName.toLowerCase();
|
|
43
|
+
const isTestRunner = lower.endsWith("-runner") || procPath.includes("-Runner.app") || procPath.includes(".xctrunner");
|
|
44
|
+
const inOurSimulator = simulatorUdid ? procPath.includes(`/Devices/${simulatorUdid}/`) : false;
|
|
45
|
+
const inOurAppContainer = inOurSimulator && procPath.includes("/data/Containers/Bundle/Application/") && !isTestRunner;
|
|
46
|
+
const exceptionType = body.exception && typeof body.exception.type === "string" ? body.exception.type : null;
|
|
47
|
+
const isApp = bundleId ? (matchedBundle === bundleId || (matchedBundle == null && inOurAppContainer)) : inOurAppContainer;
|
|
48
|
+
return {
|
|
49
|
+
procName: procName || "(unknown process)",
|
|
50
|
+
bundleId: matchedBundle,
|
|
51
|
+
exceptionType,
|
|
52
|
+
isTestRunner,
|
|
53
|
+
inOurSimulator,
|
|
54
|
+
kind: isTestRunner ? "test-runner" : exceptionType === "EXC_GUARD" ? "guard-fault" : isApp ? "app" : inOurSimulator ? "simulator-system" : "other",
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Reports written at or after `since` (ms epoch), classified. ExcUserFault_* files are user-fault
|
|
59
|
+
// notices, not crashes.
|
|
60
|
+
export function findCrashReports({ since, bundleId, simulatorUdid, dir = DEFAULT_REPORTS_DIR } = {}) {
|
|
61
|
+
let names;
|
|
62
|
+
try { names = fs.readdirSync(dir); } catch { return { app: [], simulatorSystem: [], other: [] }; }
|
|
63
|
+
const out = { app: [], simulatorSystem: [], other: [] };
|
|
64
|
+
for (const name of names) {
|
|
65
|
+
if (!name.endsWith(".ips") || name.startsWith("ExcUserFault_")) continue;
|
|
66
|
+
const full = path.join(dir, name);
|
|
67
|
+
let stat;
|
|
68
|
+
try { stat = fs.statSync(full); } catch { continue; }
|
|
69
|
+
if (Number.isFinite(since) && stat.mtimeMs < since) continue;
|
|
70
|
+
let parsed;
|
|
71
|
+
try { parsed = parseIps(fs.readFileSync(full, "utf8")); } catch { continue; }
|
|
72
|
+
if (!parsed) continue;
|
|
73
|
+
const c = classifyCrashReport(parsed, { bundleId, simulatorUdid });
|
|
74
|
+
const entry = { path: full, modifiedAt: new Date(stat.mtimeMs).toISOString(), procName: c.procName, bundleId: c.bundleId, exceptionType: c.exceptionType };
|
|
75
|
+
if (c.kind === "app") out.app.push(entry);
|
|
76
|
+
else if (c.kind === "simulator-system") out.simulatorSystem.push(entry);
|
|
77
|
+
else if (c.kind === "other" || c.kind === "test-runner") out.other.push({ ...entry, kind: c.kind });
|
|
78
|
+
// guard faults are dropped: not a crash of anything
|
|
79
|
+
}
|
|
80
|
+
for (const list of Object.values(out)) list.sort((a, b) => a.modifiedAt.localeCompare(b.modifiedAt));
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Replace a raw crash trace in captured tool output with one line that says whose it was, so a
|
|
85
|
+
// SpringBoard trace does not read as the app under test blowing up. The full text stays in
|
|
86
|
+
// full-output.txt; this is for anything shown to a person or an agent.
|
|
87
|
+
const TRACE_START = /^(?:Crash Report|Process:\s+\S+\s+\[\d+\]|Incident Identifier:|-{10,}\s*$|Thread \d+ (?:Crashed|name):)/;
|
|
88
|
+
const TRACE_END = /^(?:Binary Images:|EOF|-{10,}\s*$)/;
|
|
89
|
+
export function summarizeCrashTraces(text = "") {
|
|
90
|
+
const lines = String(text).split(/\r?\n/);
|
|
91
|
+
const out = [];
|
|
92
|
+
let i = 0;
|
|
93
|
+
while (i < lines.length) {
|
|
94
|
+
const line = lines[i];
|
|
95
|
+
const looksLikeTrace = /^Process:\s+(\S+)\s+\[\d+\]/.test(line) || /^Crash Report/.test(line) || /quit unexpectedly/i.test(line);
|
|
96
|
+
if (!looksLikeTrace) { out.push(line); i += 1; continue; }
|
|
97
|
+
let proc = (line.match(/^Process:\s+(\S+)/) || line.match(/^(\S+) quit unexpectedly/i) || [])[1] || "";
|
|
98
|
+
let exc = "";
|
|
99
|
+
let j = i;
|
|
100
|
+
let consumed = 0;
|
|
101
|
+
for (; j < lines.length && consumed < 400; j += 1, consumed += 1) {
|
|
102
|
+
const l = lines[j];
|
|
103
|
+
if (!proc) proc = (l.match(/^Process:\s+(\S+)/) || [])[1] || proc;
|
|
104
|
+
if (!exc) exc = (l.match(/^Exception Type:\s+(.+)$/) || [])[1] || exc;
|
|
105
|
+
if (consumed > 2 && TRACE_END.test(l)) { j += 1; break; }
|
|
106
|
+
}
|
|
107
|
+
out.push(`[crash trace of ${proc || "a simulator process"}${exc ? ` — ${exc.trim()}` : ""} omitted here; full text in full-output.txt]`);
|
|
108
|
+
i = j;
|
|
109
|
+
}
|
|
110
|
+
return out.join("\n");
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// What a report consumer needs to decide: did the app crash, or did something else take it down?
|
|
114
|
+
export function attributeRunCrash({ since, bundleId, simulatorUdid, dir } = {}) {
|
|
115
|
+
const reports = findCrashReports({ since, bundleId, simulatorUdid, dir });
|
|
116
|
+
const verdict = reports.app.length
|
|
117
|
+
? "app"
|
|
118
|
+
: reports.simulatorSystem.length
|
|
119
|
+
? "simulator-system"
|
|
120
|
+
: reports.other.some((r) => r.kind === "test-runner")
|
|
121
|
+
? "test-runner"
|
|
122
|
+
: "no-report";
|
|
123
|
+
return { schemaVersion: 1, since: Number.isFinite(since) ? new Date(since).toISOString() : null, bundleId: bundleId || null, simulatorUdid: simulatorUdid || null, verdict, reports };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function writeAttribution(captureDir, attribution) {
|
|
127
|
+
fs.writeFileSync(path.join(captureDir, ATTRIBUTION_FILE), JSON.stringify(attribution, null, 2));
|
|
128
|
+
return path.join(captureDir, ATTRIBUTION_FILE);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function readAttribution(captureDir) {
|
|
132
|
+
try { return JSON.parse(fs.readFileSync(path.join(captureDir, ATTRIBUTION_FILE), "utf8")); } catch { return null; }
|
|
133
|
+
}
|
package/mcp-server/src/report.js
CHANGED
|
@@ -150,9 +150,55 @@ export function observationSummary(report) {
|
|
|
150
150
|
|
|
151
151
|
// Turn a capture's OCQA markers into a scoreless observation with deduped findings and an
|
|
152
152
|
// explicit coverage floor. Release judgment is applied later by evaluateGate.
|
|
153
|
+
function readCrashAttribution(captureDir) {
|
|
154
|
+
try {
|
|
155
|
+
const parsed = JSON.parse(fs.readFileSync(path.join(captureDir, "crash-attribution.json"), "utf8"));
|
|
156
|
+
return parsed && typeof parsed === "object" && typeof parsed.verdict === "string" ? parsed : null;
|
|
157
|
+
} catch {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// The harness observes that the app stopped running; the crash reports say whose fault it was.
|
|
163
|
+
// A simulator system process (SpringBoard) dying takes the app with it, and the XCUITest runner
|
|
164
|
+
// dying is instrumentation failure — neither is a defect in the app under test, and reporting
|
|
165
|
+
// either as a critical app crash is the false CRITICAL the desktop app fixed in 0.16 (issue #30).
|
|
166
|
+
// With no report in the run window the harness observation stands, unverified and said so.
|
|
167
|
+
export function reattributeCrashes(findings, attribution) {
|
|
168
|
+
for (const f of findings) {
|
|
169
|
+
if (f.type !== "crash") continue;
|
|
170
|
+
const r = attribution.reports || {};
|
|
171
|
+
if (attribution.verdict === "app") {
|
|
172
|
+
const report = r.app?.[0];
|
|
173
|
+
if (report) {
|
|
174
|
+
f.crashReport = report.path;
|
|
175
|
+
if (report.exceptionType) f.title = `${f.title} (${report.exceptionType})`;
|
|
176
|
+
}
|
|
177
|
+
} else if (attribution.verdict === "simulator-system") {
|
|
178
|
+
const report = r.simulatorSystem?.[0] || {};
|
|
179
|
+
f.type = "simulator_system_crash";
|
|
180
|
+
f.category = "environment";
|
|
181
|
+
f.severity = "medium";
|
|
182
|
+
f.authority = "advisory";
|
|
183
|
+
f.crashReport = report.path || null;
|
|
184
|
+
f.title = `Simulator system process ${report.procName || "(unknown)"} crashed${report.exceptionType ? ` (${report.exceptionType})` : ""} and took the app with it — not attributed to the app under test`;
|
|
185
|
+
} else if (attribution.verdict === "test-runner") {
|
|
186
|
+
f.type = "test_runner_crash";
|
|
187
|
+
f.category = "environment";
|
|
188
|
+
f.severity = "medium";
|
|
189
|
+
f.authority = "advisory";
|
|
190
|
+
f.title = "The XCUITest runner died mid-run (instrumentation failure) — the app under test is not known to have crashed";
|
|
191
|
+
} else {
|
|
192
|
+
f.attributionNote = "no crash report was found for this run window; the harness observation stands unverified";
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return findings;
|
|
196
|
+
}
|
|
197
|
+
|
|
153
198
|
export function buildQaReport(markersFilePath, { platform = "ios", target = null } = {}) {
|
|
154
199
|
const base = parseOcqaMarkers(markersFilePath);
|
|
155
200
|
if (!base) return null;
|
|
201
|
+
const crashAttribution = platform === "ios" ? readCrashAttribution(path.dirname(markersFilePath)) : null;
|
|
156
202
|
|
|
157
203
|
const raw = fs.readFileSync(markersFilePath, "utf8");
|
|
158
204
|
const rawIssues = [];
|
|
@@ -264,6 +310,7 @@ export function buildQaReport(markersFilePath, { platform = "ios", target = null
|
|
|
264
310
|
...(platform === "web" ? { evaluationTier: findingEvaluationTier(i, platform) } : {}),
|
|
265
311
|
});
|
|
266
312
|
}
|
|
313
|
+
if (crashAttribution) reattributeCrashes(findings, crashAttribution);
|
|
267
314
|
findings.sort((a, b) => severityRank(a.severity) - severityRank(b.severity));
|
|
268
315
|
|
|
269
316
|
const screensExplored = screens.size || base.uniqueScreens.length;
|
|
@@ -278,9 +325,9 @@ export function buildQaReport(markersFilePath, { platform = "ios", target = null
|
|
|
278
325
|
const high = findings.filter((f) => f.severity === "high").length;
|
|
279
326
|
const med = findings.filter((f) => f.severity === "medium").length;
|
|
280
327
|
const low = findings.filter((f) => f.severity === "low").length;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
328
|
+
// Advisory-authority findings (an environment event re-attributed away from the app) are
|
|
329
|
+
// reported but never counted toward the gate's deterministic tally.
|
|
330
|
+
const verdictFindings = findings.filter((finding) => finding.authority !== "advisory" && (platform !== "web" || finding.evaluationTier !== "sampled"));
|
|
284
331
|
const verdictCrit = verdictFindings.filter((f) => f.severity === "critical").length;
|
|
285
332
|
const verdictHigh = verdictFindings.filter((f) => f.severity === "high").length;
|
|
286
333
|
const verdictMed = verdictFindings.filter((f) => f.severity === "medium").length;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
155
|
-
|
|
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
|
-
|
|
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) =>
|
|
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
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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,
|
|
1313
|
-
|
|
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
|
-
|
|
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.
|
|
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",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"docs/application-model.md",
|
|
25
25
|
"docs/scenarios.md",
|
|
26
26
|
"mcp-server/src/",
|
|
27
|
+
"scripts/attribute-ios-crash.js",
|
|
27
28
|
"scripts/ci-gate.sh",
|
|
28
29
|
"scripts/compile-contract.js",
|
|
29
30
|
"scripts/compile-flow.js",
|
|
@@ -89,7 +90,7 @@
|
|
|
89
90
|
"mobile"
|
|
90
91
|
],
|
|
91
92
|
"scripts": {
|
|
92
|
-
"test": "node --test tests/report.test.js tests/regression.test.js tests/engine.test.js tests/project-config.test.js tests/application-model.test.js tests/ui-map.test.js tests/focused-navigation.test.js tests/task-runtime.test.js tests/release-contract.test.js tests/pr-selection.test.js tests/flow-runtime.test.js tests/web-explorer.test.js tests/web-session.test.js tests/web-link-audit.test.js tests/web-audit.test.js tests/capture-provenance.test.js tests/web-flow.test.js tests/scenario-runtime.test.js tests/android-driver.test.js tests/android-explorer.test.js tests/android-flow.test.js tests/android-primitives-protocol.test.js tests/managed-web.test.js tests/product-operations.test.js tests/browser-product.test.js tests/browser-onboarding.test.js tests/managed-operation.test.js tests/cloud-runner.test.js tests/ci-setup.test.js tests/ci-install.test.js tests/cli.test.js tests/mcp-workspace.test.js tests/action.test.js tests/package-surface.test.js tests/agent-surface.test.js tests/presentation-contract.test.js tests/landing-brand.test.js tests/ci-gate.test.js tests/ci-report.test.js tests/desktop-protocol.test.js tests/ios-flow-protocol.test.js tests/feedback-triage-0919.test.js vscode-extension/test/bridge.test.js",
|
|
93
|
+
"test": "node --test tests/report.test.js tests/regression.test.js tests/engine.test.js tests/project-config.test.js tests/application-model.test.js tests/ui-map.test.js tests/focused-navigation.test.js tests/task-runtime.test.js tests/release-contract.test.js tests/pr-selection.test.js tests/flow-runtime.test.js tests/web-explorer.test.js tests/web-session.test.js tests/web-link-audit.test.js tests/web-audit.test.js tests/capture-provenance.test.js tests/ios-crash-attribution.test.js tests/web-flow.test.js tests/scenario-runtime.test.js tests/android-driver.test.js tests/android-explorer.test.js tests/android-flow.test.js tests/android-primitives-protocol.test.js tests/managed-web.test.js tests/product-operations.test.js tests/browser-product.test.js tests/browser-onboarding.test.js tests/managed-operation.test.js tests/cloud-runner.test.js tests/ci-setup.test.js tests/ci-install.test.js tests/cli.test.js tests/mcp-workspace.test.js tests/action.test.js tests/package-surface.test.js tests/agent-surface.test.js tests/presentation-contract.test.js tests/landing-brand.test.js tests/ci-gate.test.js tests/ci-report.test.js tests/desktop-protocol.test.js tests/ios-flow-protocol.test.js tests/feedback-triage-0919.test.js vscode-extension/test/bridge.test.js",
|
|
93
94
|
"test:browser-journey": "node --test tests/browser-journey.test.js",
|
|
94
95
|
"test:browser-native": "TAPP_RUN_NATIVE_BROWSER=1 node --test tests/browser-native-journey.test.js"
|
|
95
96
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Called by quick-capture.sh after an iOS run whose markers contain a crash: decide from the real
|
|
3
|
+
// crash reports whether the app under test crashed or a simulator system process took it down,
|
|
4
|
+
// write crash-attribution.json into the capture, and print one line for the terminal.
|
|
5
|
+
//
|
|
6
|
+
// node scripts/attribute-ios-crash.js <capture-dir> <bundle-id> <simulator-udid> <run-start-epoch-seconds>
|
|
7
|
+
import path from "path";
|
|
8
|
+
import { fileURLToPath } from "url";
|
|
9
|
+
import { attributeRunCrash, writeAttribution } from "../mcp-server/src/ios-crash-attribution.js";
|
|
10
|
+
|
|
11
|
+
const [captureDir, bundleId, simulatorUdid, startSeconds] = process.argv.slice(2);
|
|
12
|
+
if (!captureDir || !bundleId) {
|
|
13
|
+
console.error(`usage: ${path.basename(fileURLToPath(import.meta.url))} <capture-dir> <bundle-id> [simulator-udid] [run-start-epoch-seconds]`);
|
|
14
|
+
process.exit(2);
|
|
15
|
+
}
|
|
16
|
+
// Reports can be written a few seconds after the process dies; look back a little before the run
|
|
17
|
+
// started so a crash at launch is not missed, and never miss one written after we checked.
|
|
18
|
+
const since = Number(startSeconds) > 0 ? Number(startSeconds) * 1000 - 15_000 : Date.now() - 3_600_000;
|
|
19
|
+
const attribution = attributeRunCrash({ since, bundleId, simulatorUdid: simulatorUdid || undefined });
|
|
20
|
+
writeAttribution(path.resolve(captureDir), attribution);
|
|
21
|
+
const r = attribution.reports;
|
|
22
|
+
const line = attribution.verdict === "app"
|
|
23
|
+
? `Crash attribution: ${bundleId} crashed (${r.app[0].exceptionType || "see report"}) — ${r.app[0].path}`
|
|
24
|
+
: attribution.verdict === "simulator-system"
|
|
25
|
+
? `Crash attribution: simulator system process ${r.simulatorSystem[0].procName} crashed (${r.simulatorSystem[0].exceptionType || "see report"}) and took the app with it — NOT attributed to ${bundleId}; ${r.simulatorSystem[0].path}`
|
|
26
|
+
: attribution.verdict === "test-runner"
|
|
27
|
+
? `Crash attribution: the XCUITest runner died (instrumentation failure, not ${bundleId})`
|
|
28
|
+
: `Crash attribution: no crash report found for this run window; the harness observation stands unverified`;
|
|
29
|
+
console.log(line);
|
package/scripts/quick-capture.sh
CHANGED
|
@@ -241,6 +241,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
241
241
|
done
|
|
242
242
|
|
|
243
243
|
UDID=$(get_booted_sim)
|
|
244
|
+
RUN_START_TS=$(date +%s)
|
|
244
245
|
SIM_NAME=$(get_sim_name)
|
|
245
246
|
|
|
246
247
|
if [[ -z "$UDID" ]]; then
|
|
@@ -401,6 +402,12 @@ OCQA_COMPLETE:{\"actions\":0,\"states\":0,\"issues\":1,\"screens\":\"\",\"outcom
|
|
|
401
402
|
fi
|
|
402
403
|
echo "$OUTPUT" > "$CAPTURE_DIR/full-output.txt"
|
|
403
404
|
|
|
405
|
+
# A harness "crash" means the app stopped running; it does not say why. Cross-check the real
|
|
406
|
+
# crash reports so a SpringBoard death is not written up as the app's bug (issue #30).
|
|
407
|
+
if grep -q '"type":"crash"' "$CAPTURE_DIR/ocqa-markers.txt" 2>/dev/null; then
|
|
408
|
+
node "$PROJECT_ROOT/scripts/attribute-ios-crash.js" "$CAPTURE_DIR" "$APP_BUNDLE" "$UDID" "$RUN_START_TS" || true
|
|
409
|
+
fi
|
|
410
|
+
|
|
404
411
|
COMPLETE_LINE=$(grep "OCQA_COMPLETE" "$CAPTURE_DIR/ocqa-markers.txt" | tail -1 || true)
|
|
405
412
|
if [[ -n "$COMPLETE_LINE" ]]; then
|
|
406
413
|
echo ""
|
package/skills/tapp/SKILL.md
CHANGED
|
@@ -97,6 +97,16 @@ ids or visible labels, check `hittable`, tap a field before typing, and wait for
|
|
|
97
97
|
content. Use coordinates only as a last resort. End the session when finished.
|
|
98
98
|
|
|
99
99
|
Do not edit the app merely because testing found a defect unless the user also asked for a fix. State what the evidence proves and what remains untested.
|
|
100
|
-
|
|
100
|
+
|
|
101
|
+
## File feedback on tapp itself — don't just work around it
|
|
102
|
+
|
|
103
|
+
A rough edge in Tapp (not the app under test) deserves its own report, filed the moment you
|
|
104
|
+
notice — not after you've already found a workaround and moved on. Draft with `tapp_feedback` or
|
|
105
|
+
`npx -y @aarwitz/tapp@latest feedback "title"` (draft only; `submit:true` needs the user's OK, it's
|
|
106
|
+
public) whenever: documented/expected behavior doesn't match reality; the underlying platform
|
|
107
|
+
tooling (simulator/emulator/browser) crashes or hangs, not the app under test; you had to invent a
|
|
108
|
+
workaround to finish a straightforward task; a result reported `ok`/`inconclusive` but clearly
|
|
109
|
+
shouldn't have; or you're unsure whether something is a real app finding or a Tapp bug. One report
|
|
110
|
+
per issue; when unsure, file — a closed non-issue costs nothing, an unreported bug stays a bug.
|
|
101
111
|
|
|
102
112
|
Read [references/commands.md](references/commands.md) only for exact CLI/MCP syntax, Flow replay, credentials, or platform prerequisites.
|