sync update from LAN repo (source dhk-1 @ 3e87be55)

This commit is contained in:
gozeros committed 2026-10-21 15:06:08 +08:00
1 parent ab6068a7c1
commit 42f2a26fa8
1482 files changed
+227759 -9584

No files matched your search

@@ -0,0 +1,68 @@
"""Gateway contract for the dedicated task deep-link history endpoint."""
from __future__ import annotations
from types import SimpleNamespace
import pytest
from app.gateway.routers.task_deeplink_threads import list_task_deeplink_threads
class _HistoryStore:
def __init__(self) -> None:
self.calls: list[tuple[str, str, int]] = []
async def list_threads(self, task_id: str, go_path: str, *, limit: int):
self.calls.append((task_id, go_path, limit))
return [
{
"thread_id": "thread-1",
"status": "idle",
"created_at": "2026-10-19T08:00:00+00:00",
"updated_at": "2026-10-19T08:01:00+00:00",
"metadata": {
"taskId": "108",
"taskRecordId": "108",
"taskGoPath": "rwfx",
},
"values": {"title": "任务分析"},
"interrupts": {},
}
]
@pytest.mark.asyncio
async def test_list_endpoint_trims_task_id_and_preserves_thread_shape():
store = _HistoryStore()
request = SimpleNamespace(
app=SimpleNamespace(
state=SimpleNamespace(task_deeplink_thread_store=store),
)
)
response = await list_task_deeplink_threads(
request,
task_id=" 108 ",
go_path="rwfx",
limit=25,
)
assert store.calls == [("108", "rwfx", 25)]
assert response.model_dump() == {
"threads": [
{
"thread_id": "thread-1",
"status": "idle",
"created_at": "2026-10-19T08:00:00+00:00",
"updated_at": "2026-10-19T08:01:00+00:00",
"metadata": {
"taskId": "108",
"taskRecordId": "108",
"taskGoPath": "rwfx",
},
"values": {"title": "任务分析"},
"interrupts": {},
}
]
}