Files
cleveragents-core/features/execute_decision_recording.feature
HAL9000 4768d6d6dd
CI / lint (pull_request) Successful in 58s
CI / typecheck (pull_request) Successful in 1m7s
CI / security (pull_request) Successful in 1m8s
CI / push-validation (pull_request) Successful in 37s
CI / build (pull_request) Successful in 51s
CI / helm (pull_request) Successful in 53s
CI / quality (pull_request) Successful in 1m17s
CI / unit_tests (pull_request) Successful in 5m31s
CI / docker (pull_request) Successful in 1m42s
CI / integration_tests (pull_request) Successful in 9m8s
CI / coverage (pull_request) Successful in 9m28s
CI / status-check (pull_request) Successful in 4s
fix(decisions): refactor ExecutePhaseDecisionHook to shared _record helper
The seven record_* methods previously each duplicated the validate +
snapshot + record + log + except pattern, inflating uncovered-line
counts and producing ruff-format violations. Centralise that boilerplate
in a single _record helper; each public method now delegates with just
the decision type + log label.

Also realigns features/execute_decision_recording.feature with its
steps: split combined Then steps, fix alt=/alts= mismatch, change
mentions "X" to mentions="X", and add a missing space in the
res_select scenario. Adds hardcoded steps for the empty-string error
cases (behave's `{q}` placeholder needs >=1 char), plus scenarios for
plan_id construction validation and whitespace-only inputs.

Fixes the CI / lint failure (ruff format) and the CI / unit_tests
failure (11 errored scenarios in execute_decision_recording.feature).

ISSUES CLOSED: #8477
2026-06-13 18:50:14 -04:00

74 lines
3.4 KiB
Gherkin

Feature: ExecutePhaseDecisionHook records execute-phase decisions
As a developer
I want decisions during the Execute phase recorded via ExecHook
So that Strategize+Execute form a single unified decision tree
Background:
Given dexe plan "P1" ULID and service initialized
And an ExecHook created for plan "P1" with parent None
Scenario: Record implementation choice via ExecHook
When dexe record impl_choice question="Which sort?" chosen="Quick"
Then dexe decision recorded successfully type="implementation_choice"
And dexe decision recorded successfully phase="execute"
Scenario: Record tool invocation via ExecHook
When dexe record tool_inv q="Tool?" tool_write="file_tool"
Then dexe decision recorded successfully type="tool_invocation"
Scenario: Record error recovery via ExecHook
When dexe record error_recove q="File miss" action_ret="Retry"
Then dexe decision recorded successfully type="error_recovery"
And dexe decision recorded successfully phase="execute"
Scenario: Record validation response via ExecHook
When dexe record val_respond q="Lint fail" fix="Manual"
Then dexe decision recorded successfully type="validation_response"
Scenario: Record subplan spawn via ExecHook (Execute)
When dexe record sub_spawn q="Extra transform" chosen="ChildPlan"
Then dexe decision recorded successfully type="subplan_spawn"
And dexe decision recorded successfully phase="execute"
Scenario: Record parallel subplan spawn via ExecHook
When dexe record par_spawn alt="SeqTrans" chosen="ParallelGroup"
Then dexe decision recorded successfully type="subplan_parallel_spawn"
Scenario: Record resource selection via ExecHook (Execute)
When dexe record res_select q="Files?" chosen="src/*.py,tests/*.py"
Then dexe decision recorded successfully type="resource_selection"
And dexe decision recorded successfully phase="execute"
Scenario: Decision with alternatives and confidence
When dexe record impl_choice question="Sort?" alts="Merge|Heap|Quick" chosen="Quick" conf=0.8
Then dexe decision recorded successfully alternatives_count=3
And dexe decision recorded successfully confidence_score=0.8
Scenario: Capture context snapshot hash
When dexe record impl_choice question="ctx test" chose="A" with_context_json=1
Then dexe decision recorded successfully snapshot_hash_not_empty=True
Scenario: Empty question raises ValidationError
When dexe record impl_choice question="" chosen="X" expect_error=True
Then dexe validation error raised mentions="question"
Scenario: Whitespace question raises ValidationError
When dexe record impl_choice question=" " chosen="X" expect_error=True
Then dexe validation error raised mentions="question"
Scenario: Empty chosen_option raises ValidationError
When dexe record tool_inv q="Q" tool_write="" expect_error=True
Then dexe validation error raised mentions="chosen_option"
Scenario: Whitespace chosen_option raises ValidationError
When dexe record tool_inv q="Q" tool_write=" " expect_error=True
Then dexe validation error raised mentions="chosen_option"
Scenario: Empty plan_id raises ValidationError on construction
When dexe construct hook with empty plan_id
Then dexe validation error raised mentions="plan_id"
Scenario: Whitespace plan_id raises ValidationError on construction
When dexe construct hook with whitespace plan_id
Then dexe validation error raised mentions="plan_id"