feat: add node coverage and improve investigation presentation
This commit is contained in:
@@ -543,6 +543,42 @@ def test_evidence_is_saved_before_return_and_call_conflicts_fail(runtime, monkey
|
||||
assert len(saved) == 1
|
||||
|
||||
|
||||
def test_large_node_coverage_retains_publishable_hint_and_saves_complete_geometry(runtime, monkeypatch):
|
||||
app, client, _, _ = runtime
|
||||
value = binding(task=True)
|
||||
saved = []
|
||||
monkeypatch.setattr(application, "verify_task", AsyncMock())
|
||||
monkeypatch.setattr(contexts, "verify_task", AsyncMock())
|
||||
|
||||
class TaskService:
|
||||
repo = SimpleNamespace(lock=lambda key: asyncio.sleep(0))
|
||||
|
||||
async def record_data_snapshot(self, task_id, snapshot):
|
||||
saved.append(snapshot)
|
||||
return SimpleNamespace(evidence_id=snapshot.source_ref), snapshot
|
||||
|
||||
monkeypatch.setattr(application, "task_service", lambda scope: TaskService())
|
||||
geometry = {"type": "FeatureCollection", "features": [{
|
||||
"type": "Feature", "properties": {"label": "x" * 13000},
|
||||
"geometry": {"type": "Polygon", "coordinates": [[[117, 32], [118, 32], [118, 33], [117, 32]]]},
|
||||
}]}
|
||||
app.executor = AsyncMock(return_value=QueryResult(
|
||||
source="generate_node_coverage", source_ref="mcp:before-persisting", queried_at=datetime.now(timezone.utc),
|
||||
semantics="analysis", data={"result": {"map_payload": geometry, "coverage": {
|
||||
"status": "ready", "groups": {"compare": {"node_ids": ["A"], "mapped_node_count": 1}},
|
||||
}}},
|
||||
))
|
||||
output = request(client, "tools/call", {"name": "generate_node_coverage", "arguments": {
|
||||
"context_handle": value.context_handle,
|
||||
"groups": [{"group_id": "compare", "title": "节点比较", "node_ids": ["A"]}],
|
||||
}}).json()["result"]["structuredContent"]
|
||||
assert output["truncated"] is True
|
||||
command = output["data"]["presentation"]["command"]
|
||||
assert command["action"] == "set_overlay" and command["evidence_id"] == saved[0].source_ref
|
||||
assert "data" not in command
|
||||
assert saved[0].data["data"]["result"]["map_payload"] == geometry
|
||||
|
||||
|
||||
def test_business_skill_is_delivered_over_mcp_without_recording_event_evidence(runtime, monkeypatch):
|
||||
app, client, _, _ = runtime
|
||||
value = binding(task=True)
|
||||
|
||||
Reference in New Issue
Block a user