Files
cleveragents-core/features/plan_explain.feature
khyari hamza f66cb8d68e
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 16s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 18s
CI / security (pull_request) Successful in 31s
CI / typecheck (pull_request) Successful in 33s
CI / unit_tests (pull_request) Successful in 1m44s
CI / docker (pull_request) Successful in 44s
CI / integration_tests (pull_request) Successful in 2m53s
CI / coverage (pull_request) Successful in 3m51s
CI / benchmark-regression (pull_request) Successful in 24m19s
fix(cli): address review findings for plan explain and tree commands
- Remove global _PLAN_ID; generate per-step plan IDs on context (#8)
- Fix sham orphan test; build children_map from all decisions (#1)
- Delete dead constants; use _PATCH_RESUME_SVC_MOD in resume steps (#2)
- Remove dead _resolve_active_plan_id mock from _invoke_correct (#5)
- Make --mode/--guidance required Typer options (#3)
- Show alternatives by default; remove --show-alternatives flag (#4)
- Strengthen weak assertions on depth-limit and show-superseded (#6)
- Add negative assertions for error type conflation (#7)

ISSUES CLOSED: #174
2026-03-03 12:10:25 +00:00

142 lines
6.1 KiB
Gherkin

Feature: Plan explain and decision tree CLI commands
Validates the plan explain and plan tree commands including
formatting, filtering, and flag-controlled detail views.
# ------------------------------------------------------------------
# plan explain - default format
# ------------------------------------------------------------------
Scenario: Explain a decision with default format
Given a test decision for explain
When I build the explain dict with default options
Then the explain dict should contain key "decision_id"
And the explain dict should contain key "question"
And the explain dict should contain key "chosen"
And the explain dict should contain key "type"
And the explain dict should contain key "alternatives_considered"
And the explain dict should not contain key "rationale"
And the explain dict should not contain key "context_snapshot"
# ------------------------------------------------------------------
# plan explain - show-context
# ------------------------------------------------------------------
Scenario: Explain with show-context flag
Given a test decision with context snapshot for explain
When I build the explain dict with show-context enabled
Then the explain dict should contain key "context_snapshot"
And the context snapshot should contain key "hot_context_hash"
And the context snapshot should contain key "relevant_resources"
# ------------------------------------------------------------------
# plan explain - show-reasoning
# ------------------------------------------------------------------
Scenario: Explain with show-reasoning flag
Given a test decision with reasoning for explain
When I build the explain dict with show-reasoning enabled
Then the explain dict should contain key "rationale"
And the explain dict should contain key "actor_reasoning"
# ------------------------------------------------------------------
# plan explain - alternatives always included
# ------------------------------------------------------------------
Scenario: Explain includes alternatives by default
Given a test decision with alternatives for explain
When I build the explain dict with default options
Then the explain dict should contain key "alternatives_considered"
And the alternatives list should have 2 items
# ------------------------------------------------------------------
# plan explain - json format
# ------------------------------------------------------------------
Scenario: Explain with json format
Given a test decision for explain
When I format the explain dict as json
Then the json output should contain "decision_id"
And the json output should be valid json
# ------------------------------------------------------------------
# plan explain - yaml format
# ------------------------------------------------------------------
Scenario: Explain with yaml format
Given a test decision for explain
When I format the explain dict as yaml
Then the yaml output should contain "decision_id"
# ------------------------------------------------------------------
# plan explain - non-existent decision
# ------------------------------------------------------------------
Scenario: Explain for non-existent decision returns error marker
Given a non-existent decision id
Then the explain lookup should indicate not found
# ------------------------------------------------------------------
# plan tree - default format
# ------------------------------------------------------------------
Scenario: Tree with default format builds tree structure
Given a set of test decisions forming a tree
When I build the decision tree with default options
Then the tree should have at least 1 root node
And the first root node should have children
# ------------------------------------------------------------------
# plan tree - show-superseded
# ------------------------------------------------------------------
Scenario: Tree with show-superseded includes superseded decisions
Given a set of test decisions with superseded entries
When I build the decision tree with show-superseded enabled
Then the tree should include superseded decision nodes
# ------------------------------------------------------------------
# plan tree - depth limit
# ------------------------------------------------------------------
Scenario: Tree with depth limit restricts tree depth
Given a set of test decisions forming a deep tree
When I build the decision tree with depth 1
Then the root nodes should have no children
# ------------------------------------------------------------------
# plan tree - json format
# ------------------------------------------------------------------
Scenario: Tree with json format
Given a set of test decisions forming a tree
When I format the tree as json
Then the json tree output should be valid json
And the json tree output should contain "decision_id"
# ------------------------------------------------------------------
# plan tree - yaml format
# ------------------------------------------------------------------
Scenario: Tree with yaml format
Given a set of test decisions forming a tree
When I format the tree as yaml
Then the yaml tree output should contain "decision_id"
# ------------------------------------------------------------------
# plan tree - no decisions
# ------------------------------------------------------------------
Scenario: Tree for plan with no decisions
Given an empty list of decisions
When I build the decision tree with default options from empty list
Then the tree should be empty
# ------------------------------------------------------------------
# plan tree - filters superseded by default
# ------------------------------------------------------------------
Scenario: Tree filters out superseded decisions by default
Given a set of test decisions with superseded entries
When I build the decision tree with default options
Then the tree should not include superseded decision nodes