From f8cc6d082e56eacd62f8391feb89d6ddc8237930 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Fri, 14 Aug 2026 19:08:39 -0700 Subject: [PATCH] test(todo): make JSON-string coercion test order-agnostic The type-coercion test pinned index order of todos, which #42649's _normalize_order intentionally changes (in_progress lifts ahead of earlier pending rows). Assert coercion by id instead of position. --- tests/tools/test_todo_tool_type_coercion.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/tools/test_todo_tool_type_coercion.py b/tests/tools/test_todo_tool_type_coercion.py index fa70b8c91a..84d03a6781 100644 --- a/tests/tools/test_todo_tool_type_coercion.py +++ b/tests/tools/test_todo_tool_type_coercion.py @@ -23,8 +23,12 @@ class TestJsonStringCoercion: result = json.loads(todo_tool(todos=todos_str, store=store)) assert "error" not in result assert result["summary"]["total"] == 2 - assert result["todos"][0]["id"] == "t1" - assert result["todos"][1]["status"] == "in_progress" + # Order-agnostic: TodoStore._normalize_order may lift the in_progress + # item ahead of earlier pending rows (#42649); this test only pins + # JSON-string coercion, not ordering. + by_id = {t["id"]: t for t in result["todos"]} + assert set(by_id) == {"t1", "t2"} + assert by_id["t2"]["status"] == "in_progress" def test_non_list_non_string_returns_error(self):