Files
acdl/schemas/contract.schema.json
T
Jon Chery 031887ec56 refactor(P57): contract surface redesign + rename + .yml repo-wide
Contract surface redesign:
- New top-level fields: id (3-6 char acronym → stack.name), name (full → stack.title),
  infrastructure (map keyed by module name, replaces module:)
- Drop uses: field (dead reference; version pin lives in CI workflow uses: line)
- Drop top-level module/inputs (now nested under infrastructure map)
- Per-module optional version (defaults to latest published from registry)
- Multi-module contracts: one file deploys N modules in one pipeline run,
  resource IDs namespaced with module name to avoid collisions
- stack.schema.json: add optional title field for display name

Rename:
- pipelines/deploy.yaml → pipelines/contract.yml (declarative spec, not a pipeline)
- pipelines/ci.yaml → pipelines/ci.yml
- All 44 .yaml files → .yml repo-wide (contracts, module examples, kyverno policies)
- .acdl/contract.yaml → .acdl/contract.yml

Resolver (core/contract_resolver.py):
- Rewrite resolve() to loop infrastructure map, default version to latest,
  merge module fragments into one stack with namespaced resource IDs
- _latest_version() picks highest non-deprecated from registry
- _namespace_resources() prefixes IDs + rewrites ref: expressions for multi-module
- Single-module path: unprefixed IDs (backward compatible)

Verification:
- 494 tests pass (0 contract-shape failures)
- Local E2E passes (contract → resolver → adapter → local ECS HTTP 200 → outbox)

---ci---
project: acdl
phase: 57
milestone: v1.10.2
status: execute
---/ci---
2026-07-27 21:37:40 +00:00

51 lines
3.2 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://acdl.cloudinit.dev/schemas/contract.schema.json",
"title": "ACDL Consumer Contract",
"description": "A consumer contract declares intent: which infrastructure to deploy, in which environment, with which inputs. The contract is keyed by an operational id (3-6 char acronym, becomes the stack name for state keys, tags, and outbox events) and a human-readable name (becomes the stack title for display and evidence). The infrastructure map is keyed by module name; each entry carries an optional version (defaults to the latest published version from the module registry) and per-module inputs. The contract resolver resolves each infrastructure entry against modules/registry.json, then merges them into a single Target Stack instance.",
"type": "object",
"required": ["id", "name", "environment", "infrastructure"],
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z][a-z0-9-]{2,5}$",
"description": "Short operational acronym (3-6 chars, lowercase + digits + hyphens). Becomes stack.name: the Terraform state key (spike/<id>/terraform.tfstate), the ECS service name, the outbox event identity, and the resource naming prefix. Stable across deploys."
},
"name": {
"type": "string",
"minLength": 3,
"description": "Full human-readable stack name. Becomes stack.title: the display name in PR comments, evidence records, and leadership dashboards."
},
"environment": {
"type": "string",
"enum": ["dev", "qa", "prod", "dr"],
"description": "Target environment. Applies to every module in the contract — a contract deploys all its infrastructure into one environment. dev = autonomous; qa/prod/dr = HITL gates."
},
"infrastructure": {
"type": "object",
"minProperties": 1,
"description": "Map of modules to deploy, keyed by module name (matching a registry key in modules/registry.json). Each value carries an optional version (defaults to the latest published version) and per-module inputs. One entry = single-module deploy; N entries = multi-module manifest deployed in one pipeline run.",
"patternProperties": {
"^[a-z][a-z0-9-]*$": {
"type": "object",
"required": ["inputs"],
"properties": {
"version": {
"type": "string",
"pattern": "^\\d+\\.\\d+\\.\\d+$",
"description": "Module version pin (semver). Omit to default to the latest non-deprecated version from modules/registry.json."
},
"inputs": {
"type": "object",
"description": "Module-specific inputs (bucket_name, region, image, port, cpu, memory, desired_count, env, etc.). Validated at resolution time against the module's interface.json or composition.json. May include deletion_protection (boolean, default true — set to false only during decommission) and uptime_enabled (boolean, default true — set to false to disable uptime monitoring).",
"additionalProperties": {"type": ["string", "number", "boolean", "object", "array"]}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}