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:
@@ -34,16 +34,21 @@ def _tf_for_contract(contract_dict, tmp_path):
|
||||
def test_desired_count_override_emits_overridden_value(tmp_path):
|
||||
"""An L1 with desired_count: 3 in contract inputs emits desired_count = 3."""
|
||||
contract = {
|
||||
"uses": "acdl/pipelines/deploy.yaml@v1.9",
|
||||
"module": "microservice",
|
||||
"id": "msvc",
|
||||
"name": "microservice-test",
|
||||
"environment": "dev",
|
||||
"inputs": {
|
||||
"infrastructure": {
|
||||
"microservice": {
|
||||
"version": "1.0.0",
|
||||
"inputs": {
|
||||
"bucket_name": "acdl-test",
|
||||
"region": "us-east-1",
|
||||
"image": "public.ecr.aws/docker/library/nginx:latest",
|
||||
"port": 80,
|
||||
"desired_count": 3,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
tf = _tf_for_contract(contract, tmp_path)
|
||||
assert "desired_count = 3" in tf
|
||||
@@ -53,15 +58,20 @@ def test_desired_count_override_emits_overridden_value(tmp_path):
|
||||
def test_desired_count_default_emits_one_via_interface(tmp_path):
|
||||
"""Absent desired_count emits desired_count = 1 via interface default."""
|
||||
contract = {
|
||||
"uses": "acdl/pipelines/deploy.yaml@v1.9",
|
||||
"module": "microservice",
|
||||
"id": "msvc",
|
||||
"name": "microservice-test",
|
||||
"environment": "dev",
|
||||
"inputs": {
|
||||
"infrastructure": {
|
||||
"microservice": {
|
||||
"version": "1.0.0",
|
||||
"inputs": {
|
||||
"bucket_name": "acdl-test",
|
||||
"region": "us-east-1",
|
||||
"image": "public.ecr.aws/docker/library/nginx:latest",
|
||||
"port": 80,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
tf = _tf_for_contract(contract, tmp_path)
|
||||
assert "desired_count = 1" in tf
|
||||
@@ -69,16 +79,21 @@ def test_desired_count_default_emits_one_via_interface(tmp_path):
|
||||
|
||||
def test_launch_type_override_emits_overridden_value(tmp_path):
|
||||
contract = {
|
||||
"uses": "acdl/pipelines/deploy.yaml@v1.9",
|
||||
"module": "microservice",
|
||||
"id": "msvc",
|
||||
"name": "microservice-test",
|
||||
"environment": "dev",
|
||||
"inputs": {
|
||||
"infrastructure": {
|
||||
"microservice": {
|
||||
"version": "1.0.0",
|
||||
"inputs": {
|
||||
"bucket_name": "acdl-test",
|
||||
"region": "us-east-1",
|
||||
"image": "public.ecr.aws/docker/library/nginx:latest",
|
||||
"port": 80,
|
||||
"launch_type": "EC2",
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
tf = _tf_for_contract(contract, tmp_path)
|
||||
assert 'launch_type = "EC2"' in tf
|
||||
@@ -87,16 +102,21 @@ def test_launch_type_override_emits_overridden_value(tmp_path):
|
||||
|
||||
def test_target_type_override_emits_overridden_value(tmp_path):
|
||||
contract = {
|
||||
"uses": "acdl/pipelines/deploy.yaml@v1.9",
|
||||
"module": "microservice",
|
||||
"id": "msvc",
|
||||
"name": "microservice-test",
|
||||
"environment": "dev",
|
||||
"inputs": {
|
||||
"infrastructure": {
|
||||
"microservice": {
|
||||
"version": "1.0.0",
|
||||
"inputs": {
|
||||
"bucket_name": "acdl-test",
|
||||
"region": "us-east-1",
|
||||
"image": "public.ecr.aws/docker/library/nginx:latest",
|
||||
"port": 80,
|
||||
"target_type": "instance",
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
tf = _tf_for_contract(contract, tmp_path)
|
||||
assert 'target_type = "instance"' in tf
|
||||
@@ -105,16 +125,21 @@ def test_target_type_override_emits_overridden_value(tmp_path):
|
||||
|
||||
def test_load_balancer_type_override_emits_overridden_value(tmp_path):
|
||||
contract = {
|
||||
"uses": "acdl/pipelines/deploy.yaml@v1.9",
|
||||
"module": "microservice",
|
||||
"id": "msvc",
|
||||
"name": "microservice-test",
|
||||
"environment": "dev",
|
||||
"inputs": {
|
||||
"infrastructure": {
|
||||
"microservice": {
|
||||
"version": "1.0.0",
|
||||
"inputs": {
|
||||
"bucket_name": "acdl-test",
|
||||
"region": "us-east-1",
|
||||
"image": "public.ecr.aws/docker/library/nginx:latest",
|
||||
"port": 80,
|
||||
"load_balancer_type": "network",
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
tf = _tf_for_contract(contract, tmp_path)
|
||||
assert 'load_balancer_type = "network"' in tf
|
||||
@@ -123,16 +148,21 @@ def test_load_balancer_type_override_emits_overridden_value(tmp_path):
|
||||
|
||||
def test_family_override_emits_overridden_value(tmp_path):
|
||||
contract = {
|
||||
"uses": "acdl/pipelines/deploy.yaml@v1.9",
|
||||
"module": "microservice",
|
||||
"id": "msvc",
|
||||
"name": "microservice-test",
|
||||
"environment": "dev",
|
||||
"inputs": {
|
||||
"infrastructure": {
|
||||
"microservice": {
|
||||
"version": "1.0.0",
|
||||
"inputs": {
|
||||
"bucket_name": "acdl-test",
|
||||
"region": "us-east-1",
|
||||
"image": "public.ecr.aws/docker/library/nginx:latest",
|
||||
"port": 80,
|
||||
"family": "myservice",
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
tf = _tf_for_contract(contract, tmp_path)
|
||||
assert 'family = "myservice"' in tf
|
||||
@@ -140,15 +170,20 @@ def test_family_override_emits_overridden_value(tmp_path):
|
||||
|
||||
def test_family_default_emits_app(tmp_path):
|
||||
contract = {
|
||||
"uses": "acdl/pipelines/deploy.yaml@v1.9",
|
||||
"module": "microservice",
|
||||
"id": "msvc",
|
||||
"name": "microservice-test",
|
||||
"environment": "dev",
|
||||
"inputs": {
|
||||
"infrastructure": {
|
||||
"microservice": {
|
||||
"version": "1.0.0",
|
||||
"inputs": {
|
||||
"bucket_name": "acdl-test",
|
||||
"region": "us-east-1",
|
||||
"image": "public.ecr.aws/docker/library/nginx:latest",
|
||||
"port": 80,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
tf = _tf_for_contract(contract, tmp_path)
|
||||
assert 'family = "app"' in tf
|
||||
@@ -157,7 +192,7 @@ def test_family_default_emits_app(tmp_path):
|
||||
def test_v1_1_s3_regression_still_passes(tmp_path):
|
||||
"""The v1.1 S3 regression: the static-assets L1 (s3-only) must still
|
||||
produce valid Terraform with no ECS/ALB/VPC defaults leaking in."""
|
||||
contract_path = ROOT / "contracts" / "static-assets.yaml"
|
||||
contract_path = ROOT / "contracts" / "static-assets.yml"
|
||||
stack = resolve(str(contract_path))
|
||||
out_dir = tmp_path / "tf"
|
||||
adapt(stack, str(out_dir))
|
||||
@@ -172,15 +207,20 @@ def test_no_hardcoded_microservice_name_in_route_table(tmp_path):
|
||||
"""The hardcoded 'acdl-microservice-rt' / 'acdl-microservice-igw' Name
|
||||
tags are removed (D-085); the name derives from the VPC name input."""
|
||||
contract = {
|
||||
"uses": "acdl/pipelines/deploy.yaml@v1.9",
|
||||
"module": "microservice",
|
||||
"id": "msvc",
|
||||
"name": "microservice-test",
|
||||
"environment": "dev",
|
||||
"inputs": {
|
||||
"infrastructure": {
|
||||
"microservice": {
|
||||
"version": "1.0.0",
|
||||
"inputs": {
|
||||
"bucket_name": "acdl-test",
|
||||
"region": "us-east-1",
|
||||
"image": "public.ecr.aws/docker/library/nginx:latest",
|
||||
"port": 80,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
tf = _tf_for_contract(contract, tmp_path)
|
||||
assert "acdl-microservice-rt" not in tf
|
||||
|
||||
Reference in New Issue
Block a user