Files
Nathan Nguyen 34ffb948c8 chore(debug): classification reasons sidecar behind VINEXT_DEBUG_CLASSIFICATION [6/6] (#843)
* chore(debug): add classification reasons sidecar behind VINEXT_DEBUG_CLASSIFICATION

Operators tracing why a layout was flagged static or dynamic can opt in
with VINEXT_DEBUG_CLASSIFICATION=1 at build time. When active, the
plugin patches a second stub (__VINEXT_CLASS_REASONS) with a dispatch
table that returns per-layout ClassificationReason structures. The
runtime probe loop emits a debug line per layout when
debugClassification is wired, and the hot path remains allocation-free
when debug is off because the stub returns null.

The reasons machinery (types, report.ts tagged results, and
buildReasonsReplacement) already shipped in the previous PR; this PR
just enables the emission path and wires the debug consumer into the
runtime probe.

* test(debug): cover runtime-probe error path and Layer 2 reasons dispatch

The runtime-probe catch branch in `probeAppPageLayouts` emits
`{ layer: "runtime-probe", outcome: "dynamic", error: "..." }` when the
isolated dynamic scope throws. That emission had no coverage, so a
regression that stopped including the `error` field, or that skipped the
debug callback entirely on the error path, would not have tripped any
test.

The reasons sidecar integration test also only asserted the Layer 1
(`segment-config`) reason on the nested `force-dynamic` layout. Layer 2
(`module-graph`) on the pure-JSX root layout was exercised in the build
but never read, so a regression that stopped serializing the `result`
field or the `module-graph` discriminator for Layer 2 would slip through.

Extends the existing debug-on describe block to read reasons for layout
index 0 on `/force-dyn` and assert the `module-graph` + `result: "static"`
pair, keeping the structural `ReasonShape` so the test still survives
the #863 codegen reshape.

Also removes a pre-existing `as` on the narrowed Map return in favour of
a proper `in`-narrowing type predicate.
2026-04-21 10:29:10 +01:00
..
2026-04-09 09:14:13 +01:00
2026-03-15 10:50:13 +00:00
2026-04-09 09:14:13 +01:00
2026-04-09 09:14:13 +01:00
2026-04-09 09:14:13 +01:00
2026-04-09 09:14:13 +01:00