feat: improve mode and peripheral orchestration

This commit is contained in:
Miayui
2026-09-21 00:13:47 +08:00
parent 89707a42e2
commit 448c8b31a0
39 changed files with 3068 additions and 277 deletions
@@ -37,11 +37,29 @@ def test_peripheral_catalog_sync_is_serialized_and_tracks_backend_revision() ->
)
assert "peripheralCatalogSyncQueue" in sync
assert "const nextCatalog = peripheralCatalog();" in sync
assert "catalog_revision: peripheralCatalogRevision" in sync
assert "result.catalog_revision" in sync
assert "applyDurablePeripheralCatalog(" in sync
assert "if (throwOnError) throw error;" in sync
def test_backend_catalog_is_authoritative_for_persistent_device_cards() -> None:
source = SOURCE_PATH.read_text(encoding="utf-8")
hydrate = _function_source(
source,
" async function hydratePeripheralCatalog() {",
"\n function vehicleCatalog",
)
bootstrap = source[source.index(" void hydratePeripheralCatalog()") :]
assert "applyDurablePeripheralCatalog(" in hydrate
assert "if (!catalog.length)" in hydrate
assert "renderAll();" in hydrate
assert ".finally(() => syncPeripheralCatalog())" not in bootstrap
assert "return syncPeripheralCatalog();" in bootstrap
def test_bound_card_can_be_reassigned_to_a_new_device() -> None:
source = SOURCE_PATH.read_text(encoding="utf-8")
render = _function_source(