Files
cleveragents-core/features/plan_cli_spec_print_r2.feature
T
freemo 3a2b134f3c test(coverage): add Behave scenarios for remaining under-tested modules
Added Behave BDD feature files and step definitions targeting coverage
gaps in six modules:

- container.py: exercise get_database_url env-var fallback, AI provider
  None path, cached container singleton, override_providers edge cases
  (lines 66-69, 125-130; branches at 51, 57, 82, 87, 256, 284-288)
- correction_service.py: exercise exception-handling paths in
  execute_revert and execute_append via monkeypatched analyze_impact
  and ULID failures (lines 254-262, 320-328)
- plan_lifecycle_service.py: exercise _persisted UoW commit paths,
  InvalidPhaseTransitionError custom message branch, non-reusable
  action archive, and error_details merge logic (branches at 100,
  216, 237, 327, 461, 570, 576, 607)
- plan.py (CLI): exercise spec-dict optional field branches,
  _print_lifecycle_plan conditional rendering, use_action argument
  parsing, auto-resolve paths, legacy wrappers, and validation
  error branches across 66 scenarios
- skill.py (CLI): exercise singleton cache, timestamp-absent show,
  no-tools MCP, add/remove/list/show format and error branches
  across 26 scenarios
- models.py (DB): exercise to_domain/from_domain None-field branches
  in SkillModel, SessionModel, ToolModel, LifecycleActionModel,
  LifecyclePlanModel, NamespacedProjectModel, and SessionMessageModel
  across 41 scenarios

All 302 features, 6503 scenarios, 28271 steps pass (nox -e unit_tests).

ISSUES CLOSED: #446
2026-02-25 19:38:43 -05:00

