fix(modes): only activate peripherals and show individual seat actions

This commit is contained in:
Miayui
2026-09-22 13:34:29 +08:00
parent 6b9ee0f349
commit 2b365b3922
21 changed files with 176 additions and 215 deletions
@@ -256,9 +256,9 @@ def test_romantic_cinema_template_preserves_cinema_and_adds_authorized_light(
assert result["mode_profile_draft"]["generation_source"] == "scene_template_copy"
if stale_profile is not None:
assert result["mode_profile_draft"]["existing_mode_id"] == stale_profile.id
assert result["mode_profile_draft"]["operation_count"] == (25 if full_scene else 7)
assert result["mode_profile_draft"]["operation_count"] == (23 if full_scene else 7)
safe_result = CodexAssistantService._safe_vehicle_result(result)
assert len(safe_result["actions"]) == (25 if full_scene else 7)
assert len(safe_result["actions"]) == (23 if full_scene else 7)
native_actions = {
(
@@ -282,10 +282,9 @@ def test_romantic_cinema_template_preserves_cinema_and_adds_authorized_light(
video = [action for action in received_cinema["actions"] if action["domain"] == "android"]
assert result["n7_transfer_candidates"] == video
slots = [action["slot"] for action in result["infrared_actions"]]
assert sorted(slots) == ([2, 3, 22, 23, 41] if full_scene else [1])
assert sorted(slots) == ([2, 22, 41] if full_scene else [1])
if full_scene:
assert slots.index(2) < slots.index(3)
assert slots.index(22) < slots.index(23)
assert all(action["action"] == "打开" for action in result["infrared_actions"])
draft = result["mode_profile_draft"]
arguments = (
@@ -429,18 +428,16 @@ def test_scene_composer_mixed_can_ir_preview_save_and_revalidate(
"climate",
"self_extension",
]
assert preview["mode_profile_draft"]["operation_count"] == 3
assert preview["mode_profile_draft"]["operation_count"] == 2
assert set(preview["function_configs"]) == {"native_climate", "self_extension"}
infrared_commands = preview["command_plans"]["self_extension"]["spec"][
"commands"
]
assert [command["message"] for command in infrared_commands] == [
"infrared.emit",
"infrared.emit",
]
assert [command["signals"] for command in infrared_commands] == [
{"slot": 1},
{"slot": 7},
]
assert preview["infrared_actions"][0]["parse_source"] == (
"scene_composer_capability_ref"
@@ -465,10 +462,9 @@ def test_scene_composer_mixed_can_ir_preview_save_and_revalidate(
assert [operation.capability for operation in profile.operations] == [
"climate.set_temperature",
"infrared.emit",
"infrared.emit",
]
entries = handler._saved_mode_infrared_entries(profile)
assert [entry["capability"]["slot"] for entry in entries] == [1, 7]
assert [entry["capability"]["slot"] for entry in entries] == [1]
native_execution = service.execute_mode_profile_card(
profile.id,
conversation_id="conv-saved-scene-peripheral",
@@ -489,7 +485,7 @@ def test_scene_composer_mixed_can_ir_preview_save_and_revalidate(
entries,
)
assert executed["status"] == "succeeded"
assert [action["slot"] for action in executed["infrared_actions"]] == [1, 7]
assert [action["slot"] for action in executed["infrared_actions"]] == [1]
invoked = handler._execute_request_with_peripherals(
"/api/requests/preview",
{
@@ -506,7 +502,7 @@ def test_scene_composer_mixed_can_ir_preview_save_and_revalidate(
assert invoked is not None
assert invoked["status"] == "succeeded"
assert invoked["execution_mode"] == "dry_run"
assert [action["slot"] for action in invoked["infrared_actions"]] == [1, 7]
assert [action["slot"] for action in invoked["infrared_actions"]] == [1]
template_plan = _catalog_exact_scene_template_plan(
catalog.snapshot(),
@@ -611,8 +607,8 @@ def test_scene_composer_mixed_can_ir_preview_save_and_revalidate(
assert explicit is not None
assert explicit["status"] == "succeeded"
assert explicit["execution_mode"] == "dry_run"
assert explicit["mode_profile_draft"]["operation_count"] == 3
assert [action["slot"] for action in explicit["infrared_actions"]] == [1, 7]
assert explicit["mode_profile_draft"]["operation_count"] == 2
assert [action["slot"] for action in explicit["infrared_actions"]] == [1]
# Removing the durable NFC whitelist invalidates both cached refs and saved
# mode execution before any transport can be reached.