mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-20 05:42:19 +03:00
tests/unit/9147-catalog-eventloop-yield.test.ts exists to prove the /v1/models builder yields to the event loop while assembling a catalog-scale dataset. It asserts res.status === 200 first, and only then the two checks that carry the invariant: the max event-loop gap and the traversal to the last seeded model. The case did not set CATALOG_BUILD_TIMEOUT_MS, so it inherited production's 8s cold-path budget. When the seeded build overruns that on a loaded runner, getUnifiedModelsResponse answers 503 catalog_build_timeout and the status check fails BEFORE either real assertion runs — the guard goes silently dead exactly when the machine is under the load that would make a pin most visible. CI hit it at 8350ms, right at the bound. Measured on the release tip, pristine file, 3 runs at load ~21: 2 pass with max gaps of 247ms and 180ms, 1 fails with 503 !== 200 — roughly a 1-in-3 flake, and the flake has nothing to do with yielding. Pinning a 120s budget lets the invariant be evaluated. The 800ms gap bound is untouched, and with the budget pinned the builder measures 261ms (idle) to 790ms (loaded) against it — still failing a true pin, which is seconds. Build-latency budgeting is a separate concern from this case. Refs #12732