Content Boundary
Content & Runtime Boundary Linter (CONTENT_BOUNDARY.md)
1. Objective & Architectural Intent
Implemented in packages/governance/src/cli/linters/content-boundary.ts, this linter performs static Abstract Syntax Tree (AST) analysis and file pattern checks across all client applications (apps/*) and edge runtime handlers to enforce four isolation boundaries:
- Cross-Tenant Isolation (
arch/no-cross-tenant-imports): Client applications (apps/<client-a>) must never import components, styles, or logic from sibling client workspaces (apps/<client-b>). All shared logic must enter through registered platform packages (packages/*). - Edge Runtime Safety (
arch/no-node-builtins-in-edge): Routes rendered on the Cloudflare Workers edge isolate must never import Node-only C++ built-ins (node:fs,node:child_process,node:net). - Secret Hygiene & Binding Ingestion (
arch/no-process-env-secrets): Source code insrc/must never read secret credentials directly viaprocess.env.<SECRET>. Secrets must be passed explicitly via Workerenvbindings (RULES.md). - Component Modularity (
arch/warn-monolithic-component): Complex UI components exceeding the 200 LOC modularity threshold emit warnings recommending decomposition into modular component directories (e.g.src/components/ContactForm/index.astro,styles.css,adapter.ts).
2. Invariants Enforced
| Rule ID | Severity | Invariant Enforced | Remediation |
|---|---|---|---|
arch/no-cross-tenant-imports |
Error | Zero cross-tenant coupling between client apps. | Move shared primitives into packages/components or packages/capabilities. |
arch/no-node-builtins-in-edge |
Error | Cloudflare Workers edge runtime compatibility. | Replace Node built-ins with Web Standards API (fetch, WebCrypto) or isolate behind backing services. |
arch/no-process-env-secrets |
Error | Hermetic runtime credential injection. | Access credentials through Cloudflare Worker env bindings or function parameters. |
arch/warn-monolithic-component |
Warn | Modularity and maintainability. | Decompose templates exceeding 200 lines into subcomponents. |
Decisions Intentionally Deferred
- Stricter threshold enforcement (converting monolithic component warnings into errors) is deferred until legacy client app refactoring milestones are scheduled.