test: the #248 roundtrip fixture is seeded, not first-written (#333 r1-H1)

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
This commit is contained in:
Codex
2026-08-28 08:55:39 +03:00
parent 783cc68b91
commit 4ded9c0b7d
+12 -3
View File
@@ -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(