Repository navigation
Description
Context
The hosted unit (8) candidate job for #4102 timed out the case emitted declaration graph > no public .d.ts references an optional backend package in packages/ui-server/tests/declaration-surface.test.ts. Run 44023500617, job 133838750834, head fbac565eb, records 30,789.49 ms against the unchanged 30,000 ms deadline, followed by 1,131 passes and one failure in that worker. There was no optional-backend assertion failure. Concurrent worker/memory observations are context, not attribution of that historical slowdown to memory pressure.
Current source at d974052166f335cbf57b385fddc13875da1b98de creates one TypeScript program and declaration emit (emitDeclarations, packages/ui-server/tests/declaration-surface.test.ts:33-55) and calls it from exactly one test (:58-69). The second case walks source ASTs. Building the declarations once per file is already what this code does; that suggestion does not establish an optimization.
Controlled reproduction — 2026-11-17
An isolated archive of that main, Linux x64, actual Bun 1.4.2 (744846f84) and TypeScript 6.0.3 used a successful independent --force --frozen-lockfile --backend=copyfile install with an empty private cache (1,027 packages). Test/build-config/lockfile bytes matched the pinned commit. The normal test wrapper and offline preload stayed enabled, and no assertion, source or deadline was changed.
- Unloaded
bun run test packages/ui-server/tests/declaration-surface.test.ts: 2 pass, 0 fail, 4 assertions, 9.69 s total; declaration case 9,183.15 ms. - Bounded CPU control, through host admission: one allowed CPU, one owned CPU burner, and two requested repetitions through the delivered gate:
node scripts/host-admission.mjs run -- taskset -c 0 bun scripts/test-determinism.ts \
packages/ui-server/tests/declaration-surface.test.ts \
--repetitions 2 --burners 1 --report /tmp/declaration-load.json --jsonThe first repetition fails the same named case at 35,066.43 ms, explicitly this test timed out after 30000ms; exit 1, with the file and repetition identified in the structured report. It bails on that failure, so it does not claim two completed repetitions. The owned burner and test process are absent after settlement. This reproduces the timeout under controlled CPU contention; it does not reproduce the original hosted worker mix or prove that job's historical cause. An earlier missing-TypeScript bootstrap did not reach assertions and is not counted as reproduction evidence.
The reviewed weight is 20.736 s (scripts/test-shard-costs.json). The isolated pass and controlled failure are separate receipts, not a repair or a passing retry.
Scope
Profile declaration preparation/emission and relevant concurrent load, then make the existing optional-backend declaration proof complete reliably within its existing timeout under a justified hosted-like load. Reduce unnecessary compiler work or resource contention only where evidence supports it; preserve the emitted graph and the separate source-specifier check.
Out of scope
- Raising the deadline to absorb contention, retries, skips, weakening the scan or making an optional backend mandatory.
- Replacing real declaration emission with source spelling, stale built declarations or a predicate-only surrogate.
- Production API/exports/dependency changes, a generic test framework, or attribution of the original job from a passing control alone.
Acceptance criteria
- Retain real successful, nonempty declaration emission from the package build config and scan every emitted
.d.tsfor both optional backend specifiers. Retain the separate source-AST assertion. - Record the measured compiler/load boundary and a scoped repair; the actual declaration case fails on the pre-change source and completes below the unchanged deadline after repair under the same justified conditions.
- Re-run the bounded diagnostic and representative unit-worker load, reporting the actual source, runtime, CPU/load and selected cases. Do not present the one-CPU stressor as an exact replay of the original hosted job.
- Prove the guard remains meaningful: an optional-backend reference escaping into a real public declaration fails the intended assertion, restored afterward. Empty emission or an omitted scan must not pass.
- Keep normal offline/preparation/host-admission rules, source/config identities and cleanup. Refresh a reviewed cost only from measured evidence.
Verification
Use the normal bun run test wrapper, focused failing-first/restored-mutation receipts and applicable hosted unit proof under the current CI policy. Compare equal source/runtime/load conditions for any timing claim. The existing test has a runtime and must actually execute.
Contract impact
None for a test-only repair. A change to shipped public declarations is outside this brief.
2026-11-17 triage: completed the brief and recorded a real failing runtime control. No unresolved design, policy, access or reproduction prerequisite remains for the scoped implementation. Preserve the explicitly filed p3 ranking and no milestone; the issue remains standalone because the open package-boundary/oracle/browser epics do not own test-cost repair, and #736 is at its direct-child limit. Closed #1849 is not reopened.
Activity
[-]test(ui-server): declaration-surface's emitted declaration graph times out on a loaded unit shard[/-][+]ui-server: declaration emission exceeds the test timeout under CPU load[/+]schlessera commentedon Nov 17, 2026
This failure is tracked by red-main incident #4186 (main red at
215887542f2e). Please add evidence there.schlessera commentedon Nov 17, 2026
Claimed for implementation. Claim token:
claim-d2e53957. Branch:fix/4142-declaration-emit-nocheck.Claimed as the fix for red-main incident #4186. Collisions: none checked yet beyond the incident record.
test(ui-server): emit the declaration graph without the body check (#…
schlessera commentedon Nov 17, 2026
Delivered in #4187 (squash e982c1c). The declaration emit passes
noCheck: true: TypeScript's real declaration emit from the build config, without the full body check thatbun run typecheckowns. Emit went from 9.5 s to 2.0 s unloaded. Under the bounded one-CPU-plus-burner diagnostic, the case failed at 45.2 s before and takes 13.6 s after, against the unchanged 30 s deadline. The same 414 files are emitted, with the same import specifiers in each. The leak mutation and the empty-emission mutation both still fail. This was the fix for red-main incident #4186, and main run 44107659969 cleared it. The weight inscripts/test-shard-costs.jsonis left for CI's measured refresh.