Skip to content

Four test suites pass only in default file order, including the Lynx main/background listener-ID parity oracle #85

Open

Description

@Huxpro

Found by an adversarial audit of the #58 L0–L3 equivalence claims, while probing #64 for order-dependent drift. All four are pre-existing — each verified byte-identically on base 6079a6804 via git worktree. None is stack drift. Filed because one of them guards a parity contract the #58 roadmap depends on.

58 vitest invocations, logs retained. Base comparisons used a worktree with workspace node_modules symlinked in.

1. Lynx main/background listener-ID parity holds only for the first universal root

packages/lynx/tests/main-renderer.test.ts:352 asserts main.batch equals background.batch.

  • packages/octane/src/universal-core.ts:6602 allocates the background listener base from a module-scoped counter: private nextListener = NEXT_EVENT_ROOT++ * 1_000_000;, never reset per test.
  • packages/lynx/src/main-renderer.ts:1069 pins the main-thread first-screen attempt to the constant nextListener: 1_000_000.

Equality therefore depends on the background capture being the first root created in the module instance.

default order: 17 passed
--sequence.shuffle seeds 1,2,3,5,7,11,99: FAIL (background base 3000000 vs main 1000000)
seeds 13,42: pass

In a real app the main-thread first screen renders the single first root, so the seeds agree and there is no runtime bug. But the test does not actually pin the multi-root case — so any future drift in listener-ID parity between the direct and staged paths for a non-first root is unguarded. Given #65 introduced a second applier, that is the gap worth closing.

2. SSR attribute diagnostics — dev warning dedupe leaks across tests

packages/octane/tests/conformance/server-integration-attributes-wave4d.test.ts:57 and packages/octane/tests/conformance/_helpers/server-render-matrix.ts:295,300 require an exact diagnostic list per test, but the runtime dedupes dev warnings per message for the life of the module.

default order: 40 passed
seed 1: 6 failed    seed 3: 7 failed

Partly consumer-relevant: this documents that these dev diagnostics are once-per-process, so a consumer sees the warning only for the first offending element. That is presumably intended React parity — but it is never asserted anywhere, and this suite asserts the opposite per test and survives only by ordering.

3. Deferred hydration — "installs explicit event capture once"

packages/octane/tests/hydration/deferred-hydration-contract.test.ts:72 spies on document.addEventListener after initializeHydrationEventCapture may already have been made idempotent by an earlier test in the same module instance.

default order: 28 passed
seeds 1, 3: 1 failed | 27 passed

Also reproduces in full-project shuffled runs in both projects. The shipped behaviour (install once per document) is what makes the test fail — the defect is in the oracle, not the runtime.

4. Milestone-8 retained integration — SecurityError: localStorage is not available for opaque origins

packages/lynx/tests/milestone-8-integration.test.ts, test "adopts fallback, error, and hidden Activity nodes before retaining live content". The lynx project runs environment: 'node' (vitest.config.js:4147), so something installs a document/localStorage-bearing global with an opaque origin, and whether it is already installed depends on which sibling ran first. Seeds 2, 3, 11 fail; seeds 1, 5 and default order pass. Not root-caused to a source line.

Methodological note worth keeping

--no-isolate at full-project scale is nondeterministic at a fixed commit — it flips between two disjoint failure clusters (DOM transition tests stuck at isPending='pending', vs compiler tests hitting the vi.mock registry for compile.js) depending on transform/timer timing rather than source content. Reproduced on both HEAD and base.

Recording it so no future reviewer mistakes a --no-isolate delta for drift evidence in either direction. The audit's own first measurement in that mode was noise and was discarded.

Also: --poolOptions.threads.singleThread=true is gone in vitest 4 (CACError: Unknown option --poolOptions); --no-file-parallelism is the working equivalent.

Suggested direction

Item 1 is the one with roadmap consequences — reset or inject the listener base so the parity oracle does not depend on root ordering, and add the multi-root case it currently cannot see. Items 2–4 are oracle hygiene; item 2 additionally deserves an explicit assertion of the once-per-process diagnostic contract, since that is real behaviour nothing currently pins.

Verification performed

Executed at HEAD 5d000b30e; every finding re-run on a 6079a6804 worktree and confirmed byte-identical. Adversarial refuter panel had not adjudicated at time of filing.

Activity

  1. added
    bug
    on Aug 18, 2026
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-authoredbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions