chenglou/pretext · error · Error
Missing pre-wrap result for ${testCase.label}
Error message
Missing pre-wrap result for ${testCase.label} What it means
Thrown by the permanent pre-wrap oracle checker after a browser batch reports status:'ready' but a PRE_WRAP_ORACLE_CASES label is absent from the posted results. The script builds a Map<label, report> from the batch and requires every oracle case to be present. Unlike symbol-check.ts and keep-all-check.ts, this loop has no caseRunsInBrowser guard, so it expects every case for every browser unconditionally.
Source
Thrown at scripts/pre-wrap-check.ts:138
`&reportEndpoint=${encodeURIComponent(reportServer.endpoint)}`
const batchReport = await loadPostedReport(
session,
url,
() => reportServer.waitForReport(null),
requestId,
reportBrowser,
timeoutMs,
)
if (batchReport.status === 'error') {
throw new Error(batchReport.message ?? 'pre-wrap batch failed')
}
const batchResults = batchReport.results ?? []
const reportsByLabel = new Map(batchResults.map(result => [result.label, result.report]))
for (const testCase of PRE_WRAP_ORACLE_CASES) {
const report = reportsByLabel.get(testCase.label)
if (report === undefined) {
throw new Error(`Missing pre-wrap result for ${testCase.label}`)
}
printCaseResult(browser, testCase, report)
if (!reportIsExact(report)) ok = false
}
} finally {
reportServer.close()
}
} finally {
session?.close()
serverProcess?.kill()
lock.release()
}
return ok
}
const port = await getAvailablePort(requestedPort === 0 ? null : requestedPort)
let overallOk = trueView on GitHub (pinned to ac49b09b7d)
Solutions
- Restart bun start / the page server so pages/probe.ts bundle matches the current PRE_WRAP_ORACLE_CASES labels.
- Confirm no PRE_WRAP_ORACLE_CASES entry gained a browsers: restriction; if one did, port the caseRunsInBrowser guard from symbol-check.ts:116,157 into pre-wrap-check.ts.
- Re-run the checker (single-owner browser lock + side-channel POST can drop a report intermittently); if it reproduces, log batchResults to see which labels arrived.
- Diff PRE_WRAP_ORACLE_CASES between the script import and the served page bundle (both import ../src/test-data.ts; verify the resolved file matches).
Example fix
// before (pre-wrap-check.ts:135)
for (const testCase of PRE_WRAP_ORACLE_CASES) {
const report = reportsByLabel.get(testCase.label)
if (report === undefined) throw new Error(`Missing pre-wrap result for ${testCase.label}`)
// after
function caseRunsInBrowser(c: ProbeOracleCase, b: AutomationBrowserKind): boolean {
return c.browsers === undefined || c.browsers.includes(b)
}
for (const testCase of PRE_WRAP_ORACLE_CASES) {
if (!caseRunsInBrowser(testCase, browser)) continue
const report = reportsByLabel.get(testCase.label)
if (report === undefined) throw new Error(`Missing pre-wrap result for ${testCase.label}`) Defensive patterns
Strategy: validation
Validate before calling
// After building reportsByLabel, assert the page returned every case that should run in this browser.
const expected = PRE_WRAP_ORACLE_CASES.filter(c => c.browsers === undefined || c.browsers.includes(browser))
const missing = expected.filter(c => !reportsByLabel.has(c.label)).map(c => c.label)
if (missing.length > 0) {
console.error('pre-wrap-check: page omitted labels (restart page server):', missing)
process.exit(2)
} Type guard
const caseRunsInBrowser = (c: ProbeOracleCase, b: AutomationBrowserKind): boolean => c.browsers === undefined || c.browsers.includes(b) const hasLabel = (m: Map<string, ProbeReport>, t: ProbeOracleCase): boolean => m.has(t.label)
Prevention
- Share one caseRunsInBrowser helper across all *-check.ts scripts so the script-side filter always matches the page-side caseRunsInCurrentBrowser filter.
- Never add a browsers: field to a PRE_WRAP_ORACLE_CASES entry without mirroring the guard in pre-wrap-check.ts.
- Restart bun start after editing any oracle cases in src/test-data.ts so the served pages/probe.ts bundle matches.
- Treat a sudden 'Missing pre-wrap result' as a stale-bundle signal first; re-run before suspecting the engine.
When it happens
Trigger: Run pre-wrap-check when the /probe?batch=pre-wrap page posts {status:'ready', results:[...]} with fewer entries than PRE_WRAP_ORACLE_CASES.length. Concrete causes: a case label edited in src/test-data.ts while the served page bundle is stale (HMR/dist drift); the page's runProbeBatch skipped a case; or a future browser-restricted pre-wrap case is added (no guard exists to skip it script-side).
Common situations: Editing PRE_WRAP_ORACLE_CASES while bun start is serving an old bundle; running the checker against a stale --port page server; adding a browsers:[...] field to a pre-wrap case (page filters it, script still requires it).
Related errors
- symbol batch failed
- Firefox is not currently supported for symbol oracle checks
- Timed out waiting for local port ${port}
- Timed out waiting for ${browser} automation lock
- ${session.message ?? session.error}
AI-assisted analysis of chenglou/pretext@ac49b09b7d (2026-08-12).
Data as JSON: /api/errors/5324dff3b4a4edbd.
Report an issue: GitHub.