TorbatYar/docs/ai-framework/boundary-rules.md
2026-07-28 20:39:10 +03:30

2.9 KiB
Raw Permalink Blame History

Boundary Rules

Hard constraints for every implementation phase. Violations block completion.

Canonical ownership: module-boundaries.md. Process mandate: ADR-018.

Service & Module Boundaries

  1. Never implement responsibilities owned by another service.
  2. Never duplicate business logic that already lives in an owning service — consume it.
  3. Never access another services database (no cross-DB queries, FKs, or shared schemas).
  4. Integrate only through versioned HTTP APIs, domain/integration Events, and Provider interfaces.
  5. Never import another services models, repositories, or private modules.

Phase Boundaries

  1. Never move functionality from future phases into the current phase.
  2. Never silently expand Scope into adjacent modules “while were here.”
  3. Out of Scope is binding — document exclusions and respect them.
  4. High-level roadmap text authorizes deriving production engineering for the current phase (definition-of-done.md, enterprise-phase-discovery.md), not pulling next-phase product features forward.

Data & Logic Boundaries

Allowed Forbidden
External ID / ref fields (*_ref) Cross-service foreign keys
HTTP clients to published APIs Reading foreign ORM models
Outbox → event bus → consumers Dual-writing the same journal/aggregate in two services
Provider adapters in the owning service Implementing SMS/payment/etc. inside a non-owning vertical
Shared-lib envelopes/exceptions/JWT helpers Shared-lib business workflows

Accounting & Platform Specials

  1. Journal entries only via Accounting Posting Engine (ADR-010).
  2. Messaging providers only inside Communication (ADR-012).
  3. Product AI remains optional and independent (ai-architecture.md).
  4. Public-surface cross-service attachments use publish_id only (ADR-022) — never Experience/vertical internal tables as the integration key.

Frontend / Backend

  1. UI only under frontend/ (ADR-002).
  2. Backend never embeds UI rules as the source of truth.
  3. Frontend never imports backend packages.

Enforcement