From 88c339c5c39c9bf515e4974d555843aebb6ed22a Mon Sep 17 00:00:00 2001 From: slhx agent Date: Mon, 25 May 2026 22:42:19 +0200 Subject: [PATCH] test(js): cover fingerprint mismatch fallback Assert the browser runtime refuses stale partial/effect updates when deployment fingerprints mismatch and falls back to reload instead of applying stale ids. req: abi/003 req: abi/004 req: runtime/004 --- slhx-js/tests/runtime.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/slhx-js/tests/runtime.rs b/slhx-js/tests/runtime.rs index b10b18d..e3e3d14 100644 --- a/slhx-js/tests/runtime.rs +++ b/slhx-js/tests/runtime.rs @@ -67,6 +67,19 @@ fn runtime_exposes_page_swap_hooks() { assert!(source.contains("location.href = href")); } +#[test] +fn runtime_refuses_partial_updates_on_fingerprint_mismatch() { + // req: abi/003 req: abi/004 req: runtime/004 + let source = slhx_js::RUNTIME_JS; + + assert!(source.contains("function compatibleFingerprint(response, root)")); + assert!(source.contains("const received = response.headers.get(\"x-slhx-fingerprint\")")); + assert!(source.contains("const expected = root && root.getAttribute(FINGERPRINT)")); + assert!(source.contains("if (!compatibleFingerprint(response, root))")); + assert!(source.contains("location.reload()")); + assert!(source.contains("if (expected && String(batch.fingerprint) !== expected)")); +} + #[test] fn runtime_page_swaps_lowered_slot_ids() { // req: wire/001