From 4ded9c0b7dab1940ac1114dfd3e9e2044fe47571 Mon Sep 17 00:00:00 2001 From: Codex Date: Fri, 28 Aug 2026 08:55:38 +0300 Subject: [PATCH] test: the #248 roundtrip fixture is seeded, not first-written (#333 r1-H1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The junction gate reads an empty previous as "a first write may not arrive already broken", and the #248 storage-roundtrip fixture legitimately carries a 6 cm wall — so the untouched test went red on this branch. The subject of #248 is byte-exact storage of an optimize commit, not first-write semantics: the fixture is now seeded as the stored document and optimize inherits its violations per rule, exactly like a real repair flow. Every storage assertion (intent, pending, final pair, canonical serialisation) is unchanged. Issue: #333 User-Visible: no --- tests_backend/test_ha_websocket.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests_backend/test_ha_websocket.py b/tests_backend/test_ha_websocket.py index 3ba155e9..7b3d6748 100644 --- a/tests_backend/test_ha_websocket.py +++ b/tests_backend/test_ha_websocket.py @@ -623,17 +623,26 @@ async def test_plan_optimize_persists_exact_storage_roundtrip_target( layout_writes.append(copy.deepcopy(value)) await real_layout_save(value) + # #333: the junction gate treats an empty previous as "a first write may + # not arrive already broken", and the roundtrip fixture legitimately + # carries a 6 cm wall (below П3). The subject of #248 is byte-exact + # STORAGE of an optimize commit, not first-write semantics — so the + # fixture is seeded as the stored document first and optimize inherits + # its violations per rule, exactly like a real repair flow. + await runtime.config_store.async_save( + {"config": copy.deepcopy(source["config"]), "rev": 1} + ) monkeypatch.setattr(runtime.store, "async_save", capture_layout_write) await client.send_json_auto_id({ "type": "houseplan/plan/optimize", "config": source["config"], "layout": source["layout"], - "expected_config_rev": 0, + "expected_config_rev": 1, "expected_layout_rev": 0, }) response = await client.receive_json() - assert response["success"] - assert response["result"]["config_rev"] == 1 + assert response["success"], response + assert response["result"]["config_rev"] == 2 assert response["result"]["layout_rev"] == 1 intent_write = next(