Skip to content

The lynx-table stage harnesses have no CI coverage, and two instruments rotted unnoticed #255

Closed

Description

@Huxpro

Filed by an agent while working #247's bucket-4 slice (#254). Not a request for that PR — it is a standing risk to every campaign that reads from benchmarks/lynx-table/stages/.

What happened

Two instruments in that directory had stopped working, and nothing anywhere went red.

  1. stages/mts-profile.mjs refused every run. It identified the profiled main-thread script by patching URL.createObjectURL and keeping what the page minted. That list came back holding one blob URL that was not the one the profiled frames ran from, so every invocation died on produced no main-thread script frames; the profile named none. Fixed in test(bench): split the FCP remainder into phases, and repair the profiler that names its functions #254 by reading the URL from the about:srcdoc realm's own <script src="blob:…">.

  2. applier walk read 0.0 ms in that instrument's output while its two functions, visit and pushChildren, sat in unmatched at 93.5 and 18.0 ms — the two largest unnamed frames in the run. The probe was physicalParent, taken from a visit that destructured its frame at the top; a dense-span fast path added ahead of that destructuring pushed the probe past the 160-character match window. Fixed in test(bench): split the FCP remainder into phases, and repair the profiler that names its functions #254 with one probe per function.

The second one is the more instructive failure: the instrument ran, produced a complete-looking report, and simply attributed 111 ms to nobody. mts-profile-buckets.mjs anticipates exactly this — it reports unmatched rather than folding it away for this reason — but reporting it only helps a reader who is looking.

Why nothing caught it

  • No workflow references test:stages or bench:stages. grep -rn "test:stages" .github/workflows/ returns nothing.
  • pnpm test runs one root Vitest invocation per project in vitest.config.js and does not fan out to package test scripts, so benchmarks/lynx-table's node:test suite is never invoked by it either.
  • The suite itself is healthy — 186 tests across 18 files, all passing — and it is entirely pure-function tests over fold logic, probe tables and report rendering. Nothing runs an instrument end to end.

So the pure half is well covered and never runs in CI, and the half that talks to a browser is not covered at all.

Suggested shape

