LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-grace
createdAtSep 13, 2026, 5:00 PM
updatedAtSep 14, 2026, 2:30 AM
githubUrlhttps://github.com/neomjs/neo/issues/18666
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 14, 2026, 2:30 AM

FieldConfigGuardProfile's ratio ceiling sits inside CI timing noise

neo-opus-grace
neo-opus-grace commented on Sep 13, 2026, 5:00 PM

Context

test/playwright/unit/core/FieldConfigGuardProfile.spec.mjs (#18629, for #18617) pins the cost of the after-new field/config guard against the construction it guards. The guard sits on the engine's hottest path, and the operator asked for benchmarks rather than unit checks alone.

Since #18629 merged (2026-09-13 10:12Z), the grid arm (:210, asserting at :219) has failed three CI unit jobs, and each passed on retry #1. playwright.config.unit.mjs:27 sets failOnFlakyTests: isCI, so each pass-on-retry still failed the job:

run grid overhead, failed attempt same code, later attempts
dev push f9709716ad (job 103711990853) 13.98 % 2.36 %
#18661, first head (reported on #18626) 20.10 % passed on retry
#18664 at 9941544223 (job 103739458896, rerun job 103740465194) 14.69 % 1.16 %, 2.25 %

The values are the spec's own report() lines in the job logs. The #18661 value is taken from #18626, not from its log.

The Problem

The arm asserts liveMs / stubbedMs - 1 < 0.1: the ratio of two medians of 12 interleaved wall-clock constructions (profile(), :113). One grid construction takes 28–46 ms on CI, and across attempts of identical code the ratio ranged 1.16–14.69 %. The ceiling sits inside that spread.

In the same jobs, the guard measured in isolation (guardAlone(), :148) came to 0.05–0.12 % of one instance. The ratio arm therefore cannot catch the guard short of a ~100× regression, but it does red on runner scheduling. The retry masks the red, failOnFlakyTests restores it, and every PR that draws it pays a rerun and a triage.

Two neighbours share the exposure, with more headroom so far:

  • The tree arm (:196, asserting at :207) ranged −1.52 % to 4.71 % across the same attempts, half its ceiling.
  • The guard-alone absolute bound manyConfigsFewFields.ns < 1000 (:249) measured 359, 683 and 462 ns on CI, 1.5× headroom that tracks runner speed. :250's < 5000 measured 1855–2443 ns.

The relative assertions stayed far inside their bounds in every sample:

  • the share bounds (:247–:248): 0.05–0.12 % against < 1 %;
  • configs do not price the guard (:251–:252): 359 < 2040, 683 < 2861, 462 < 2824 ns.

The Architectural Reality

  • Neo.create calls instance.assertFieldsShadowNoConfig() once per instance, right after new (src/Neo.mjs:329; the guard is src/core/Base.mjs:1127). The spec's docblock (:35) states what it pins.
  • profile() alternates which arm runs first in each pair. That removes order bias, but not a shared runner's scheduling and GC variance at 12 samples per arm.
  • guardAlone() takes the median of 7 batches of 200,000 calls on the exact after-new shapes. It is the high-SNR measurement, and the share assertions already divide it by the per-instance construction time profile() measured.
  • The unit config runs CI with retries: 2 (:30) and failOnFlakyTests (:27). A flaky pass is a red job, which is correct for isolation leaks, so the fix belongs in the spec, not the config.

The Fix

Keep every measurement and its attached report; gate only on quantities a runner cannot move.

  1. Tree and grid arms: replace overhead < 0.1 with the multiplicity the ratio implicitly guarded. For one construction, the guard's call count must equal the number of instances created, counted by a second tap that does not go through the guard (for example, the instance registrations during that construction). A guard running twice per instance then reds deterministically, and the share bounds already cap its cost per call. overhead stays in the report.
  2. Guard-alone arm: replace the absolute nanosecond ceilings (:249, :250) with the relations they stand for, measured in the same run. Configs do not price the guard (:251–:252, kept), and own fields do: 30 own fields cost more than 4 at the same config count (1855 > 359, 2418 > 683, 2443 > 462 ns on CI). Keep the share bounds at :247–:248.

Acceptance Criteria

  • No assertion in the spec compares a whole-construction timing ratio (overhead) or an absolute duration against a fixed ceiling; both figures remain in the attached reports. The share bounds (:247–:248) stay, as The Fix keeps them: they divide the guard-alone cost by the per-instance construction time, and every CI sample above held at least 8× headroom. (Corrected 2026-09-13 before implementation: as first written, this row also forbade the share bounds The Fix keeps.)
  • A mutation that runs assertFieldsShadowNoConfig twice per instance reds the tree and grid arms; restoring the guard greens them.
  • A mutation that makes the guard walk static config instead of the instance's own fields reds the guard-alone arm.
  • npm run test-unit -- test/playwright/unit/core/FieldConfigGuardProfile.spec.mjs --repeat-each=10 passes with no failure, and the PR's CI unit job passes without a flaky result.

Out of Scope

  • The guard itself (#18617): every CI sample above puts it at ≤ 0.12 % of one instance.
  • failOnFlakyTests and retries in playwright.config.unit.mjs, which are right for isolation leaks.
  • A separate non-gating benchmark job: an org-wide CI decision, not this spec's defect.

Avoided Traps

  • Raising the ceiling. Three samples already reached 0.20, and no sample count bounds the tail. A ceiling wide enough to clear the noise detects less than the 1 % share bound already does.
  • More pairs, or min-of-N. Both narrow the spread without bounding it. They multiply the tree arm's 24 constructions of 0.3–0.43 s each on CI, and nobody has measured the result's CI distribution.
  • Skipping the ratio arms on CI. That removes the pin exactly where the swarm runs.

Related

  • #18629: introduced the spec. #18617: the guard.
  • #18626: Clio's CI notes carry occurrences 1 and 2 (dev f9709716ad, #18661's first head).
  • #18664: occurrence 3.

Live latest-open sweep: checked the latest 20 open issues at 2026-09-13T14:58:24Z; no equivalent found. A2A in-flight sweep: the 30 most recent messages at 14:58Z, all read-states; no claim on this spec. MC sweep: "FieldConfigGuardProfile grid overhead benchmark bound fails the unit job, passes on retry", 8 results. The one on-topic hit is #18629's authoring session, where the ceilings were set from local runs; no prior decision about CI noise. Own-assignment sweep: 12 open, none overlapping.

handoff: @neo-fable — the spec's author, since this revisits her choice of what to pin. It is one file if another seat takes it instead.

Origin Session ID: d010413d-0559-4755-b8f7-34cbcdc8d0b3 Retrieval Hint: "FieldConfigGuardProfile grid overhead ceiling CI failOnFlakyTests retry"

tobiu referenced in commit 1d41fa4 - "test(core): FieldConfigGuardProfile gates on counts and same-run relations, not timing ceilings (#18666) (#18686) on Sep 14, 2026, 2:30 AM
tobiu closed this issue on Sep 14, 2026, 2:30 AM