Feature: Project Context Policy Domain Model As a developer I want a project context policy model with view inheritance So that context filtering can be configured per ACMS phase # ---- Empty policy defaults ---- Scenario: Empty policy defaults to including everything When I create an empty project context policy Then the default view should include all resources And the default view should include all paths And the default view should have no file size limit And the default view should have no total size limit # ---- View inheritance ---- Scenario: Strategize inherits from default when not overridden Given a policy with only a default view When I resolve the view for phase "strategize" Then the resolved view should be the default view Scenario: Execute inherits from strategize when not overridden Given a policy with default and strategize views When I resolve the view for phase "execute" Then the resolved view should be the strategize view Scenario: Apply inherits from execute when not overridden Given a policy with default strategize and execute views When I resolve the view for phase "apply" Then the resolved view should be the execute view Scenario: Execute inherits from default when strategize is None Given a policy with only a default view When I resolve the view for phase "execute" Then the resolved view should be the default view Scenario: Apply falls through to default when all overrides are None Given a policy with only a default view When I resolve the view for phase "apply" Then the resolved view should be the default view Scenario: Resolve default phase returns default view Given a policy with only a default view When I resolve the view for phase "default" Then the resolved view should be the default view # ---- Override isolation ---- Scenario: Override at execute level does not affect strategize Given a policy with a custom execute view When I resolve the view for phase "strategize" Then the resolved view should be the default view Scenario: Override at execute returns execute view Given a policy with a custom execute view When I resolve the view for phase "execute" Then the resolved view should be the execute view # ---- Invalid phase name ---- Scenario: Invalid phase name raises error Given a policy with only a default view When I try to resolve the view for phase "invalid_phase" Then a context policy error should be raised And the context policy error should mention "Invalid phase" Scenario: Unknown phase name raises error Given a policy with only a default view When I try to resolve the view for phase "plan" Then a context policy error should be raised And the context policy error should mention "Invalid phase" # ---- Include/exclude resource patterns ---- Scenario: Include resources filters correctly When I create a context view with include resources "db-*,cache-*" Then the context view should have 2 include resources Scenario: Exclude resources filters correctly When I create a context view with exclude resources "temp-*" Then the context view should have 1 exclude resource Scenario: Combined include and exclude resources When I create a context view with include "db-*" and exclude "db-test" Then the context view should have 1 include resource And the context view should have 1 exclude resource # ---- Include/exclude path globs ---- Scenario: Include paths accepts globs When I create a context view with include paths "src/**/*.py,tests/**" Then the context view should have 2 include paths Scenario: Exclude paths accepts globs When I create a context view with exclude paths "*.pyc,__pycache__/**" Then the context view should have 2 exclude paths # ---- Size limit validation ---- Scenario: Valid max file size is accepted When I create a context view with max file size 1048576 Then the context view max file size should be 1048576 Scenario: None max file size means no limit When I create a context view with no file size limit Then the context view max file size should be None Scenario: Zero max file size raises error When I try to create a context view with max file size 0 Then a context policy error should be raised And the context policy error should mention "positive integer" Scenario: Negative max file size raises error When I try to create a context view with max file size -100 Then a context policy error should be raised And the context policy error should mention "positive integer" Scenario: Valid max total size is accepted When I create a context view with max total size 10485760 Then the context view max total size should be 10485760 Scenario: Zero max total size raises error When I try to create a context view with max total size 0 Then a context policy error should be raised And the context policy error should mention "positive integer" Scenario: Negative max total size raises error When I try to create a context view with max total size -50 Then a context policy error should be raised And the context policy error should mention "positive integer" # ---- Serialization round-trip ---- Scenario: Policy survives JSON round-trip Given a fully populated context policy When I serialize and deserialize the policy Then the deserialized policy should match the original # ---- ContextView model_dump ---- Scenario: ContextView model_dump has expected keys When I create a context view with defaults Then the context view dump should have key "include_resources" And the context view dump should have key "exclude_resources" And the context view dump should have key "include_paths" And the context view dump should have key "exclude_paths" And the context view dump should have key "max_file_size" And the context view dump should have key "max_total_size"