Two separate things, and the first is worth doing even alone:

  1. Run the existing suite in CI. cd benchmarks/lynx-table && node --test stages/*.test.mjs takes 3.5 s. It would have caught neither defect above, but it is the cheapest possible guard against the probe tables and report code drifting, and it is currently zero.

  2. A smoke that actually drives an instrument. The class of defect above is only visible end to end: one profiled sample at a small row count, asserting that the run names a non-zero share of the script and that unmatched is below some ceiling. Two of the stage tests already launch Chromium (dom-attach-report.test.mjs, production-ab.test.mjs), so the pattern exists. The cost is a build plus a page load, which is why this is a separate decision from (1) — it may belong in a scheduled job rather than on every PR.

An unmatched ceiling is the specific assertion that turns a silent probe drift into a failure. A ceiling of, say, 20% of the named total would have failed at 41.4%, which is what the drifted table produced.

Not claimed

Whether any earlier record was affected. For the probe drift it was checked and it was not: the pre-drift record stages/results/mts-profile-10000.md (2026-08-25) reads applier walk at 113.7 ms, and the repaired probe reads 111.2 ms on current code, so the drift is newer than that record. The other checked-in records in that directory were not audited.

Activity

  1. Huxpro commented on Aug 31, 2026

    @Huxpro
    OwnerAuthor

    A third rotted instrument, and one thing here that is not rot

    Found while adding a teardown cell to stages/run.mjs (PR #266). Two findings, and they have different causes — worth separating, because the fix for one says nothing about the other.

    1. stages/run.mjs cannot run at all, and has not been able to for some time

    It dies in its own build preflight before it opens a browser:

    Error: profile bundle omitted stage profiling marker firstScreenPrepareMs.
        at buildVariants (benchmarks/lynx-table/stages/run.mjs:131:10)
    

    Reproduced on pristine new-lynx (33d9358) with my diff stashed, so it predates the change I was making.

    The preflight requires the string firstScreenPrepareMs to survive into the profiled bundle. The only place instrument-source.mjs mentions that name is :41, inside the interface widening it injects into packages/lynx/src/core/profiling.ts — a TypeScript field, which erasure deletes. Nothing assigns it, so the marker can never appear and the preflight is unsatisfiable.

    It is not one field. Of the sixteen members that widening declares, nine are never assigned anywhere in packages/ or benchmarks/:

    declared assigned
    firstScreenPlanMs 3
    firstScreenCommandStageMs 1
    mtSliceEvalMs, mtSliceStartEpochMs, papiCreateMs, bgReplayMs, mtExpandMs 1–4
    firstScreenRenderMs 0
    firstScreenContainerMs 0
    firstScreenPrepareMs 0
    firstScreenApplyMs 0
    firstScreenPapiCreateMs 0
    firstScreenCaptureMs 0
    firstScreenCommands, firstScreenHosts, firstScreenLogicalIds 0

    They were assigned once. git log -S puts the hunks in 21f4dfb24 ("perf(lynx): compact first-screen component rows", upstream octanejs#765), which added both the declaration and, in the same file, the timer around prepareLynxHostBatch that wrote it. Today's instrument-source.mjs retains the declaration and not the timer.

    The second-order consequence is the one worth naming. analyzeFcpSample reads every one of those fields through observed(), which returns 0 for undefined rather than throwing. So if the preflight were ever relaxed instead of the instrumentation restored, the FCP stage split would report six of its nine stages as 0 ms, dump the whole cost into the residual, and look entirely well-formed doing it. The preflight is the only thing standing between this harness and a plausible wrong answer, which is a fair description of what this issue is about.

    Blast radius is bounded: analyzeFcpSample is imported only by stages/run.mjs and its own tests. papi-run.mjs and papi-analyze.mjs do not use it, so the #247/#254 bucket numbers taken through those are unaffected. instrumentLynxStageSources is shared — scripts/build-app.mjs calls it for every profiled build — but only for the type widening, which costs nothing when the timers are absent.

    I did not restore the six timers. Re-deriving where each one belongs in today's packages/lynx/src is real work with a real chance of putting a wrong number into a measurement instrument, and it deserves its own change with its own evidence rather than a side effect of a harness cell.

    2. Three checked-in records had drifted off the writer — and that one is not rot

    evidence.test.mjs was red on new-lynx: 201 of 202. c230-retention-10000.json was tab-indented, which the repository's own JSON Prettier override rejects too, so pnpm format:check was red with it; the two c252-* records differed from writeEvidenceJson in ways Prettier accepts. Fixed in #266 by rewriting all three through the writer, with content verified unchanged by a SHA-256 of each record's canonical JSON taken before and after in one process.

    But the cause is different from finding 1, and I do not think it belongs under this issue's thesis. Every one of the three arrived while the CI pool was stopped. lint_checks runs pnpm format:check on every PR and would have caught the first one immediately. Nothing rotted unnoticed here — the gate that exists simply never ran.

    What that says about the fix

    This issue asks for CI coverage of benchmarks/lynx-table/stages/, and finding 1 is the case for it: node --test benchmarks/lynx-table/stages/*.test.mjs is 209 green after #266 and is in no workflow, while bench.yml — the only workflow that touches benchmarks/ — runs on manual dispatch and a weekly cron, so a rot there could sit for a week even when the pool is healthy. ci.yml is where it belongs.

    Two things a coverage step would still not have caught, worth saying so the fix is not oversold. stages/run.mjs is a browser harness that no unit test drives, so its preflight would have stayed unsatisfiable regardless; what an oracle over instrument-source.mjs could assert is that every field the widening declares is assigned by some hunk in the same module, which is a cheap invariant and would have failed the moment those timers were dropped. And finding 2 needed no new coverage at all.

    I have not wired the CI step in #266. scripts/ci-workflow.test.mjs reads ci.yml and asserts on it, so the change is locally verifiable, but with the pool stopped I cannot see the step actually run, and a workflow edit whose only evidence is a local structural test seemed worth leaving to a change that owns it rather than smuggling into a harness PR.


    Generated by Claude Code

  2. Huxpro commented on Sep 6, 2026

    @Huxpro
    OwnerAuthor

    Resolved by #292 and #293.

    Evidence:

    The original two gaps are now both covered: the pure stage suite runs in CI, and end-to-end browser execution detects stale/missing attribution rather than emitting plausible zeroes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-authoredenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions