Skip to main content

Architecture Enforcement Matrix V1

This matrix turns architecture principles into enforceable controls.

Use it to decide whether a rule is guidance only, warning-level, or CI-blocking.

Enforcement Levels

  • AI Agent instruction and review guidance.
  • ESLint warn Local warning, non-blocking.
  • ESLint error Local hard failure.
  • CI gate Required check for merge.

Matrix

RuleAIESLintCICurrent Target
Scope must be explicit (platform, org, customer)Required in design/PR notesNot automated yetPR template/manual reviewAI + review
Route files stay thinRequiredno-restricted-imports guards in src/app/* (mixed error/warn)Lint + reviewPhase 2 started
Route-local _components stay private to their route treeRequiredno-restricted-imports (error)Lint checkEnforced
Surface component imports from routes go through public entrypointsRequiredno-restricted-syntax in src/app/* (error) with explicit stable sub-entrypoint exceptionsLint checkEnforced for routes
No long relative climbs across boundariesRequiredno-restricted-imports (error)Lint checkEnforced
Cross-feature access via public entrypoints onlyRequiredno-restricted-imports guards in src/app/* and src/features/* (warn)Lint + reviewPhase 2 started
No direct generated Convex API import from UI components/pagesRequiredEnforced in specific app/component scopes (error)Lint checkEnforced
App Convex hooks must go through wrappersRequiredno-restricted-imports (error)Lint checkEnforced
Shared packages provide primitives; app code provides route-aware adaptersRequiredNot automated yetReviewAI + review
Naming conventions (kebab-case files, camelCase symbols, PascalCase components)Requiredcamelcase (warn) + reviewLint + reviewWarn phase
Tests default to apps/app/tests/*RequiredWarn when tests are in src/*Lint checkWarn phase
Platform/org/customer auth boundaries cannot be collapsedRequiredNot automated yetReview + auth test coverageAI + review
Tenant ownership must be explicit in data modelRequiredNot automated yetSchema review + migration checklistAI + review

Phase Plan

Phase 1: Active now

  • Keep structural import boundaries strict.
  • Keep Convex access wrappers strict.
  • Keep naming and test-placement in warning mode to avoid migration thrash.

Phase 2: Tighten after structure stabilizes

  • Add strict feature-boundary import rules for domain folders. (Started in warning mode)
  • Add route-thinness static checks where feasible. (Started with route import guardrails)
  • Promote selected warning rules to errors once noise is low.

Phase 3: Merge-gate maturity

  • Add PR template checks for scope declaration and capability declaration.
  • Add CI checks for architecture decision record presence on boundary-changing PRs.
  • Keep migration-safe schema rollout checks mandatory for breaking changes.

PR Checklist (Short Form)

Include these five lines in PR descriptions for boundary-sensitive changes:

  1. Scope: platform or org or customer
  2. Data boundary touched:
  3. Capabilities required:
  4. Cross-feature entrypoint used:
  5. Migration-safe rollout needed: yes/no