Skip to main content

Overview

AIOX implements a three-layer quality gate system that validates code at multiple checkpoints before it reaches production. Each layer has distinct responsibilities, automation levels, and enforcement mechanisms.
Design Philosophy: Shift quality left - catch issues as early as possible when they’re cheapest to fix.

Layer 1: Pre-Commit Validation

Purpose

Prevent broken code from ever being committed to the repository.

Enforcement

Local Git Hooks (.aiox-core/hooks/pre-commit) Automated: Yes (100%) Agent Responsible: @dev (Dex)

Validation Checks

Command: npm run lintPurpose: Enforce coding standards and catch common errorsChecks:
  • Code style consistency
  • Unused variables
  • Potential bugs (e.g., missing await)
  • Import order
  • Absolute vs relative imports (Constitution: Absolute Imports)
Configuration: .eslintrc.jsSeverity: BLOCK (must pass)
Command: npm run typecheckPurpose: Validate type safety across the codebaseChecks:
  • Type errors
  • Missing type definitions
  • Incorrect function signatures
  • Null/undefined handling
Configuration: tsconfig.jsonSeverity: BLOCK (must pass)
Command: npm testPurpose: Verify functionality and prevent regressionsChecks:
  • All tests pass
  • Coverage >= previous level (no regression)
  • No flaky tests (consistent results)
Framework: Jest, Vitest, or project-specificSeverity: BLOCK (must pass)
Command: npm run buildPurpose: Ensure code compiles and builds successfullyChecks:
  • TypeScript compilation
  • Asset bundling
  • Tree-shaking optimization
  • No build warnings
Severity: BLOCK (must pass)

Metrics Collection

Layer 1 runs are tracked in .aiox/data/quality-metrics.json:

Bypass (Emergency Only)

Bypassing Layer 1 requires human approval and must be documented in the commit message with justification.

Layer 2: PR Automation

Purpose

Automated review and validation in the CI/CD pipeline before human review.

Enforcement

GitHub Actions (.github/workflows/) CodeRabbit AI Review Automated: Yes (100%) Agent Responsible: @devops (Felix) + Quinn (@qa)

Validation Checks

GitHub Actions Workflow:
Multi-Environment Testing:
  • Node 18, 20, 22
  • Ubuntu, macOS, Windows
  • Different dependency versions

Auto-Catch Rate

Layer 2 tracks how many issues are caught automatically vs. requiring human intervention:
Auto-Catch Rate = Issues detected by automation / Total issues (automation + human) Target: ≥ 70% (current: 73%)

Layer 3: Human Review

Purpose

Final architectural validation and business logic review by human experts.

Enforcement

GitHub PR Review (required approvals) Automated: No Responsible: Human reviewers (architects, senior developers)

Review Criteria

Reviewers: @architect (Aria) + human architectsChecks:
  • Design aligns with system architecture
  • No architectural anti-patterns introduced
  • Dependency directions correct
  • Module boundaries respected
  • Technical debt documented if introduced
Questions to Ask:
  • Does this change fit our architectural vision?
  • Are there simpler alternatives?
  • What are the long-term maintenance implications?
Reviewers: Product team + domain expertsChecks:
  • Implementation matches business requirements
  • Edge cases align with business rules
  • User experience considerations addressed
  • Regulatory/compliance requirements met
Questions to Ask:
  • Does this solve the actual user problem?
  • Are there business scenarios not covered?
  • What happens if this fails in production?
Reviewers: Security team (for sensitive changes)Checks:
  • No hardcoded secrets or credentials
  • Input validation on all user data
  • Authentication/authorization correct
  • Data encryption where required
  • Audit logging for sensitive operations
Triggered for:
  • Authentication/authorization changes
  • Database schema changes
  • External API integrations
  • Payment processing
Reviewers: Team members who will maintain the codeChecks:
  • Code is understandable to team
  • Documentation explains “why” not just “what”
  • Complex logic has explanatory comments
  • Runbook updated if operational changes
Questions to Ask:
  • Can someone else debug this at 2am?
  • Is the reasoning behind decisions documented?
  • Are there gotchas that need explanation?

Approval Workflow

Required Approvals: Configurable (default: 1 for standard changes, 2 for architectural) Review SLA:
  • Standard changes: 24 hours
  • Urgent hotfixes: 4 hours
  • Architectural changes: 48 hours

Metrics Collection

Quality Metrics Dashboard

Viewing Metrics

Quality Gate Schema

All metrics conform to the schema defined in .aiox-core/quality/schemas/quality-metrics.schema.json:

Metrics Collector API

Programmatic access to quality metrics:
See .aiox-core/quality/metrics-collector.js for full API documentation.

Constitution Enforcement

Quality gates enforce Constitution principles:

Best Practices

Always run quality checks locally before pushing:
This catches issues before they trigger CI failures.
Don’t accumulate quality debt:
  • Fix linting issues as you code (use IDE integration)
  • Write tests alongside implementation (TDD)
  • Address CodeRabbit findings immediately
  • Don’t defer minor issues to “later”
Quality over quantity:Good:
Bad (False Coverage):
Before requesting review:
  1. Review your own diff on GitHub
  2. Check for:
    • Debug statements left in
    • Commented-out code
    • TODO comments
    • Accidental file inclusions
  3. Add PR description with context
  4. Link to story: “Closes #123”

Troubleshooting

Issue: Layer 1 hook not runningCause: Git hooks not installedResolution:
Issue: CI passes but local tests failCause: Dependency version mismatch or environment differencesResolution:
Issue: CodeRabbit findings overwhelmingResolution:
  • Address CRITICAL and HIGH severity first
  • Group similar findings and fix in batch
  • Request human review to waive non-critical items
  • Consider adding CodeRabbit config to tune sensitivity

Metrics Retention

History is retained for 30 days by default (configurable):

Next Steps

Development Cycle

See how quality gates integrate into the development workflow

Constitution

Review the principles enforced by quality gates

Agent: QA

Learn about Quinn’s review methodology

Metrics Collector

API documentation for programmatic metrics access