191 lines
9.0 KiB
Gherkin
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Feature: Plan CLI spec dict and print branch coverage (round 2)
As a developer
I want to exercise uncovered branches in _plan_spec_dict and _print_lifecycle_plan
So that branch coverage for spec-dict and print logic rises above the current level
# ===================================================================
# _plan_spec_dict project link alias / read_only branches
# ===================================================================
Scenario: r2plan spec dict includes alias in project link
Given r2plan-a v3 Plan with a project link that has alias "backend"
When r2plan-I call _plan_spec_dict
Then r2plan-the spec dict project_links should include alias "backend"
Scenario: r2plan spec dict includes read_only in project link
Given r2plan-a v3 Plan with a project link that is read_only
When r2plan-I call _plan_spec_dict
Then r2plan-the spec dict project_links should include read_only true
Scenario: r2plan spec dict omits alias and read_only when unset
Given r2plan-a v3 Plan with a plain project link
When r2plan-I call _plan_spec_dict
Then r2plan-the spec dict project_links should not include alias
And r2plan-the spec dict project_links should not include read_only
# ===================================================================
# _plan_spec_dict automation_profile truthy / falsy
# ===================================================================
Scenario: r2plan spec dict includes automation_profile when set
Given r2plan-a v3 Plan with automation_profile "review"
When r2plan-I call _plan_spec_dict
Then r2plan-the spec dict automation_profile should be "review"
Scenario: r2plan spec dict has null automation_profile when unset
Given r2plan-a v3 Plan without automation_profile
When r2plan-I call _plan_spec_dict
Then r2plan-the spec dict automation_profile should be null
# ===================================================================
# _plan_spec_dict invariants, validation_summary/dod
# ===================================================================
Scenario: r2plan spec dict includes invariants when present
Given r2plan-a v3 Plan with invariants
When r2plan-I call _plan_spec_dict
Then r2plan-the spec dict should contain key "invariants"
And r2plan-the spec dict invariants count should be 2
Scenario: r2plan spec dict omits invariants when empty
Given r2plan-a v3 Plan without invariants
When r2plan-I call _plan_spec_dict
Then r2plan-the spec dict should not contain key "invariants"
Scenario: r2plan spec dict includes dod_evaluation when validated
Given r2plan-a v3 Plan with dod validation summary
When r2plan-I call _plan_spec_dict
Then r2plan-the spec dict should contain key "dod_evaluation"
And r2plan-the spec dict dod_evaluation all_passed should be true
Scenario: r2plan spec dict omits dod_evaluation when no validation
Given r2plan-a v3 Plan without validation_summary
When r2plan-I call _plan_spec_dict
Then r2plan-the spec dict should not contain key "dod_evaluation"
# ===================================================================
# _plan_spec_dict last_completed_step / last_checkpoint_id
# ===================================================================
Scenario: r2plan spec dict includes last_completed_step when >= 0
Given r2plan-a v3 Plan with last_completed_step 3
When r2plan-I call _plan_spec_dict
Then r2plan-the spec dict should contain key "last_completed_step"
And r2plan-the spec dict last_completed_step should be 3
Scenario: r2plan spec dict omits last_completed_step when -1
Given r2plan-a v3 Plan with last_completed_step default
When r2plan-I call _plan_spec_dict
Then r2plan-the spec dict should not contain key "last_completed_step"
Scenario: r2plan spec dict includes last_checkpoint_id when set
Given r2plan-a v3 Plan with last_checkpoint_id "01CHKPT001"
When r2plan-I call _plan_spec_dict
Then r2plan-the spec dict should contain key "last_checkpoint_id"
Scenario: r2plan spec dict omits last_checkpoint_id when None
Given r2plan-a v3 Plan without last_checkpoint_id
When r2plan-I call _plan_spec_dict
Then r2plan-the spec dict should not contain key "last_checkpoint_id"
# ===================================================================
# _print_lifecycle_plan definition_of_done branches
# ===================================================================
Scenario: r2plan print shows definition_of_done when short
Given r2plan-a v3 Plan with definition_of_done "All tests pass"
When r2plan-I call _print_lifecycle_plan
Then r2plan-the printed output should contain "Definition of Done"
And r2plan-the printed output should contain "All tests pass"
Scenario: r2plan print truncates long definition_of_done
Given r2plan-a v3 Plan with definition_of_done longer than 200 chars
When r2plan-I call _print_lifecycle_plan
Then r2plan-the printed output should contain "Definition of Done"
And r2plan-the printed output should contain "..."
Scenario: r2plan print omits definition_of_done when None
Given r2plan-a v3 Plan without definition_of_done
When r2plan-I call _print_lifecycle_plan
Then r2plan-the printed output should not contain "Definition of Done"
# ===================================================================
# _print_lifecycle_plan validation_summary dod pass / fail
# ===================================================================
Scenario: r2plan print shows DoD PASSED evaluation
Given r2plan-a v3 Plan with dod evaluated as passed
When r2plan-I call _print_lifecycle_plan
Then r2plan-the printed output should contain "DoD Evaluation"
And r2plan-the printed output should contain "PASSED"
Scenario: r2plan print shows DoD FAILED evaluation with failures
Given r2plan-a v3 Plan with dod evaluated as failed
When r2plan-I call _print_lifecycle_plan
Then r2plan-the printed output should contain "DoD Evaluation"
And r2plan-the printed output should contain "FAILED"
And r2plan-the printed output should contain "failed"
# ===================================================================
# _print_lifecycle_plan arguments with/without order
# ===================================================================
Scenario: r2plan print shows arguments using arguments_order
Given r2plan-a v3 Plan with arguments and arguments_order
When r2plan-I call _print_lifecycle_plan
Then r2plan-the printed output should contain "Arguments"
And r2plan-the printed output should contain "target_coverage = 80"
Scenario: r2plan print shows arguments sorted when no order
Given r2plan-a v3 Plan with arguments but no arguments_order
When r2plan-I call _print_lifecycle_plan
Then r2plan-the printed output should contain "Arguments"
# ===================================================================
# _print_lifecycle_plan long description > 200 chars
# ===================================================================
Scenario: r2plan print truncates long description
Given r2plan-a v3 Plan with description longer than 200 chars
When r2plan-I call _print_lifecycle_plan
Then r2plan-the printed output should contain "..."
# ===================================================================
# _print_lifecycle_plan automation_profile
# ===================================================================
Scenario: r2plan print shows automation profile
Given r2plan-a v3 Plan with automation_profile "review"
When r2plan-I call _print_lifecycle_plan
Then r2plan-the printed output should contain "Automation Profile"
And r2plan-the printed output should contain "review"
# ===================================================================
# _print_lifecycle_plan invariants display
# ===================================================================
Scenario: r2plan print shows invariants
Given r2plan-a v3 Plan with invariants
When r2plan-I call _print_lifecycle_plan
Then r2plan-the printed output should contain "Invariants"
# ===================================================================
# _print_lifecycle_plan resume metadata
# ===================================================================
Scenario: r2plan print shows resume metadata
Given r2plan-a v3 Plan with resume metadata
When r2plan-I call _print_lifecycle_plan
Then r2plan-the printed output should contain "Last Completed Step"
And r2plan-the printed output should contain "Last Checkpoint"
# ===================================================================
# _print_lifecycle_plan project link alias and read_only
# ===================================================================
Scenario: r2plan print shows project link with alias and read_only
Given r2plan-a v3 Plan with project link alias and read_only
When r2plan-I call _print_lifecycle_plan
Then r2plan-the printed output should contain "alias:"
And r2plan-the printed output should contain "local/ref-data"