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

155 lines
3.5 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.

# Validation Rules
The ABC Validation Rules define the mechanical checks required to verify that an
ABC architecture conforms to the ABC Schema and the normative rules of the
specification. These rules are intended for:
* automated validators
* linters
* compilers
* agentdriven code generation
* CI/CD enforcement
Validation Rules are **not** conceptual rules; they are operational constraints
that ensure an ABC description is structurally correct and unambiguous.
Validation Rules follow the canonical identifier format:
```default
ABC-VALID-R#
```
They are grouped into:
* Structural Validation
* Contract Validation
* DataFlow Validation
* Hierarchy Validation
* ProfileSpecific Validation (optional)
## Structural Validation Rules
These rules ensure the ABC hierarchy is wellformed.
### ABC-VALID-R1 (MUST)
Every construct MUST have exactly one parent, except the ApplicationStack which
MUST have none.
### ABC-VALID-R2 (MUST)
The hierarchy MUST follow the pattern:
`ApplicationStack → LogicalUnit → ResourceGroup`.
### ABC-VALID-R3 (MUST)
Construct trees MUST NOT contain cycles.
### ABC-VALID-R4 (MUST)
Construct IDs MUST be unique within the architecture.
### ABC-VALID-R5 (MUST)
Construct types MUST be one of:
ApplicationStack, LogicalUnit, ResourceGroup.
### ABC-VALID-R6 (MUST)
ResourceGroups MUST NOT have children.
### ABC-VALID-R7 (MUST)
LogicalUnits MUST NOT have parents that are not ApplicationStacks.
### ABC-VALID-R8 (MUST)
ResourceGroups MUST NOT have parents that are not LogicalUnits.
## Contract Validation Rules
These rules ensure Input/Output Contracts are welldefined and consistent.
### ABC-VALID-R10 (MUST)
Every construct MUST define both an InputContract and an OutputContract.
### ABC-VALID-R11 (MUST)
InputContracts MUST be immutable after instantiation.
### ABC-VALID-R12 (MUST)
Constructs MUST NOT reference values not present in their InputContract.
### ABC-VALID-R13 (MUST)
Constructs MUST NOT expose outputs not declared in their OutputContract.
### ABC-VALID-R14 (SHOULD)
OutputContracts SHOULD be minimal and stable across versions.
### ABC-VALID-R15 (MUST)
InputContracts MUST NOT reference parent or sibling constructs directly.
### ABC-VALID-R16 (MUST)
OutputContracts MUST NOT expose internal implementation details (e.g., resource
objects).
## DataFlow Validation Rules
These rules enforce Capturing Down and Bubbling Up.
### ABC-VALID-R20 (MUST)
All downward references MUST originate from:
* parent.InputContract
* parent.OutputContract
### ABC-VALID-R21 (MUST)
All upward references MUST originate from:
* child.OutputContract
### ABC-VALID-R22 (MUST)
No lateral data flow is permitted between siblings.
### ABC-VALID-R23 (MUST)
Constructs MUST NOT read values from grandparents or ancestors except through
parentmediated Capturing Down.
### ABC-VALID-R24 (MUST)
Constructs MUST NOT write values to ancestors except through Bubbling Up.
### ABC-VALID-R25 (MUST)
Constructs MUST NOT read or write values from siblings or cousins.
## Instantiation Validation Rules
These rules ensure constructs are instantiated correctly.
### ABC-VALID-R30 (MUST)
Constructs MUST be instantiated using the Instantiation Interface:
(scope, id, inputs).
### ABC-VALID-R31 (MUST)
Instantiation MUST NOT accept parameters outside the InputContract.
### ABC-VALID-R32 (MUST)
Instantiation MUST NOT produce side effects beyond constructing children.
### ABC-VALID-R33 (MUST)
Constructs MUST NOT mutate their InputContract after instantiation.