AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-244
  5. plan
  6. plan.md
plan.md(2.7 KB)· Apr 2, 2026· 2 min read
  • Summary
  • Files
  • Steps
  • Verification
  • Risks

Plan: E2E Coverage for Pre-PR Quality Gate (#231)#

Summary#

Add E2E tests verifying the pre-PR quality gate lifecycle: blocking at the deliver phase, bypassing via skip-quality-gate directive, normal pass-through, and edge cases for malformed/unauthorized directive usage. Tests exercise the PhaseRouterService → DirectiveService → TaskStateService integration path with an in-memory SQLite database.

Files#

FileActionDescription
test/quality-gate.e2e-spec.tscreateE2E test suite for quality gate scenarios

Steps#

  1. Create test/quality-gate.e2e-spec.ts — set up a NestJS testing module with real TaskStateService (in-memory SQLite), real PhaseRouterService, real DirectiveService, and mocked ClaudeInvocationService, WorktreeService, ArtefactsService, PhaseHooksService, EventService, GitHubService. Follow patterns from test/task-state.e2e-spec.ts and test/integration/webhook-to-state.integration.spec.ts.

  2. Scenario: gate blocks deliver phase — create a task with directive=auto, advance to deliver phase via a non-directive event. Assert task.status === 'gated', task.gatePhase === 'deliver', and ClaudeInvocationService.invoke() was NOT called.

  3. Scenario: skip-quality-gate bypasses gate — create a task with directive=auto, apply skip-quality-gate via DirectiveService.applyDirective(). Assert task.qualityGateOverride === true. Then trigger the deliver phase with a directive event (approve). Assert ClaudeInvocationService.invoke() WAS called and env includes QUALITY_GATE_OVERRIDE=1. Assert override is consumed (task.qualityGateOverride === false after execution).

  4. Scenario: qualifying task passes normally — create a task with directive=quick (no gates). Trigger deliver phase. Assert ClaudeInvocationService.invoke() was called and task was NOT gated.

  5. Scenario: malformed skip-quality-gate edge cases — test that wrong casing or missing value in directive does not set qualityGateOverride. Assert the gate runs normally (blocks on its own merits for auto/careful directives).

  6. Add #231 traceability — include (#231) in the top-level describe block and individual test descriptions for grep-ability.

Verification#

  • npm run test -- --testPathPattern=quality-gate.e2e-spec passes all scenarios.
  • npm run lint passes with zero warnings.
  • grep -r '#231' test/quality-gate.e2e-spec.ts returns matches confirming traceability.

Risks#

  • The PhaseRouterService.route() method has multiple dependencies — the test module must mock all of them correctly or tests will fail on initialization. Mitigation: follow existing integration test patterns that already mock these services.
ContextPrd