47 lines
2.3 KiB
Text
47 lines
2.3 KiB
Text
|
|
let d = import "../defaults.ncl" in
|
||
|
|
|
||
|
|
d.make_mode String {
|
||
|
|
id = "validate-hydration",
|
||
|
|
trigger = "Validate SSR/WASM hydration parity for routes that opt into the Leptos hydration profile: scan for empty HashMap in *Client components, verify SsrTranslator usage, and check FTL registry population. Guards the rendering-mode dimension.",
|
||
|
|
|
||
|
|
preconditions = [
|
||
|
|
"code/crates/ exists",
|
||
|
|
"rg (ripgrep) available on PATH",
|
||
|
|
],
|
||
|
|
|
||
|
|
steps = [
|
||
|
|
{
|
||
|
|
id = "scan-empty-hashmap",
|
||
|
|
action = "Scan for HashMap::new() in *Client page components. Any hit in a lang_content context is a hydration violation — the client must hydrate the same content the server rendered.",
|
||
|
|
cmd = "rg 'HashMap::new\\(\\)' code/crates/ --type rust -g '*client*' -g '*Client*' --count 2>/dev/null || echo '0 — clean: no HashMap::new() in Client components'",
|
||
|
|
actor = 'Both,
|
||
|
|
on_error = { strategy = 'Continue },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id = "verify-ssr-translator",
|
||
|
|
action = "Verify *Client page components use SsrTranslator or build_page_content_patterns so translations resolve identically on server and client.",
|
||
|
|
cmd = "rg 'SsrTranslator' code/crates/ --type rust --count 2>/dev/null || echo '0 — SsrTranslator not referenced yet'",
|
||
|
|
actor = 'Both,
|
||
|
|
on_error = { strategy = 'Continue },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id = "verify-ftl-registry",
|
||
|
|
action = "Verify the WASM FTL registry is populated during client initialization (populate_wasm_ftl_registry or equivalent) so the hydration path has the same locale bundles as SSR.",
|
||
|
|
cmd = "rg 'populate_wasm_ftl_registry|wasm_ftl' code/crates/client/ 2>/dev/null || echo '— FTL registry hook not found (expected until a route opts into hydration)'",
|
||
|
|
actor = 'Both,
|
||
|
|
depends_on = [
|
||
|
|
{ step = "scan-empty-hashmap" },
|
||
|
|
{ step = "verify-ssr-translator" },
|
||
|
|
],
|
||
|
|
on_error = { strategy = 'Continue },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id = "report",
|
||
|
|
action = "Report hydration parity status. Any empty-HashMap hit in a Client component blocks the rendering-mode transition to dual-mode-verified. Since the site defaults to the HTMX profile, this mode is advisory until routes opt into hydration.",
|
||
|
|
actor = 'Both,
|
||
|
|
depends_on = [{ step = "verify-ftl-registry" }],
|
||
|
|
on_error = { strategy = 'Stop },
|
||
|
|
},
|
||
|
|
],
|
||
|
|
}
|