You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[lynx-perf 5] Validation diet: full structural checks in dev, envelope-only in production #6
Independent; compounds with [lynx-perf 4] (fewer, bigger commands) and helps FCP. Post-#1, per-command validation cost only matters where command counts remain large: create/mount batches and the first hydration commit.
The measured problem
Pre-#1 stage timers on a ~30k-command batch @10k rows: MT inbound validate 62ms + prepareLynxHostBatch staging/semantic checks 266ms — both scale with command count. BG-side selfcheck ≈0.1ms (already cheap, leave it). The defensive posture has real value — the cross-realm validator caught the octanejs#459-class bug — but in production, on a correct build, per-command structural validation only ever answers "valid". FCP also pays: the first hydration commit validates the entire tree's commands (FCP@10k ≈ 1090ms vs vue band 795–949, historical same-host).
Change
Split validation: (a) envelope validation at the boundary — type/version/root/realm-safe shape of the message object — always on; (b) per-command structural validation — behind the existing dev/build define: on in dev and in the vm two-realm rig, off in production.
Production fail-stop is preserved by the existing apply-time try/catch + fault path (applyFailed → faulted root). Add the invariant as a test: a corrupt command in production mode produces a loud fault, never silent corruption.
In prepareLynxHostBatch, separate "semantic validation" from "staging work" so the define removes only checks, never behavior. Report the split in the __OCTANE_LYNX_PROFILE__ hook (prepareCheckMs vs prepareStageMs).
Implemented in #13 (draft, stacked on #12). Measured outcome vs this issue's acceptance, on the deterministic rig instrument (whole-run @10k, prod build, medians of 3 back-to-back reps):
FCP@10k ≥100ms better: not met — unchanged within noise (Lynx-for-Web BENCH_AUTOROWS=10000 probe: first text 5,614 → 5,546ms, full rows 5,910 → 5,848ms, spreads ±250ms). Structural reason: the rig's first screen is main-thread-rendered, so commit validation was never on the FCP critical path — the removed walks run post-FCP (background commits, ack, adoption). FCP belongs to [lynx-perf 7] [lynx-perf 7] Receiver diet: shrink the MT slice, spend it on FCP #8.
Dev suites green with validation on: met (full lynx dir, 27 files / 300 tests, two-realm rig).
Prod fault-not-UB: met — new validation-diet.test.ts runs the real dual-thread pipeline with NODE_ENV=production modules: real scenes behave identically, and corrupt commits (structural corruption, duplicate ids, malformed envelope) all reject loudly with the DOM untouched.
Scope notes: cloneProps and all record-existence/attach-state checks stay unconditional (behavior, not validation); the split is reported as prepareCheckMs inside the profile hook (production reports 0 by construction, prepareMs − prepareCheckMs is the shared staging cost).
Live-main audit (2026-08-11): no current owner; old driver path superseded. octanejs#700's real-browser profile attributes only about 2.9 ms to validation and 1.5 ms to preparation out of roughly 303 ms. Retain the dev-deep/prod-fast principle and profiling counter, but do not port the old validation diet without a new live-main profile proving a material owner.
Activity
Huxpro commentedon Aug 9, 2026
Implemented in #13 (draft, stacked on #12). Measured outcome vs this issue's acceptance, on the deterministic rig instrument (whole-run @10k, prod build, medians of 3 back-to-back reps):
BENCH_AUTOROWS=10000probe: first text 5,614 → 5,546ms, full rows 5,910 → 5,848ms, spreads ±250ms). Structural reason: the rig's first screen is main-thread-rendered, so commit validation was never on the FCP critical path — the removed walks run post-FCP (background commits, ack, adoption). FCP belongs to [lynx-perf 7] [lynx-perf 7] Receiver diet: shrink the MT slice, spend it on FCP #8.validation-diet.test.tsruns the real dual-thread pipeline withNODE_ENV=productionmodules: real scenes behave identically, and corrupt commits (structural corruption, duplicate ids, malformed envelope) all reject loudly with the DOM untouched.Scope notes:
clonePropsand all record-existence/attach-state checks stay unconditional (behavior, not validation); the split is reported asprepareCheckMsinside the profile hook (production reports 0 by construction,prepareMs − prepareCheckMsis the shared staging cost).Generated by Claude Code
Huxpro commentedon Aug 11, 2026
Live-main audit (2026-08-11): no current owner; old driver path superseded. octanejs#700's real-browser profile attributes only about 2.9 ms to validation and 1.5 ms to preparation out of roughly 303 ms. Retain the dev-deep/prod-fast principle and profiling counter, but do not port the old validation diet without a new live-main profile proving a material owner.