# Test and Quality Plan

## 1. Testing Objective

Guarantee that new proposal-path capabilities do not regress existing manual flow authoring and deterministic runtime behavior.

## 2. Test Layers

## 2.1 Unit Tests

Scope:
1. Schema constraints for proposals and events
2. Lifecycle transition guard logic
3. Normalizer mapping rules
4. Validator policy checks

Required Coverage:
1. Happy path transitions
2. Invalid transition rejection
3. Invalid graph contract rejection
4. Policy violations

## 2.2 Integration Tests

Scope:
1. API create/get/approve/reject/open lifecycle
2. Authz checks
3. Feature flag checks
4. Flow draft opening from approved proposal

Required Coverage:
1. Proposal lifecycle end-to-end
2. Approval blocked when validation fails
3. Rejection path captures reason event

## 2.3 Regression Tests

Scope:
1. Existing manual flow create/save/publish
2. Existing route lookup and deterministic execution path
3. Existing adapter invocation behavior

Required Coverage:
1. No regression in current flow builder behavior
2. No regression in publish-to-route behavior

## 3. Quality Gates

1. All unit tests pass
2. API integration suite pass
3. Regression suite pass for current manual path
4. Static diagnostics pass for changed files
5. Release checklist complete

## 4. Data Fixtures

1. Valid proposal fixture (simple request-adapter-response)
2. Valid proposal with decision branching
3. Invalid node type fixture
4. Invalid edge type fixture
5. Policy-violating adapter fixture

## 5. Exit Criteria for Production Rollout

1. Zero known blocker defects
2. No open high-severity security findings
3. No regression failures in manual flow path
4. Telemetry and logs verified in staging

## 6. Defect Triage Policy

1. Blocker or critical: fix in sprint, no rollout
2. Major: fix before tenant expansion
3. Minor: backlog with owner and due sprint
