@wf02 @test_generation @trusted Feature: WF02 automated test generation for a module (trusted profile) As a developer using the trusted automation profile I want the system to generate tests for an under-covered module So that coverage improves without modifying production source code # -------------------------------------------------------------------------- # AC1: Trusted profile lifecycle gating (auto-run strategize + execute, # human gate on apply) # -------------------------------------------------------------------------- Scenario: Trusted profile auto-runs strategize and execute phases Given a WF02 lifecycle service with mock providers And the WF02 action "local/generate-tests" is registered And a trusted-profile plan for module "src/auth" with coverage target 80 When I auto-run the WF02 plan Then the plan should be in the execute phase And the plan processing state should be complete And the plan automation profile should be "trusted" # -------------------------------------------------------------------------- # AC2: Action definition carries correct invariants # -------------------------------------------------------------------------- Scenario: WF02 action carries production-code and naming invariants Given a WF02 lifecycle service with mock providers And the WF02 action "local/generate-tests" is registered And a trusted-profile plan for module "src/auth" with coverage target 80 Then the plan should carry an invariant containing "Do not modify any production code" And the plan should carry an invariant containing "test file naming convention" And the plan should carry an invariant containing "test fixtures and conftest.py patterns" # -------------------------------------------------------------------------- # AC3: Path safety guardrails reject unsafe output destinations # -------------------------------------------------------------------------- Scenario: Path guardrail rejects absolute paths Given a temporary WF02 fixture repository When I validate the generated path "/tmp/test_abs.py" Then the path should be rejected with reason "must be relative" Scenario: Path guardrail rejects traversal paths Given a temporary WF02 fixture repository When I validate the generated path "../tests/test_escape.py" Then the path should be rejected with reason "escapes fixture root" Scenario: Path guardrail rejects non-test destinations Given a temporary WF02 fixture repository When I validate the generated path "src/test_not_allowed.py" Then the path should be rejected with reason "must stay in tests/" Scenario: Path guardrail accepts valid test paths Given a temporary WF02 fixture repository When I validate the generated path "tests/test_auth_new.py" Then the path should be accepted # -------------------------------------------------------------------------- # AC4: Generated artifacts follow naming and scope conventions # -------------------------------------------------------------------------- Scenario: Generated test files follow project conventions Given a WF02 lifecycle service with mock providers And the WF02 action "local/generate-tests" is registered And a trusted-profile plan for module "src/auth" with coverage target 80 When I generate tests from the mock provider with coverage suite Then all generated file paths should start with "tests/" And all generated file paths should end with ".py" And all generated file names should start with "test_" And no generated file path should start with "src/"