# Quality Gates Mandatory gates before any implementation phase may be marked complete. All gates must **Pass**. On failure, enter the Automatic Repair Loop ([development-loop.md](development-loop.md)). ## Architecture | Check | Pass criteria | | --- | --- | | Boundaries | No ownership theft per [module-boundaries.md](../architecture/module-boundaries.md) | | DB isolation | No cross-DB queries/FKs ([ADR-001](../architecture/adr/ADR-001.md)) | | Layering | Business logic in services; thin API; persistence-only repos | | FE/BE | No backend imports in frontend; no UI rules in backend ([ADR-002](../architecture/adr/ADR-002.md)) | | ADR | New architectural decisions recorded; conflicts resolved | | Events | Outbox-ready; naming per [event-template.md](event-template.md) | ## Security | Check | Pass criteria | | --- | --- | | Auth | Protected routes deny anonymous access | | Secrets | No hardcoded credentials/brand tokens | | Errors | No stack/secret leakage | | Providers | Credentials only in owning service config | | Align | [security-architecture.md](../architecture/security-architecture.md) | ## Performance | Check | Pass criteria | | --- | --- | | Queries | Tenant-scoped lists use sensible indexes; no obvious N+1 in new hot paths | | Hot paths | Covered or explicitly N/A in phase doc | | Async | Long-running provider I/O not blocking business transactions when architecture requires async | ## Testing | Check | Pass criteria | | --- | --- | | Suite | Required tests from [testing-template.md](testing-template.md) exist and pass | | Strategy | Aligns with [testing-strategy.md](../development/testing-strategy.md) | | Claims | Every claimed deliverable has coverage | ## Documentation | Check | Pass criteria | | --- | --- | | Updates | [documentation-template.md](documentation-template.md) checklist done | | Links | No broken relative links in touched docs | | Registries | Module/provider/manifests consistent with code | | Glossary | New terms defined when introduced | | No TODO | No TODO for claimed deliverables | ## Migration | Check | Pass criteria | | --- | --- | | Alembic | Revision exists for schema changes in owning service | | Apply | Upgrade smoke succeeds | | Ownership | Only owning DB migrated | | Notes | Handover includes migration notes | ## Backward Compatibility | Check | Pass criteria | | --- | --- | | APIs | Additive within version unless phase documents breaking change + consumer plan | | Events | No silent meaning change of existing `event_type` | | Data | Existing rows remain valid or backfill documented | ## Tenant Isolation | Check | Pass criteria | | --- | --- | | Schema | Business tables have `tenant_id` ([ADR-003](../architecture/adr/ADR-003.md)) | | Queries | Filters applied | | Tests | Cross-tenant denial covered | | Admin exceptions | Explicit and audited | ## Validation Suites (Framework Phases) When changing `docs/ai-framework/` or docs structure, also verify: 1. **Architecture Validation** — framework links to architecture/ADR correctly; no conflicting rules vs principles. 2. **Documentation Validation** — all listed framework docs exist; index complete. 3. **Cross Reference Validation** — manifests ↔ registries ↔ phase areas agree on names/status where claimed. 4. **Broken Link Validation** — relative Markdown links resolve. 5. **Template Validation** — every template referenced from README exists and has Related Documents. 6. **Manifest Validation** — YAML parses; required fields present; phase/service IDs unique. ## Sign-Off - [ ] Architecture - [ ] Security - [ ] Performance - [ ] Testing - [ ] Documentation - [ ] Migration - [ ] Backward Compatibility - [ ] Tenant Isolation ## Related Documents - [Development Loop](development-loop.md) - [Master Prompt](master-prompt.md) - [docs/README.md](../README.md) Phase Completion Gate - [Project Principles](../development/project-principles.md)