TorbatYar/docs-runtime/ai-framework/quality-gates.md
Mortezakoohjani 5c6a2e78cf feat(platform): seed service registry, deploy all modules, and fix homepage catalog.
Register all active platform services and base features in core DB so admin can manage them, add delivery/hospitality/sports-center backend phases, update apps catalog and production deploy tooling.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 12:39:51 +03:30

9.6 KiB

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) and implement missing required artifacts — do not waive enterprise requirements.

Companions: enterprise-phase-discovery.md · definition-of-done.md · enterprise-completeness.md · boundary-rules.md · ADR-018 · ADR-019.

Enterprise Phase Discovery

Check Pass criteria
Record Discovery Record present in phase doc before Implementation claimed
Inputs Roadmap, Architecture, Boundaries, Prior handover, Codebase, APIs, Domain, Events, Permissions, Aggregates, Tests, Docs reviewed (or N/A justified for docs-only)
Gap analysis Missing Capability Checklist completed; CRUD-only rejected
Promotion Every Missing→Implement gap implemented before Complete
Boundaries No future-phase pull-forward; no foreign ownership; no service duplication
Align enterprise-phase-discovery.md

Business Completeness

Check Pass criteria
Capabilities Every in-scope / Discovery-promoted business capability delivered end-to-end
Not CRUD-only Domain rules, validators, policies/specs as needed beyond CRUD
DoD definition-of-done.md checklist complete for phase boundary
No future pull-forward Out of Scope / future phases untouched

Architecture

Check Pass criteria
Boundaries No ownership theft per module-boundaries.md and boundary-rules.md
DB isolation No cross-DB queries/FKs (ADR-001)
Layering Business logic in services/commands; thin API; persistence-only repos
FE/BE No backend imports in frontend; no UI rules in backend (ADR-002)
ADR New architectural decisions recorded; conflicts resolved
Events Outbox-ready; naming per event-template.md
Domain model Aggregates/entities/DTOs designed for in-scope work

API Completeness

Check Pass criteria
REST In-scope resources exposed with correct methods and DTOs
Health /health present for runnable services
Capabilities /capabilities (or equivalent) when discoverable features exist
Metrics /metrics or justified N/A with operational alternative
OpenAPI Generated/updated and accurate for new/changed routes
List UX Pagination, filtering, sorting, searching on collection endpoints
Permission APIs Permission tree registered; permission listing routes when service pattern requires

Permission Completeness

Check Pass criteria
Mapping Every privileged route has a permission check
Naming {service}.{resource}.{action} / {service}.* trees documented
Tests Denial cases covered

Event Completeness

Check Pass criteria
Emission Cross-service-relevant state changes write outbox events
Catalog event-catalog.md / registry updated
Envelope Stable envelope fields; additive payloads

Repository Completeness

Check Pass criteria
Tenant filter All tenant-owned queries scoped
Soft delete Defaults exclude soft-deleted rows where policy requires
List support Pagination/filter/sort/search supported as API requires
No domain logic Business branching stays in services

Validation Completeness

Check Pass criteria
Edge Pydantic request/query validation
Domain Validators / specifications / policies enforce invariants
Codes Stable error codes for illegal transitions

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

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 exist and pass
Strategy Aligns with testing-strategy.md
Claims Every claimed deliverable has coverage
Categories Unit · Integration · Architecture · Security · Tenant · Permission · Migration · Docs as applicable

Documentation

Check Pass criteria
Updates 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
OpenAPI Documented as part of API surface

Migration

Check Pass criteria
Alembic Revision exists for schema changes in owning service
Apply Upgrade smoke succeeds
Ownership Only owning DB migrated
Seed Seed data present when phase requires it
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)
Queries Filters applied
Tests Cross-tenant denial covered
Admin exceptions Explicit and audited

Provider Abstraction

Check Pass criteria
Protocols External systems behind interfaces in owning service
Registry provider-registry.md updated when providers change
No leakage Foreign platforms not implemented inside non-owning modules

Integration Completeness

Check Pass criteria
Channels Only API / Events / Providers used cross-service
No duplication Business logic not copied from owning services
No foreign DB Zero cross-DB access

Operational Readiness

Check Pass criteria
Health Liveness endpoint green
Observability Logging + metrics (or justified N/A)
Config Env/settings documented; no secrets in code
Jobs Background jobs present when phase requires async/scheduled work
Feature flags Present when gated capabilities are in scope

Maintainability & DX

Check Pass criteria
Patterns Matches sibling service conventions or documents intentional deviation
DI Explicit dependency injection
README Service README updated for new run/config surfaces
Scope hygiene No unrelated drive-by refactors

Definition of Done Gate

Check Pass criteria
DoD Full definition-of-done.md satisfied
Completeness enterprise-completeness.md sign-off complete
Artifacts Applicable mandatory-phase-artifacts.md delivered or justified N/A
Discovery enterprise-phase-discovery.md Record complete; gaps closed

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.
  7. Enterprise Rule Validation — DoD, Discovery, mandatory artifacts, completeness, and boundary docs are cross-linked from master-prompt, loop, gates, and phase template.

Sign-Off

  • Enterprise Phase Discovery
  • Business Completeness
  • Architecture
  • API Completeness
  • Permission Completeness
  • Event Completeness
  • Repository Completeness
  • Validation Completeness
  • Security
  • Performance
  • Testing
  • Documentation
  • Migration
  • Backward Compatibility
  • Tenant Isolation
  • Provider Abstraction
  • Integration Completeness
  • Operational Readiness
  • Maintainability & DX
  • Definition of Done / Enterprise Completeness