test(runtime): add BDD coverage tests for runtime Executor API #34
No reviewers
Labels
No labels
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
#33 test: Coverage increase
cleveragents/cleveractors-core
Reference
cleveragents/cleveractors-core!34
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "test/m1-coverage-increase"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add 16 Behave BDD scenarios covering the router-facing
runtime.ExecutorAPI, increasing code coverage from 94.66% to 96.94% (214 fewer uncovered lines).What is covered
create_executor()factory function andExecutorinitializationExecutor.execute()dispatch to LLM, graph, tool, and multi-actor agents_execute_llm()credential injection (provider-specific + openai_compatible fallback) and error handling_execute_graph()PureGraphConfig construction from route definitions_execute_tool()tool configuration from config blocks_execute_multi_actor()routing with default_actor resolution and empty-actor error_build_factory_config()credential and limit injection into agent configs_estimate_tokens()with tiktoken and heuristic fallbackNodeUsageandActorResultdataclass field storageVerification
nox -s unit_tests→ 1838 scenarios, 0 failednox -s coverage_report→ 96.94% (passes 96.5% threshold)nox -s lint→ all checks passednox -s typecheck→ 0 errorsnox -s security_scan→ 0 findingsnox -s dead_code→ cleanCloses #33
@ -0,0 +500,4 @@assert isinstance(context.test_result, ActorResult)@then("the ActorResult response should contain the expected reply")This description doesn't match the code. "the expected reply" implies that there is only one reply. The code allows any reply that isn't empty.
@ -0,0 +556,4 @@@then("the LLM agent should be initialized with the injected api key")def step_assert_injected_key(context):assert context.test_result is not NoneAgain -- the description and the assertion do not match. Check that the API key is in the LLM agent.
@ -0,0 +57,4 @@"edges": [],"entry_node": "start","exit_nodes": ["end"],}The above config dict doesn't look valid for two reasons:
@ -0,0 +98,4 @@"edges": [],"entry_node": "start","exit_nodes": ["end"],}See
step_config_graph_route.@ -0,0 +281,4 @@"name": "test_auto_multi","actors": {"default": {"type": "llm",Here's the type field that's supposed to be missing.
@ -0,0 +526,4 @@@then("the node usage IDs should be prefixed with the default actor name")def step_assert_node_prefix(context):for node in context.test_result.nodes:assert "." in node.node_id or node.node_id.startswith("default")This doesn't match the description.
It should be
assert node.node_id.startsWith("default.")A few things to fix.
6225775878866e08751cThanks for the thorough review, Brent. Here is my response to each comment:
1. Review 9484 — "expected reply" mismatch
Fixed. The step description has been updated from "the ActorResult response should contain the expected reply" to "the ActorResult response should be non-empty." The assertion checks
len(context.test_result.response) > 0, which accurately verifies that a non-empty reply was produced by the mocked LLM agent. The name now matches the code.2. Review 9485 — "injected api key" assertion
Fixed. The step now verifies that the executor's credentials dictionary contains the OpenAPI API key
"sk-test-injected"rather than just checkingtest_result is not None. The assertion chain now confirms: the result exists, the executor exists, credentials exist, the openai key is present, and its api_key value matches the injected key.3. Review 9486 — Invalid graph route config (step_config_graph_route)
Fixed. The nodes list now includes
{"id": "end", "type": "end"}alongside the existing start node, so theexit_nodes: ["end"]reference resolves correctly. The config dict now represents a valid trivial graph with a start-to-end structure.4. Review 9487 — Same issue in step_config_graph_openai
Fixed identically to #9486. The
step_config_graph_openairoute now also includes theendnode in its nodes list.5. Review 9488 — Type field in actors_no_type config
Not changed. The step description says "a config dict with actors key but no type field" — this correctly refers to the top-level config dict, which has
actors,name, andcleveragentskeys but notypefield at the top level. The"type": "llm"insideactors.defaultis the sub-actor's own type, which is required and correct for the sub-actor config within a multi-actor bundle. The test is doing exactly what its description says.6. Review 9489 — Node prefix assertion
Fixed. The assertion has been changed from
"." in node.node_id or node.node_id.startswith("default")tonode.node_id.startswith("default."). This correctly verifies that node IDs are prefixed with the default actor name followed by a dot separator, matching the step description.All changes verified with:
nox -s unit_tests— 1838 scenarios, 0 failuresnox -s lint— all checks passednox -s format -- --check— all files already formattedFixed. The step description has been updated from "the ActorResult response should contain the expected reply" to "the ActorResult response should be non-empty." The assertion checks
len(response) > 0, which accurately verifies that a non-empty reply was produced by the mocked LLM agent. The name now matches the code.Fixed. The step now verifies that the executor's credentials dictionary contains the OpenAI API key
"sk-test-injected"rather than just checkingtest_result is not None. The assertion chain now confirms: the result exists, the executor exists, credentials exist, the openai key is present, and its api_key value matches the injected key.Fixed. The nodes list now includes
{"id": "end", "type": "end"}alongside the existing start node, so theexit_nodes: ["end"]reference resolves correctly. The config dict now represents a valid trivial graph with a start-to-end structure.Fixed identically to the previous comment. The
step_config_graph_openairoute now also includes theendnode in its nodes list.Not changed. The step description says "a config dict with actors key but no type field" — this correctly refers to the top-level config dict, which has
actors,name, andcleveragentskeys but notypefield at the top level. The"type": "llm"insideactors.defaultis the sub-actor's own type, which is required and correct for the sub-actor config within a multi-actor bundle. The test is doing exactly what its description says.Fixed. The assertion has been changed from
"." in node.node_id or node.node_id.startswith("default")tonode.node_id.startswith("default."). This correctly verifies that node IDs are prefixed with the default actor name followed by a dot separator, matching the step description.Approved!
866e08751cab17407576