fix: one schema lookup for a whole design, and larger graph batches
The target architect exhausted its 45 tool calls on a first attempt in three of five runs: 31 schema lookups and 29 graph_put calls for one design. Each time it carried on from its working graph, at a cost of four to ten minutes. - terraform_schema takes resource_types, a list, and outlines every argument and block each accepts, by name, in one reply. - The architect is told to make that one call once the Elements are decided, and to build the graph in a handful of calls of ten to twenty items. Case 04 then completed at 100% for the first time, the architect finishing in one attempt with 11 lookups and 13 graph calls. Plans record the run and correct three step statuses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -249,6 +249,29 @@ async def test_schema_suggests_close_resource_types_and_is_loaded_once(monkeypat
|
||||
assert "apply" not in [arg for command in commands for arg in command]
|
||||
|
||||
|
||||
async def test_several_resource_types_are_outlined_in_one_call(monkeypatch):
|
||||
"""One lookup for a whole design: looking types up one by one used up the
|
||||
target architect's tool calls in three of five runs."""
|
||||
runner, commands = schema_runner(monkeypatch)
|
||||
|
||||
result = await runner.schema(resource_types=["cloud_service", "cloud_job", "nope"])
|
||||
by_commas = await runner.schema(resource_type="cloud_service, cloud_job")
|
||||
|
||||
assert result.message.startswith("example/cloud 1.2.3. * marks a required")
|
||||
assert "cloud_service\n labels, name*" in result.message
|
||||
assert " template { }: cpu_boost" in result.message
|
||||
assert "uri" not in result.message # read-only: code cannot set it
|
||||
assert "nope: not a resource type of example/cloud 1.2.3." in result.message
|
||||
assert "cloud_job\n" in by_commas.message and "template { }" in by_commas.message
|
||||
assert [command[1] for command in commands] == ["init", "providers"]
|
||||
|
||||
|
||||
async def test_a_lookup_needs_a_resource_type(monkeypatch):
|
||||
runner, _ = schema_runner(monkeypatch)
|
||||
|
||||
assert (await runner.schema()).message.startswith("Refused: name at least one")
|
||||
|
||||
|
||||
async def test_schema_is_unavailable_without_a_pinned_provider():
|
||||
result = await TerraformRunner().schema("cloud_service")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user