Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: keep Socket.IO long-polls out of the live audit's content gate and document every finding code (#13101)

Adam Eivy7cebb61b347f
diff --git a/scripts/perf/README.md b/scripts/perf/README.md
index 42b471404d..203a12ad0c 100644
--- a/scripts/perf/README.md
+++ b/scripts/perf/README.md
@@ -208,7 +208,7 @@ Chromium executable. Phases:
- `cold` — fresh browser context, cache disabled, full load of `--route`.
`usefulContentMs` ends when the route's collection response has finished, no
loading skeleton (`role=status aria-busy=true`) remains, and no HTTP request
- is in flight; then a two-second tail catches eager follow-ups.
+ other than Socket.IO polling (held open by design) is in flight; then a two-second tail catches eager follow-ups.
- `sibling` — in-app navigation (a visible link, else the data router via
history) to `--sibling`, with the same completed-data rule. Refetching the
route's collection here is a finding.
@@ -218,10 +218,15 @@ Chromium executable. Phases:
Per phase and endpoint pattern the report holds requests, completion, failure,
cancellation, HTTP errors, duplicates, overlapping duplicates, encoded/decoded
bytes and WebSocket frames/payload bytes, plus phase `totals`, `inFlight`
-requests at the end and `blocked` requests. Findings: `http-error`,
-`request-failed`, `overlapping-duplicate-request`, `sibling-collection-refetch`,
-`blocked-foreign-origin`, `blocked-mutation`, `in-flight-at-end` and
-`browser-stage-<phase>`. Exit 0 = measured with no findings, 1 = findings or a
+requests at the end and `blocked` requests. Findings:
+
+- traffic: `http-error`, `request-failed`, `overlapping-duplicate-request`,
+ `sibling-collection-refetch`, `blocked-foreign-origin`, `blocked-mutation`,
+ `in-flight-at-end` (Socket.IO polling excluded), and `collection-http-status` (the route's collection
+ response was not 2xx);
+- runner: `browser-stage-<phase>` (a measurement stage broke), `browser-setup`
+ (the context or page could not be prepared), `context-cleanup` and `cleanup`
+ (the context or browser did not close). Exit 0 = measured with no findings, 1 = findings or a
failed stage, 2 = UNVERIFIED.
### Transport and authority
diff --git a/scripts/perf/liveBrowserAudit.mjs b/scripts/perf/liveBrowserAudit.mjs
index 2ae6bace1e..c5e566570b 100644
--- a/scripts/perf/liveBrowserAudit.mjs
+++ b/scripts/perf/liveBrowserAudit.mjs
@@ -29,11 +29,15 @@ const settled = () => document.getElementById('main-content') !== null
// Useful content also requires no HTTP request still in flight (route chunks,
// API reads, media): right after an in-app navigation the previous page's
// settled DOM is still mounted, so the DOM check alone would pass early.
+// Socket.IO polling is excluded: an engine.io long-poll is held open by design
+// (it is transport, not page content) and would otherwise stall the gate
+// whenever the websocket upgrade is slow. Its bytes are still accounted.
async function waitForUsefulContent(page, traffic, signal) {
const deadline = performance.now() + STAGE_TIMEOUT_MS;
await page.evaluate(() => new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve))));
for (;;) {
- if (traffic.pending() === 0 && await page.evaluate(settled)) return;
+ const contentPending = Object.keys(traffic.pendingByEndpoint()).some(endpoint => endpoint !== '/socket.io/');
+ if (!contentPending && await page.evaluate(settled)) return;
if (performance.now() > deadline) throw new Error('useful content not reached');
await delay(50, undefined, { signal });
}
diff --git a/scripts/perf/liveTraffic.js b/scripts/perf/liveTraffic.js
index 549292ed5b..5f2db0024c 100644
--- a/scripts/perf/liveTraffic.js
+++ b/scripts/perf/liveTraffic.js
@@ -167,7 +167,11 @@ export function liveFindings({ phases, inFlight, blocked, collectionEndpoint })
}
}
for (const { phase, endpoint, reason, count } of blocked) findings.push({ phase, endpoint, reason: 'blocked-' + reason, count });
- for (const [endpoint, count] of Object.entries(inFlight)) findings.push({ phase: 'end', endpoint, reason: 'in-flight-at-end', count });
+ // An open engine.io long-poll is the transport waiting by design; it stays in
+ // the report's inFlight rows but is not a defect.
+ for (const [endpoint, count] of Object.entries(inFlight)) {
+ if (endpoint !== '/socket.io/') findings.push({ phase: 'end', endpoint, reason: 'in-flight-at-end', count });
+ }
return findings;
}
diff --git a/scripts/perf/liveTraffic.test.js b/scripts/perf/liveTraffic.test.js
index f00828e116..53605fc24a 100644
--- a/scripts/perf/liveTraffic.test.js
+++ b/scripts/perf/liveTraffic.test.js
@@ -69,7 +69,7 @@ describe('live audit redaction', () => {
sibling: { '/api/image-gen/gallery': row({ requests: 1, httpErrors: 1 }) },
},
blocked: [{ phase: 'cold', reason: 'foreign-origin', endpoint: ':foreign-origin', count: 1 }],
- inFlight: { '/api/settings': 1 },
+ inFlight: { '/api/settings': 1, '/socket.io/': 1 },
collectionEndpoint: '/api/image-gen/gallery',
});
expect(findings.map(f => `${f.phase} ${f.reason}`)).toEqual(['sibling http-error', 'sibling sibling-collection-refetch',