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---
This commit is contained in:
@@ -2,28 +2,50 @@
|
||||
"$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 module to deploy, in which environment, with which inputs. The contract references the central ACDL pipeline via 'uses' and declares the module name (matching a registry key), environment, and inputs. The contract resolver resolves this to a Target Stack instance.",
|
||||
"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": ["uses", "module", "environment", "inputs"],
|
||||
"required": ["id", "name", "environment", "infrastructure"],
|
||||
"properties": {
|
||||
"uses": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "Reference to the central ACDL deployment pipeline (e.g. 'acdl/pipelines/deploy.yaml@v1')."
|
||||
"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."
|
||||
},
|
||||
"module": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-z][a-z0-9-]*$",
|
||||
"description": "Module name matching a registry key (L1 primitive or L2 composition)."
|
||||
"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. dev = autonomous; qa/prod/dr = HITL gates."
|
||||
"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."
|
||||
},
|
||||
"inputs": {
|
||||
"infrastructure": {
|
||||
"type": "object",
|
||||
"description": "Module-specific inputs (bucket_name, region, image, port, 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"]}
|
||||
"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
|
||||
}
|
||||
Reference in New Issue
Block a user