Files
cleveragents-core/features/bridge_remaining_coverage.feature
T
freemo 2eb31a598c
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 19s
CI / security (pull_request) Successful in 36s
CI / typecheck (pull_request) Successful in 38s
CI / integration_tests (pull_request) Successful in 2m44s
CI / lint (push) Successful in 12s
CI / quality (push) Successful in 16s
CI / build (push) Successful in 23s
CI / typecheck (push) Successful in 31s
CI / security (push) Successful in 32s
CI / benchmark-regression (push) Has been skipped
CI / integration_tests (push) Successful in 3m25s
CI / unit_tests (pull_request) Successful in 13m3s
CI / docker (pull_request) Successful in 1m2s
CI / benchmark-publish (push) Successful in 16m35s
CI / benchmark-regression (pull_request) Successful in 22m21s
CI / unit_tests (push) Successful in 24m45s
CI / docker (push) Successful in 8s
CI / coverage (pull_request) Successful in 1h1m47s
CI / coverage (push) Successful in 1h11m37s
test(coverage): add Behave BDD tests for 8 under-covered modules
Added targeted Behave BDD feature files and step definitions to improve
unit test coverage for:

- decision_service.py: Full coverage of all 7 service methods (18 scenarios)
- plan_apply_service.py: Branch coverage for handle_merge_failure (2 scenarios)
- plan_executor.py: Edge cases for rollback, checkpoint, and parse_steps (15 scenarios)
- cli/commands/plan.py: Uncovered region lines 1950-2273 (23 scenarios)
- repositories.py: Remaining missed branches and lines (14 scenarios)
- sandbox/checkpoint.py: Full coverage of CheckpointManager (26 scenarios)
- langgraph/bridge.py: Remaining uncovered lines and branches (10 scenarios)
- cli/commands/config.py: Safety net to maintain 100% coverage (42 scenarios)

Total: 150 new scenarios, 596 steps, all passing.

Also fixed a step definition collision in plan_lifecycle_coverage by renaming
"the delete result should be false" to "the plan delete result should be false".

ISSUES CLOSED: #475
2026-03-01 03:09:51 +00:00

64 lines
3.5 KiB
Gherkin

Feature: Bridge remaining coverage gaps
As a developer
I want targeted tests for remaining missed lines and branches in bridge.py
So that coverage approaches 100%
# Targets: line 35 (cancellation_reasons init), line 68 (task.cancel in async cleanup),
# lines 201-204 (string content branch in execute_graph),
# branches 3938, 6768, 182184, 260258
Scenario: Cancellation reason is recorded when cancelling a tracked task
Given a bridge instance prepared for cancellation reason tracking
When I cancel a tracked task providing reason "user requested abort"
Then the bridge cancellation_reasons mapping should contain the task
And the stored reason should equal "user requested abort"
Scenario: Cancelling a None task raises a ValueError
Given a bridge instance prepared for cancellation reason tracking
When I try cancelling a None task with reason "some reason"
Then a ValueError mentioning "task must not be None" should be raised
Scenario: Cancelling a task with empty reason raises a ValueError
Given a bridge instance prepared for cancellation reason tracking
When I try cancelling a valid task with an empty reason string
Then a ValueError mentioning "reason must be a non-empty string" should be raised
Scenario: Async cleanup cancels a not-yet-done task on the bridge
Given a bridge holding a deliberately stalled coroutine task
When I perform async cleanup with a 200ms timeout on stalled tasks
Then every stalled task should have been cancelled or finished
And the bridge task tracking set should be empty after async cleanup
Scenario: Async cleanup handles already-completed tasks without error
Given a bridge holding an already-finished async task
When I perform async cleanup with a 200ms timeout on stalled tasks
Then the bridge task tracking set should be empty after async cleanup
Scenario: Graph executor inner coroutine processes string content directly
Given a bridge with a mock graph wired for direct coroutine invocation
When I invoke the executor coroutine with a plain string message body
Then the mock graph execute should have received a messages list with the string
And the executor coroutine should return a StreamMessage with graph metadata
Scenario: Graph executor inner coroutine processes list content as fallback
Given a bridge with a mock graph wired for direct coroutine invocation
When I invoke the executor coroutine with a list payload as message body
Then the mock graph execute should have received a content key wrapping the list
Scenario: Graph stream config includes correct type and publication fields
Given a bridge with a registered graph called "stream_verify"
When I obtain the stream configuration for graph "stream_verify"
Then the stream config name should equal "graph_stream_verify"
And the stream config publications should include "__output__"
Scenario: State checkpointer operator applies to a message for a valid graph
Given a bridge with a registered graph called "ckpt_valid"
And the graph "ckpt_valid" has a checkpoint directory configured
When I construct and apply the checkpointer operator for "ckpt_valid"
Then the checkpointer should have invoked _save_checkpoint on the state manager
Scenario: The __del__ method completes normally when cleanup_tasks succeeds
Given a fully functional bridge for destructor testing
When __del__ is called on the fully functional bridge
Then the __del__ call should complete without any error