refactor: remove unreachable code and redundant tests (#6729)

* refactor: prune unreachable runtime and WebUI paths

* test: drop duplicate cases and assertions for obsolete selectors
This commit is contained in:
chengyongru authored and GitHub committed 2026-11-20 11:11:00 +08:00
1 parent b9b491e74c
commit 51fa1a7f74
20 files changed
+32 -163

No files matched your search

-23
View File
@@ -90,14 +90,6 @@ class TestHistoryWithCursor:
assert data["cursor"] == cursor
assert data["content"] == expected_content
def test_read_unprocessed_history(self, store):
store.append_history("event 1")
store.append_history("event 2")
store.append_history("event 3")
entries = store.read_unprocessed_history(since_cursor=1)
assert len(entries) == 2
assert entries[0]["cursor"] == 2
def test_read_unprocessed_history_returns_all_when_cursor_zero(self, store):
store.append_history("event 1")
store.append_history("event 2")
@@ -189,21 +181,6 @@ class TestHistoryWithCursor:
entries = store.read_unprocessed_history(since_cursor=0)
assert [entry["cursor"] for entry in entries] == list(range(21, 101))
def test_write_entries_uses_atomic_write(self, tmp_path):
store = MemoryStore(tmp_path)
store.append_history("event 1")
store.append_history("event 2")
store.append_history("event 3")
entries = store.read_unprocessed_history(since_cursor=0)
tmp_path_obj = store.history_file.with_suffix(".jsonl.tmp")
assert not tmp_path_obj.exists()
store._write_entries(entries)
assert not tmp_path_obj.exists()
assert store.history_file.exists()
def test_write_entries_cleans_up_tmp_on_exception(self, tmp_path, monkeypatch):
store = MemoryStore(tmp_path)
store.append_history("event 1")
@@ -129,12 +129,6 @@ def test_responses_declaration_routes_other_models(provider):
assert provider._should_use_responses_api("gpt-4o", None) is True
def test_circuit_opens_after_threshold(provider):
for _ in range(_RESPONSES_FAILURE_THRESHOLD):
provider._record_responses_failure("gpt-5", None)
assert provider._should_use_responses_api("gpt-5", None) is False
def test_circuit_does_not_affect_other_models(provider):
for _ in range(_RESPONSES_FAILURE_THRESHOLD):
provider._record_responses_failure("gpt-5", None)
-10
View File
@@ -2307,16 +2307,6 @@ def test_sanitize_name_noop_for_already_clean_names() -> None:
assert _sanitize_name("mcp_server_tool") == "mcp_server_tool"
def test_tool_wrapper_sanitizes_name() -> None:
tool_def = SimpleNamespace(
name="My Tool",
description="tool with spaces",
inputSchema={"type": "object", "properties": {}},
)
wrapper = MCPToolWrapper(SimpleNamespace(call_tool=None), "srv", tool_def)
assert wrapper.name == "mcp_srv_My_Tool"
def test_resource_wrapper_sanitizes_name() -> None:
resource_def = SimpleNamespace(
name="PostgreSQL System Information",