-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_coverage_matrix_plan.py
More file actions
93 lines (72 loc) · 4.02 KB
/
Copy pathtest_coverage_matrix_plan.py
File metadata and controls
93 lines (72 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
"""Offline WIRED contract for the live coverage-matrix fixture.
``tests/live/fixtures/coverage-matrix`` is the single neutral folder deployed
live to BOTH providers by ``tests/live/coverage_matrix.py``. The assertions here
prove the *plan* wires all six portability dimensions on each provider (the
deterministic WIRED layer — "the plan is the contract"); the live harness proves
they are EXERCISED at runtime and records receipts under tests/live/receipts/.
Pure and offline: no credentials, no network, runs in CI. ``build_google_plan``
is pure too (the ADK import only happens in codegen/target), so both providers'
plans are asserted here.
Dimensions: agents · subagents · shared MCP · individual MCP · shared skill ·
individual skill.
"""
import os
from agentlift.google_plan import build_google_plan
from agentlift.parser import parse_project
from agentlift.planner import build_plan
HERE = os.path.dirname(os.path.abspath(__file__))
COVERAGE = os.path.join(HERE, "live", "fixtures", "coverage-matrix")
def _toolset(req):
for t in req["tools"]:
if t["type"] == "agent_toolset_20260401":
return t
return None
def test_anthropic_plan_wires_all_six_dimensions():
project, diags = parse_project(COVERAGE)
plan = build_plan(project, diags)
assert plan.deployable, plan.diagnostics.render()
reqs = {a.name: a for a in plan.agent_creates}
# agents
assert set(reqs) == {"lead", "researcher", "reporter"}
# subagents: lead is a coordinator over researcher + reporter
lead = reqs["lead"].request
assert reqs["lead"].is_coordinator
assert lead["multiagent"]["type"] == "coordinator"
assert set(lead["multiagent"]["agents"]) == {"@agent:researcher", "@agent:reporter"}
# shared MCP (docs) + individual MCP (code-search) both attached to researcher
servers = {s["name"] for s in reqs["researcher"].request["mcp_servers"]}
assert servers == {"docs", "code-search"}
# shared skill (house-style) deduped to ONE upload, used by both agents
hs = [u for u in plan.skill_uploads if u.display_title == "house-style"]
assert len(hs) == 1 and sorted(hs[0].used_by) == ["reporter", "researcher"]
# individual skill (report-format) private to reporter
rf = [u for u in plan.skill_uploads if u.display_title == "report-format"]
assert len(rf) == 1 and rf[0].used_by == ["reporter"]
# the read fix (live-discovered): skill-bearing agents get `read` enabled so
# Managed Agents can open SKILL.md, even though the folder set tools: []
for who in ("researcher", "reporter"):
ts = _toolset(reqs[who].request)
assert any(c["name"] == "read" and c["enabled"] for c in ts["configs"]), who
assert sum(1 for w in plan.diagnostics.warnings if w.code == "skills.read_enabled") == 2
def test_google_plan_wires_all_six_dimensions():
project, _ = parse_project(COVERAGE)
plan = build_google_plan(project)
assert plan.deployable, plan.diagnostics.render()
nodes = {n.name: n for n in plan.agents}
# agents + coordinator root
assert set(nodes) == {"lead", "researcher", "reporter"}
assert plan.root_agent == "lead"
# subagents: lead delegates to researcher + reporter (transfer_to_agent targets)
assert sorted(nodes["lead"].sub_agents) == ["reporter", "researcher"]
assert nodes["lead"].is_coordinator
# shared MCP (docs) + individual MCP (code-search) lowered onto researcher
assert {m.server for m in nodes["researcher"].mcp} == {"docs", "code-search"}
# shared skill bundle used by both; individual bundle private to reporter
bundles = {b.name: b for b in plan.skill_bundles}
assert sorted(bundles["house-style"].used_by) == ["reporter", "researcher"]
assert bundles["report-format"].used_by == ["reporter"]
# researcher loads the shared skill; reporter loads both
assert nodes["researcher"].skills == ["house-style"]
assert set(nodes["reporter"].skills) == {"house-style", "report-format"}
# Claude model in the folder is mapped to Gemini for Agent Engine
assert plan.deploy_model.startswith("gemini")