Files
cleveragents-core/features/project_context_cov3.feature
T
freemo 31472b5413 test(coverage): add Behave scenarios for 39 under-covered modules
Add Behave feature/step pairs that exercise uncovered branches across handlers, LSP, CLI, and service layers to reach the coverage gate.

ISSUES CLOSED: #1232
2026-03-31 21:47:12 +00:00

65 lines
3.6 KiB
Gherkin

Feature: Project context coverage round 3 (pccov3)
Additional Behave scenarios targeting specific uncovered lines in
src/cleveragents/cli/commands/project_context.py.
Covered lines:
- 156: _read_policy returns fresh default when _load_policy_json is None
- 175: _read_acms_config returns defaults when _load_policy_json is None
- 350: _simulate_context_assembly truncates fragment content >100 chars
- 674-675, 678: context_set rejects negative depth-gradient hop
- 864-869: context_show rich output displays execution environment info
Background:
Given a pccov3 in-memory database is initialized
And a project "local/pccov3-app" exists for pccov3
# --- Line 156: _read_policy returns ProjectContextPolicy() when raw is None ---
Scenario: _read_policy returns fresh default when no policy blob exists
When I pccov3 read the policy for "local/pccov3-app"
Then the pccov3 policy should be a default ProjectContextPolicy
And the pccov3 policy strategize_view should be None
And the pccov3 policy execute_view should be None
And the pccov3 policy apply_view should be None
# --- Line 175: _read_acms_config returns _default_acms_config() when raw is None ---
Scenario: _read_acms_config returns default config when no policy blob exists
When I pccov3 read the ACMS config for "local/pccov3-app"
Then the pccov3 ACMS config should equal the default ACMS config
# --- Line 350: content truncation in _simulate_context_assembly ---
Scenario: Simulate truncates fragment content longer than 100 characters
Given the pccov3 tier service has a fragment with long content for "local/pccov3-app"
When I pccov3 run simulate_context_assembly for "local/pccov3-app"
Then the pccov3 assembled fragments should have truncated content ending with "..."
# --- Lines 674-675, 678: negative depth-gradient hop ---
Scenario: Context set rejects negative depth-gradient hop value
When I pccov3 run context set on "local/pccov3-app" with depth-gradient "-1:5"
Then the pccov3 command should have exit code 1
And the pccov3 output should contain "hop must be a non-negative integer"
# --- Lines 864-869: execution environment info in context_show rich output ---
Scenario: Context show rich output displays execution environment and priority
Given I pccov3 seed execution environment "container" and priority "override" for "local/pccov3-app"
When I pccov3 run context show on "local/pccov3-app" without view
Then the pccov3 command should succeed
And the pccov3 output should contain "Execution Environment"
And the pccov3 output should contain "container"
And the pccov3 output should contain "override"
# --- Lines 864-869: only ee set, no priority ---
Scenario: Context show rich output displays execution environment without priority
Given I pccov3 seed execution environment "host" without priority for "local/pccov3-app"
When I pccov3 run context show on "local/pccov3-app" without view
Then the pccov3 command should succeed
And the pccov3 output should contain "Execution Environment"
And the pccov3 output should contain "host"
# --- Lines 864-869: only eep set, no ee ---
Scenario: Context show rich output displays priority without execution environment
Given I pccov3 seed priority "fallback" without execution environment for "local/pccov3-app"
When I pccov3 run context show on "local/pccov3-app" without view
Then the pccov3 command should succeed
And the pccov3 output should contain "Execution Environment"
And the pccov3 output should contain "fallback"