Files
cleveragents-core/features/project_context_phase_analysis.feature
T
HAL9000 6b95320d5f fix(acms): normalize context path matching for absolute paths in _path_matches
Fixes issue #10972 where _path_matches() in execute_phase_context_assembler.py
used PurePath.full_match(pattern) which required the entire path to match.
Since fragment metadata stores absolute paths (e.g. /app/.opencode/skills/
SKILL.md) while project context include/exclude settings produce relative
globs (.opencode/**, docs/*), the include/exclude filters were silently
ineffective.

Added _glob_matches() static helper in execute_phase_context_assembler.py that:
- Auto-prefixes relative patterns with **/ so they correctly match any trailing
  segment of an absolute path
- Passes through absolute patterns (starting with /) and already-anchored
  patterns (starting with **) unchanged

Updated _path_matches() to delegate to _glob_matches(). Fixed _matches_pattern()
in context_phase_analysis.py with the same auto-prefix logic plus zero-depth
compatibility shim.

Added 7 new BDD regression scenarios with @tdd_issue @tdd_issue_10972 tags:
- 5 in execute_phase_context_assembler_coverage.feature (absolute path matching)
- 1 extra trailing ** glob exclusion test
- 1 in project_context_phase_analysis.feature (phase analysis exclusion)

Updated CHANGELOG.md under [Unreleased] and CONTRIBUTORS.md.

ISSUES CLOSED: #10972
2026-06-13 15:07:27 -04:00

48 lines
2.4 KiB
Gherkin

Feature: Project context phase analysis summaries
As a developer
I want per-phase ACMS context analysis summaries
So that strategize/execute/apply scope narrowing is visible and actionable
Scenario: Empty context still produces per-phase summaries
Given a phase analysis policy with narrowing limits
And no tiered fragments for phase analysis
When I compute project context phase analysis with budget 2000
Then each phase summary should include resource and size metrics
And phase analysis should report monotonic narrowing
Scenario: Single resource context produces human-readable summaries
Given a phase analysis policy with narrowing limits
And a single resource fragment for phase analysis
When I compute project context phase analysis with budget 2000
Then each phase summary should include human-readable text
And strategize phase should include at least one fragment
Scenario: Multiple resources are counted in summaries
Given a phase analysis policy with narrowing limits
And multiple resource fragments for phase analysis
When I compute project context phase analysis with budget 2000
Then strategize phase resource count should be 2
Scenario: Budget constraints reduce execute and apply scope
Given a phase analysis policy with narrowing limits
And budget constrained fragments for phase analysis
When I compute project context phase analysis with budget 1000
Then execute phase should have fewer tokens than strategize phase
And apply phase should have fewer or equal tokens than execute phase
# ---- Absolute path matching regression tests (issue #10972) ----
@tdd_issue @tdd_issue_10972
Scenario: Absolute path fragments are correctly excluded by relative exclude globs
Given a phase analysis policy with opencode exclude paths
And an absolute path fragment for phase analysis
When I compute project context phase analysis with budget 2000
Then strategize phase should exclude the absolute path fragment
@tdd_issue @tdd_issue_10972
Scenario: absolute path excluded by relative exclude glob in phase analysis
Given a phase analysis policy with narrow include_paths "src/**" and strict exclude_paths ".opencode/**"
And an absolute-path fragment for phase analysis at "/app/.opencode/skills/SKILL.md"
When I compute project context phase analysis with budget 2000
Then the fragment should be excluded because its path does not match include paths