santifer/career-ops · warning
used s of its s budget ( %) — it is passing, but it is…
Error message
${name} used ${(elapsedMs / 1000).toFixed(1)}s of its ${(budgetMs / 1000).toFixed(0)}s budget (${Math.round((elapsedMs / budgetMs) * 100)}%) — it is passing, but it is close to being killed for time What it means
test-all.mjs tracks a per-script time budget; when a script exceeds SLOW_SCRIPT_WARN_FRACTION of its budget while still passing, the runner emits a warning naming the elapsed time, the budget, and the percentage. It is deliberately a warning, not a failure, because a loaded CI runner is a normal reason for slowness and failing the run would just create a new false-failure mode.
Solutions
- Check the warning on the machine it came from: if it is only slow there, accept it or raise that script's budgetMs entry in the budget table.
- Profile the flagged script locally (node --cpu-prof or time node script.mjs) to find accidental slowness (missing mocks, network calls, large fixtures).
- Reduce the script's work: split it, add faster fixtures, or skip network-dependent sections when offline.
- If the script's real work has legitimately grown, increase its budget so the warning threshold moves up with it.
Example fix
// before costlyNetworkCheck(); // live fetch inside a unit test script // after if (!process.env.CI_NETWORK) costlyNetworkCheck(); // skip slow path when offline
Defensive patterns
Strategy: fallback
Validate before calling
const elapsed = Date.now() - start; if (elapsed > budgetMs * 0.8) console.warn(`${name} nearing time budget: ${elapsed}ms/${budgetMs}ms`); Try / catch
// the runner itself never throws here; consumers should treat warn output as advisory const result = await runWithTimeout(script, budgetMs).catch(() => null); if (result === null) handleKill();
Prevention
- Give each slow-growing script an explicit budget entry and revisit it when the warning fires
- Profile scripts periodically instead of waiting for CI slowness
- Avoid live network calls in test scripts; mock or gate behind env flags
- Cache expensive fixtures between runs
When it happens
Trigger: A test script in test-all.mjs completes successfully (result !== null) but its elapsedMs exceeds budgetMs * SLOW_SCRIPT_WARN_FRACTION — e.g. a normally-fast script run on an overloaded machine or in a slow CI container.
Common situations: CI runners starved of CPU, first-run cold caches (npm install, Playwright browser download), parallel jobs competing for I/O, or a genuinely slow test that is approaching the point where the runner kills it for time.
Related errors
- apify: invalid timeoutMs
- Apify run did not finish within s
- archive render skipped — no Playwright browser in env
- Cannot import generate-pdf.mjs
- concurrent reservation test flaked
AI-assisted analysis of santifer/career-ops@e7abd431fc (2026-09-16).
Data as JSON: /api/errors/520112ada3d0f316.
Report an issue: GitHub.
Appendix: source
Thrown at test-all.mjs:595
const result = run(NODE, [join(scriptTmp, scriptFile), ...args], {
cwd: scriptTmp,
stdio: ['pipe', 'pipe', 'pipe'],
...(declared ? { timeout: timeoutMs } : {}),
});
const elapsedMs = Date.now() - startedAt;
// A budget a script can raise for itself is a place to hide in, unless
// something still notices it creeping. Nothing did: the reason
// tracker-writer-lock-tests.mjs was killed rather than flagged is that
// spending 29 of its 30 seconds looked exactly like spending 2 — the suite
// reported "runs OK" either way, right up to the run where it did not.
//
// So the ceiling is not the only signal any more. A script that eats most
// of its budget says so while it is still passing, which is the point at
// which someone can act. This is a WARNING rather than a failure on
// purpose: a loaded runner is a normal reason to be slow, and turning that
// into a red run would trade one false failure for another.
if (result !== null && elapsedMs > budgetMs * SLOW_SCRIPT_WARN_FRACTION) {
warn(`${name} used ${(elapsedMs / 1000).toFixed(1)}s of its ${(budgetMs / 1000).toFixed(0)}s budget `
+ `(${Math.round((elapsedMs / budgetMs) * 100)}%) — it is passing, but it is close to being killed for time`);
}
if (result !== null) {
pass(`${name} runs OK`);
} else if (allowFail && !crashedBeforeRunning(lastRunFailure())) {
warn(`${name} exited with error (expected without user data)`);
} else if (allowFail) {
// allowFail says "a non-zero exit is expected here", never "any outcome
// is fine". A script that dies with an uncaught exception did not run at
// all, and reporting that as the expected failure is how #3440 sat in
// main: cv-sync-check.mjs threw a ReferenceError at module scope, exited
// 1 like a missing cv.md, and the suite printed the reassuring warning
// for a script that never reached a single check.
fail(`${name} crashed before running — allowFail covers an expected exit, not an uncaught error${formatRunFailure()}`);
} else {
// Include the child's exit status and streams. Without them a CI-only
// failure arrives as a bare `<name> crashed`: no stack, no assertion
// text, no exit code, and nothing a reader can act on.View on GitHub (pinned to e7abd431fc)