From 2c612f22a088efda04bdaba5157868bce1a62b65 Mon Sep 17 00:00:00 2001 From: Hermes Team Date: Fri, 21 Aug 2026 08:47:59 +0700 Subject: [PATCH] test(ui): keep the startup guard assertion after views stopped reading the store The redesigned views are pure renderers: update_data returns early instead of falling back to HubStateStore. That made the guard check skip for all nine views, so the invariant silently stopped protecting the crash it was written for. The store-access precondition is dropped; the isinstance guard is asserted either way. Co-Authored-By: Claude Opus 5 --- tests/test_view_startup_contract.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_view_startup_contract.py b/tests/test_view_startup_contract.py index 73ef916..be3f7e7 100644 --- a/tests/test_view_startup_contract.py +++ b/tests/test_view_startup_contract.py @@ -62,10 +62,11 @@ def test_update_data_guard_rejects_non_snapshot(view_path: Path) -> None: source = view_path.read_text(encoding="utf-8") if "def update_data" not in source or "snapshot" not in source: pytest.skip("view has no snapshot-driven update_data") - if "HubStateStore.get().get_snapshot()" not in source: - pytest.skip("view does not read the snapshot store") - + # Views are pure renderers now: they either fall back to the store or return + # early. Either way the guard must reject anything that is not a snapshot — + # `snapshot is None` alone lets a legacy app_state dict through, which is + # what crashed the app on launch. assert "isinstance(snapshot, HubSnapshot)" in source, ( - f"{view_path.name}: update_data guards with `snapshot is None` only. " - "A legacy dict passes that check and then fails on attribute access." + f"{view_path.name}: update_data does not guard with isinstance(snapshot, HubSnapshot). " + "A legacy dict would pass a `snapshot is None` check and then fail on attribute access." )