abc-ai/rules/normative.md
Tiara Rodney 41481636d8
init
2026-02-05 01:51:29 +01:00

273 lines
7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Normative Rules
The ABC Pattern is defined by a set of Normative Rules that establish the
structural, behavioral, and dataflow guarantees of the architecture. These
rules are the foundation that makes ABC:
* predictable
* composable
* verifiable
* agentfriendly
* implementationagnostic
Normative Rules describe what MUST or SHOULD be true in any ABCcompliant
architecture, regardless of the underlying cloud provider, IaC tool, or
programming language. They are not suggestions or stylistic preferences; they
are the semantic constraints that ensure ABC constructs behave consistently and
safely.
Each rule is assigned a canonical identifier of the form:
```default
ABC-R#
```
This identifier is stable, unique, and referenced throughout:
* the ABC Schema
* validation rules
* implementation profiles (e.g., CDKTS, Terraform)
* agent guidance
* tooling and linters
## Hierarchy Rules
These define the allowed structure of an ABC architecture, including the roles
and relationships of ApplicationStacks, Logical Units, and Resource Groups.
### ABCR1 (MUST)
An Application Stack (ABCC1) MUST contain one or more Logical Units (ABCC2).
### ABCR2 (MUST)
A Logical Unit (ABCC2) MUST contain one or more Resource Groups (ABCC3).
### ABCR3 (MUST)
Every Construct (ABCC0) MUST have exactly one parent, except the Application
Stack (ABCC1), which has none.
### ABCR4 (MUST)
Constructs MUST form a strict tree hierarchy with no cycles.
### ABCR5 (SHOULD)
Logical Units (ABCC2) SHOULD represent coherent functional domains.
### ABCR6 (MAY)
Resource Groups (ABCC3) MAY be nested further if the implementation framework
supports subconstructs, provided all other rules remain satisfied.
## Relationship Rules
Specify how constructs relate to one another, including parentchild
constraints, allowed dependencies, and prohibited lateral references.
### ABCR10 (MUST)
A Resource Group (ABCC3) MUST NOT reference another Resource Group directly.
### ABCR11 (MUST)
A Logical Unit (ABCC2) MUST NOT reference another Logical Unit directly.
### ABCR12 (MUST)
A Construct (ABCC0) MUST NOT access parent state except through Capturing Down
(ABCF1).
### ABCR13 (MUST)
A Construct (ABCC0) MUST NOT access sibling state under any circumstances.
### ABCR14 (MUST)
All crossdomain communication MUST be mediated by the parent construct.
### ABCR15 (SHOULD)
Constructs SHOULD minimize the number of outputs they expose to reduce coupling.
### ABCR16 (MAY)
A parent MAY aggregate outputs from multiple children before reexposing them.
## Interface Rules
Define the semantics of Input and Output Contracts, including immutability,
explicitness, and the boundaries they enforce.
### ABCR20 (MUST)
Every Construct (ABCC0) MUST define an Input Contract (ABCC4).
### ABCR21 (MUST)
Every Construct (ABCC0) MUST define an Output Contract (ABCC5), even if empty.
### ABCR22 (MUST)
A Construct MUST NOT depend on any value not present in its Input Contract.
### ABCR23 (MUST)
A Construct MUST NOT expose any value not present in its Output Contract.
### ABCR24 (MUST)
Input Contracts MUST be immutable after instantiation.
### ABCR25 (SHOULD)
Output Contracts SHOULD be minimal and stable across versions.
### ABCR26 (MAY)
A Construct MAY expose composite outputs if they simplify parentlevel wiring.
## Instantiation Rules
Specify how constructs are created, how inputs are provided, and how
instantiation must avoid side effects or hidden dependencies.
### ABCR30 (MUST)
A Construct (ABCC0) MUST be instantiated exclusively through its Instantiation
Interface (ABCC6).
### ABCR31 (MUST)
Instantiation MUST be topdown: parents instantiate children; children MUST NOT
instantiate parents or siblings.
### ABCR32 (MUST)
The Instantiation Interface MUST accept only the Input Contract (ABCC4) and no
additional parameters.
### ABCR33 (MUST)
Instantiation MUST NOT produce side effects beyond constructing the child.
### ABCR34 (SHOULD)
Instantiation Interfaces SHOULD remain stable across minor revisions.
### ABCR35 (MAY)
Constructs MAY provide optional parameters in the Input Contract if defaults are
welldefined.
## Data Flow Rules
Formalize the two fundamental ABC dataflow mechanisms:
* Capturing Down (parent → child)
* Bubbling Up (child → parent)
These rules ensure that all communication flows through the parent construct,
eliminating ambiguity and hidden coupling.
### ABCR40 (MUST)
All downward data flow MUST occur through Capturing Down (ABCF1).
### ABCR41 (MUST)
All upward data flow MUST occur through Bubbling Up (ABCF2).
### ABCR42 (MUST)
A Construct MUST NOT read values from its parent except those explicitly passed
via Capturing Down.
### ABCR43 (MUST)
A Construct MUST NOT write values to its parent except through Bubbling Up.
### ABCR44 (MUST)
Parents MUST mediate all routing of outputs between children.
### ABCR45 (SHOULD)
Parents SHOULD avoid passing unnecessary outputs downward to reduce coupling.
### ABCR46 (MAY)
Parents MAY transform outputs before passing them down.
## Encapsulation & Testability Rules
Ensure that constructs remain isolated, testable, and free from crosscutting
concerns. These rules prevent leakage of internal details and enforce strict
boundaries.
### ABCR50 (MUST)
Constructs MUST encapsulate all internal implementation details.
### ABCR51 (MUST)
Constructs MUST be instantiable in isolation using mock Input Contracts.
### ABCR52 (SHOULD)
Constructs SHOULD avoid exposing internal resource identifiers unless required.
### ABCR53 (SHOULD)
Constructs SHOULD minimize internal state to simplify testing.
### ABCR54 (MAY)
Constructs MAY provide diagnostic outputs if they do not violate encapsulation.
## Evolution & Change Management Rules
Define how ABC architectures evolve safely over time, including versioning,
contract stability, and backwardcompatible changes.
### ABCR60 (MUST)
If a childs Output Contract changes, the parent MUST adapt explicitly.
### ABCR61 (MUST)
Breaking changes to Input Contracts MUST be versioned or documented.
### ABCR62 (SHOULD)
Constructs SHOULD maintain backward compatibility where feasible.
### ABCR63 (SHOULD)
Parents SHOULD validate child outputs before routing them.
### ABCR64 (MAY)
Constructs MAY deprecate fields gradually before removal.
## Optional Flexibility Rules
Provide nonmandatory guidance that enhances clarity, maintainability, or
ergonomics without affecting correctness. These rules are advisory and may be
adopted at the discretion of the implementation or team.
### ABCR70 (MAY)
Logical Units MAY be composed dynamically if the framework supports it, provided
all other rules remain satisfied.
### ABCR71 (MAY)
Resource Groups MAY be reused across Logical Units if instantiated
independently.
### ABCR72 (MAY)
The Application Stack MAY expose a composite Output Contract aggregating all
Logical Unit outputs.