Files
cleveragents-core/features/project_context_cov3.feature
freemo e05a577090
CI / lint (pull_request) Successful in 19s
CI / quality (pull_request) Successful in 32s
CI / typecheck (pull_request) Successful in 55s
CI / security (pull_request) Successful in 1m2s
CI / build (pull_request) Successful in 24s
CI / helm (pull_request) Successful in 23s
CI / unit_tests (pull_request) Failing after 6m27s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 17m25s
CI / integration_tests (pull_request) Successful in 23m0s
CI / coverage (pull_request) Successful in 10m52s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 58m22s
fix(acms): align DEFAULT_SKELETON_RATIO default value with spec
Align all DEFAULT_SKELETON_RATIO / _DEFAULT_SKELETON_RATIO constants
to the spec-required value of 0.15 (docs/specification.md line 35294).

Previously three modules used divergent defaults:
- skeleton_compressor.py: 0.3 (2x the spec value)
- depth_breadth_projection.py: 0.2 (33% above spec)
- project_context.py: 0.2 (33% above spec)

This caused child plans to receive 2-3x more skeleton context than
intended, and produced inconsistent behaviour depending on whether
skeleton compression was invoked via the CLI or the service layer.

Changes:
- Set DEFAULT_SKELETON_RATIO = 0.15 in skeleton_compressor.py
- Set DEFAULT_SKELETON_RATIO = 0.15 in depth_breadth_projection.py
- Set _DEFAULT_SKELETON_RATIO = 0.15 in project_context.py
- Update Behave feature tests to assert the 0.15 default value
- Add new scenario to project_context_cov3.feature asserting
  _DEFAULT_SKELETON_RATIO == 0.15 in _default_acms_config()

ISSUES CLOSED: #2909
2026-04-05 08:22:36 +00:00

70 lines
3.8 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"
# --- _DEFAULT_SKELETON_RATIO spec alignment ---
Scenario: Default ACMS config skeleton_ratio matches spec value of 0.15
When I pccov3 read the ACMS config for "local/pccov3-app"
Then the pccov3 ACMS config skeleton_ratio should be 0.15