fix: harden conversational mode draft revisions
This commit is contained in:
@@ -468,6 +468,49 @@ def test_pending_mode_draft_update_uses_fast_configuration_route_without_codex()
|
||||
assert "调整待保存" in result["answer"]
|
||||
|
||||
|
||||
def test_pending_mode_draft_change_into_percentage_is_a_configuration_update() -> None:
|
||||
context = {
|
||||
"name": "观影模式",
|
||||
"source_request_id": "req-viewing-preview",
|
||||
"vehicle_id": "denza_n7",
|
||||
}
|
||||
|
||||
update = _authorize_vehicle_request(
|
||||
"把观影模式的遮阳帘变成100%",
|
||||
CONTROL_TERMS,
|
||||
context,
|
||||
)
|
||||
question = _authorize_vehicle_request(
|
||||
"把观影模式的遮阳帘变成100%吗",
|
||||
CONTROL_TERMS,
|
||||
context,
|
||||
)
|
||||
|
||||
assert update.reason == "explicit_mode_profile_draft_update"
|
||||
assert question.reason == "mode_profile_query"
|
||||
|
||||
|
||||
def test_pending_mode_draft_noop_answer_says_target_was_already_set() -> None:
|
||||
result = _sample_mode_preview_result(
|
||||
"观影模式",
|
||||
generation_source="draft_revision",
|
||||
)
|
||||
draft = result["mode_profile_draft"]
|
||||
assert isinstance(draft, dict)
|
||||
draft.update(
|
||||
{
|
||||
"requested_operation_count": 1,
|
||||
"changed_operation_count": 0,
|
||||
}
|
||||
)
|
||||
|
||||
answer = CodexAssistantService._mode_profile_preview_answer(result, True)
|
||||
|
||||
assert "该项原本已是目标状态" in answer
|
||||
assert "已保持不变并重新校验" in answer
|
||||
assert "已调整待保存" not in answer
|
||||
|
||||
|
||||
def test_active_draft_context_does_not_hijack_an_ordinary_question() -> None:
|
||||
client = FakeCodexClient()
|
||||
assistant = CodexAssistantService(client)
|
||||
@@ -1037,6 +1080,8 @@ def test_safe_vehicle_result_exposes_mode_preview_without_command_flow() -> None
|
||||
"vehicle_id": "denza_n7",
|
||||
"domains": ["roof", "interior_light", "ambient_light"],
|
||||
"operation_count": 4,
|
||||
"requested_operation_count": 1,
|
||||
"changed_operation_count": 0,
|
||||
"command_flow": {"raw_can": "must-not-cross-tool-boundary"},
|
||||
},
|
||||
"intent_ir": {
|
||||
@@ -1065,6 +1110,8 @@ def test_safe_vehicle_result_exposes_mode_preview_without_command_flow() -> None
|
||||
"vehicle_id": "denza_n7",
|
||||
"domains": ["roof", "interior_light", "ambient_light"],
|
||||
"operation_count": 4,
|
||||
"requested_operation_count": 1,
|
||||
"changed_operation_count": 0,
|
||||
}
|
||||
assert safe["actions"] == [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user