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:
Jon Chery
2026-07-27 21:37:40 +00:00
parent 7f36df5610
commit 031887ec56
127 changed files with 1597 additions and 1100 deletions
+15 -10
View File
@@ -243,7 +243,7 @@ class TestStaticAssetsStack:
@pytest.fixture
def static_assets_stack(self):
from core.contract_resolver import resolve
return resolve(str(ROOT / "contracts/static-assets.yaml"), str(ROOT))
return resolve(str(ROOT / "contracts/static-assets.yml"), str(ROOT))
def test_static_assets_resolves_to_4_resources(self, static_assets_stack):
types = [r["type"] for r in static_assets_stack["resources"]]
@@ -381,7 +381,7 @@ class TestResolverOutputs:
def test_static_assets_has_stack_outputs(self):
from core.contract_resolver import resolve
stack = resolve(str(ROOT / "contracts/static-assets.yaml"), str(ROOT))
stack = resolve(str(ROOT / "contracts/static-assets.yml"), str(ROOT))
assert "outputs" in stack
outputs = stack["outputs"]
assert "distribution_domain_name" in outputs
@@ -390,7 +390,7 @@ class TestResolverOutputs:
def test_static_assets_output_has_from_and_output(self):
from core.contract_resolver import resolve
stack = resolve(str(ROOT / "contracts/static-assets.yaml"), str(ROOT))
stack = resolve(str(ROOT / "contracts/static-assets.yml"), str(ROOT))
dist_out = stack["outputs"]["distribution_domain_name"]
assert "from" in dist_out
assert "output" in dist_out
@@ -399,7 +399,7 @@ class TestResolverOutputs:
def test_static_assets_adapter_emits_stack_output_blocks(self, tmp_path):
"""P1-7: adapter emits `output` blocks from stack.outputs."""
from core.contract_resolver import resolve
stack = resolve(str(ROOT / "contracts/static-assets.yaml"), str(ROOT))
stack = resolve(str(ROOT / "contracts/static-assets.yml"), str(ROOT))
out_dir = str(tmp_path / "tf_out")
adapt(stack, out_dir)
main_tf = open(os.path.join(out_dir, "main.tf")).read()
@@ -494,7 +494,7 @@ class TestEncryptionByDefault:
def test_static_assets_l2_wires_kms_key_to_s3(self):
"""REQ-85: L2 modules wire per-stack CMK to children."""
from core.contract_resolver import resolve
stack = resolve(str(ROOT / "contracts/static-assets.yaml"), str(ROOT))
stack = resolve(str(ROOT / "contracts/static-assets.yml"), str(ROOT))
types = [r["type"] for r in stack["resources"]]
assert "aws:kms:key" in types
s3_res = next(r for r in stack["resources"] if r["type"] == "aws:s3:bucket")
@@ -577,12 +577,17 @@ class TestDeletionProtectionByDefault:
"""REQ-87: L2 feature flag deletion_protection=false propagates to all children."""
import yaml
contract = {
"uses": "acdl/pipelines/deploy.yaml@v1.8",
"module": "static-assets",
"id": "assets",
"name": "static-assets-dp-test",
"environment": "dev",
"inputs": {"bucket_name": "test-bucket", "region": "us-east-1", "deletion_protection": False},
"infrastructure": {
"static-assets": {
"version": "1.0.0",
"inputs": {"bucket_name": "test-bucket", "region": "us-east-1", "deletion_protection": False},
}
},
}
contract_path = tmp_path / "test-dp.yaml"
contract_path = tmp_path / "test-dp.yml"
with open(contract_path, "w") as fh:
yaml.dump(contract, fh)
from core.contract_resolver import resolve
@@ -656,7 +661,7 @@ class TestUptimePrimitive:
def test_deploy_pipeline_has_deploy_uptime_stage(self):
import yaml
with open(ROOT / "pipelines/deploy.yaml") as fh:
with open(ROOT / "pipelines/contract.yml") as fh:
contract = yaml.safe_load(fh)
stage_names = [s["name"] for s in contract["stages"]]
assert "deploy-uptime" in stage_names