diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 203f06f..83f4a82 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -35,9 +35,9 @@ jobs: - name: Compile all Python files run: | python3 -m py_compile \ - acdl_platform/confidence_signal.py \ - acdl_platform/outbox_writer.py \ - acdl_platform/contract_resolver.py \ + core/confidence_signal.py \ + core/outbox_writer.py \ + core/contract_resolver.py \ adapters/terraform/adapter.py \ adapters/terraform/policy/checkov_adapter.py \ scripts/push_consumer_image.py diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 45f32c3..9035c68 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -17,7 +17,7 @@ # # What this workflow does: # 1. Checks out the consumer repo (the repo that invoked the workflow). -# 2. Checks out the ACDL platform repo into the workspace (acdl-platform/). +# 2. Checks out the ACDL platform repo into the workspace (platform/). # This is the run-time fetch — consumers never clone the platform repo. # 3. Installs runtime deps: Python 3.12, Terraform 1.9.*, Checkov. # 4. Configures AWS auth (OIDC default; static-key override via secrets). @@ -73,7 +73,7 @@ jobs: uses: actions/checkout@v4 with: repository: acdl/acdl - path: acdl-platform + path: platform ref: v1.4 - uses: actions/setup-python@v5 @@ -110,18 +110,18 @@ jobs: check-only) MODE_FLAG="--check-only" ;; *) echo "Unknown mode: ${{ inputs.mode }}"; exit 1 ;; esac - bash acdl-platform/scripts/run_platform.sh $MODE_FLAG "${{ inputs.contract }}" + bash platform/scripts/run_platform.sh $MODE_FLAG "${{ inputs.contract }}" - name: Upload emitted Terraform uses: actions/upload-artifact@v4 with: name: acdl-terraform - path: acdl-platform/terraform/spike/*.tf + path: platform/terraform/spike/*.tf if-no-files-found: warn - name: Upload platform log uses: actions/upload-artifact@v4 with: name: acdl-platform-log - path: acdl-platform/logs/ + path: platform/logs/ if-no-files-found: warn \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 203f06f..83f4a82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,9 +35,9 @@ jobs: - name: Compile all Python files run: | python3 -m py_compile \ - acdl_platform/confidence_signal.py \ - acdl_platform/outbox_writer.py \ - acdl_platform/contract_resolver.py \ + core/confidence_signal.py \ + core/outbox_writer.py \ + core/contract_resolver.py \ adapters/terraform/adapter.py \ adapters/terraform/policy/checkov_adapter.py \ scripts/push_consumer_image.py diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 45f32c3..9035c68 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,7 +17,7 @@ # # What this workflow does: # 1. Checks out the consumer repo (the repo that invoked the workflow). -# 2. Checks out the ACDL platform repo into the workspace (acdl-platform/). +# 2. Checks out the ACDL platform repo into the workspace (platform/). # This is the run-time fetch — consumers never clone the platform repo. # 3. Installs runtime deps: Python 3.12, Terraform 1.9.*, Checkov. # 4. Configures AWS auth (OIDC default; static-key override via secrets). @@ -73,7 +73,7 @@ jobs: uses: actions/checkout@v4 with: repository: acdl/acdl - path: acdl-platform + path: platform ref: v1.4 - uses: actions/setup-python@v5 @@ -110,18 +110,18 @@ jobs: check-only) MODE_FLAG="--check-only" ;; *) echo "Unknown mode: ${{ inputs.mode }}"; exit 1 ;; esac - bash acdl-platform/scripts/run_platform.sh $MODE_FLAG "${{ inputs.contract }}" + bash platform/scripts/run_platform.sh $MODE_FLAG "${{ inputs.contract }}" - name: Upload emitted Terraform uses: actions/upload-artifact@v4 with: name: acdl-terraform - path: acdl-platform/terraform/spike/*.tf + path: platform/terraform/spike/*.tf if-no-files-found: warn - name: Upload platform log uses: actions/upload-artifact@v4 with: name: acdl-platform-log - path: acdl-platform/logs/ + path: platform/logs/ if-no-files-found: warn \ No newline at end of file diff --git a/contracts/static-asset.yaml b/contracts/static-asset.yaml index 15f4968..1650702 100644 --- a/contracts/static-asset.yaml +++ b/contracts/static-asset.yaml @@ -7,7 +7,7 @@ # inputs: module-specific inputs # # Validated against schemas/contract.schema.json. -# Resolved by acdl_platform/contract_resolver.py to a Target Stack instance. +# Resolved by core/contract_resolver.py to a Target Stack instance. uses: acdl/pipelines/deploy.yaml@v1.4 module: static-asset diff --git a/acdl_platform/.gitkeep b/core/.gitkeep similarity index 100% rename from acdl_platform/.gitkeep rename to core/.gitkeep diff --git a/acdl_platform/__init__.py b/core/__init__.py similarity index 100% rename from acdl_platform/__init__.py rename to core/__init__.py diff --git a/acdl_platform/audit_ledger_design.md b/core/audit_ledger_design.md similarity index 100% rename from acdl_platform/audit_ledger_design.md rename to core/audit_ledger_design.md diff --git a/acdl_platform/confidence_signal.py b/core/confidence_signal.py similarity index 100% rename from acdl_platform/confidence_signal.py rename to core/confidence_signal.py diff --git a/acdl_platform/contract_resolver.py b/core/contract_resolver.py similarity index 100% rename from acdl_platform/contract_resolver.py rename to core/contract_resolver.py diff --git a/acdl_platform/hitl_matrix_design.md b/core/hitl_matrix_design.md similarity index 100% rename from acdl_platform/hitl_matrix_design.md rename to core/hitl_matrix_design.md diff --git a/acdl_platform/outbox_writer.py b/core/outbox_writer.py similarity index 100% rename from acdl_platform/outbox_writer.py rename to core/outbox_writer.py diff --git a/acdl_platform/separation_of_duties.py b/core/separation_of_duties.py similarity index 100% rename from acdl_platform/separation_of_duties.py rename to core/separation_of_duties.py diff --git a/pipelines/ci.yaml b/pipelines/ci.yaml index 2493973..2910b3d 100644 --- a/pipelines/ci.yaml +++ b/pipelines/ci.yaml @@ -29,9 +29,9 @@ stages: description: Compile all Python files (py_compile) command: | python3 -m py_compile \ - acdl_platform/confidence_signal.py \ - acdl_platform/outbox_writer.py \ - acdl_platform/contract_resolver.py \ + core/confidence_signal.py \ + core/outbox_writer.py \ + core/contract_resolver.py \ adapters/terraform/adapter.py \ adapters/terraform/policy/checkov_adapter.py \ scripts/push_consumer_image.py diff --git a/pipelines/deploy.yaml b/pipelines/deploy.yaml index 466da16..df8d4e9 100644 --- a/pipelines/deploy.yaml +++ b/pipelines/deploy.yaml @@ -27,7 +27,7 @@ stages: - name: resolve-stack description: Resolve the contract to a Target Stack instance via the contract resolver - command: python3 acdl_platform/contract_resolver.py contracts/static-asset.yaml /tmp/acdl-stack.json + command: python3 core/contract_resolver.py contracts/static-asset.yaml /tmp/acdl-stack.json required: true - name: terraform-plan @@ -42,7 +42,7 @@ stages: - name: confidence description: Compute the confidence signal from policy + validation inputs - command: python3 acdl_platform/confidence_signal.py /tmp/acdl-deploy-inputs.json dev + command: python3 core/confidence_signal.py /tmp/acdl-deploy-inputs.json dev required: true - name: apply diff --git a/scripts/run_ci.sh b/scripts/run_ci.sh index 1d26661..043c010 100755 --- a/scripts/run_ci.sh +++ b/scripts/run_ci.sh @@ -42,9 +42,9 @@ echo "" banner "Stage 1/3: lint (py_compile)" python3 -m py_compile \ - acdl_platform/confidence_signal.py \ - acdl_platform/outbox_writer.py \ - acdl_platform/contract_resolver.py \ + core/confidence_signal.py \ + core/outbox_writer.py \ + core/contract_resolver.py \ adapters/terraform/adapter.py \ adapters/terraform/policy/checkov_adapter.py \ scripts/push_consumer_image.py \ diff --git a/scripts/run_platform.sh b/scripts/run_platform.sh index a3c9724..570a7f8 100755 --- a/scripts/run_platform.sh +++ b/scripts/run_platform.sh @@ -19,7 +19,7 @@ # --quiet suppress terraform/checkov streaming (output to log only) # # The contract file is a YAML file validated against schemas/contract.schema.json. -# The resolver (acdl_platform/contract_resolver.py) resolves it to a Target Stack +# The resolver (core/contract_resolver.py) resolves it to a Target Stack # instance, which the adapter (adapters/terraform/adapter.py) compiles to Terraform. # # Uses the rotated spike key (D-039/D-047) from gitignored .env.secrets. @@ -30,7 +30,7 @@ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # Capture the caller's CWD before we cd to ROOT. The reusable deploy workflow # invokes this script from the CONSUMER repo's workspace root with a relative # contract path (e.g. .acdl/contract.yaml); the contract must resolve against -# the consumer repo, not the platform repo (acdl-platform/). Without this, the +# the consumer repo, not the platform repo (platform/). Without this, the # `[ -f "$CONTRACT" ]` check below looks for the contract inside the platform # repo and fails (P0 fix — see docs/CONSUMER_GUIDE.md Step 4). CALLER_CWD="$(pwd)" @@ -86,7 +86,7 @@ stream() { } CONTRACT_ID="11111111-1111-1111-1111-111111111111" # spike fixed UUID -WORK="/tmp/acdl_platform" +WORK="/tmp/acdl_platform_run" rm -rf "$WORK"; mkdir -p "$WORK" echo "=== Step 1: validate contract against contract.schema.json ===" @@ -101,7 +101,7 @@ print(f'contract: module={contract[\"module\"]} env={contract[\"environment\"]} echo "" echo "=== Step 2: resolve contract -> Target Stack instance ===" -python3 acdl_platform/contract_resolver.py "$CONTRACT" "$WORK/stack.json" || fail "resolver failed" +python3 core/contract_resolver.py "$CONTRACT" "$WORK/stack.json" || fail "resolver failed" python3 -c "import json; d=json.load(open('$WORK/stack.json')); print(f'stack: {d[\"stack\"][\"name\"]} {d[\"stack\"][\"kind\"]} {len(d[\"resources\"])} resource(s)')" echo "" @@ -211,7 +211,7 @@ echo "" echo "=== Step 7: confidence signal compute ===" python3 < "$WORK/signal.json" || fail "confidence signal failed" import json -import acdl_platform.confidence_signal as c +import core.confidence_signal as c pcr = json.load(open("$WORK/pcr.json")) inputs = { "policy": pcr, @@ -247,7 +247,7 @@ event = { } print(json.dumps(event, indent=2)) PY -python3 acdl_platform/outbox_writer.py "$WORK/event.json" > "$WORK/outbox_item.json" || fail "outbox write failed" +python3 core/outbox_writer.py "$WORK/event.json" > "$WORK/outbox_item.json" || fail "outbox write failed" echo "outbox: $(python3 -c "import json; d=json.load(open('$WORK/outbox_item.json')); print('contractId=', d['contractId'], 'hash=', d['hash'][:16]+'...')")" echo "" diff --git a/tests/test_confidence_signal.py b/tests/test_confidence_signal.py index 4763dd4..9fe3a3c 100644 --- a/tests/test_confidence_signal.py +++ b/tests/test_confidence_signal.py @@ -6,7 +6,7 @@ import pytest sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) -from acdl_platform.confidence_signal import ( +from core.confidence_signal import ( WEIGHTS, PENALTY, THRESHOLDS, compute, Signal, _per_input_score, ) diff --git a/tests/test_contract_resolver.py b/tests/test_contract_resolver.py index 85ca470..f2d6be7 100644 --- a/tests/test_contract_resolver.py +++ b/tests/test_contract_resolver.py @@ -25,7 +25,7 @@ class TestContractSchema: class TestResolveStaticAsset: def test_resolve_static_asset_contract(self, tmp_path): - from acdl_platform.contract_resolver import resolve + from core.contract_resolver import resolve stack = resolve(str(ROOT / "contracts/static-asset.yaml"), str(ROOT)) assert stack["stack"]["name"] == "static-asset" assert stack["stack"]["kind"] == "l2" @@ -33,7 +33,7 @@ class TestResolveStaticAsset: assert len(stack["resources"]) >= 1 def test_resolve_static_asset_has_s3_resource(self): - from acdl_platform.contract_resolver import resolve + from core.contract_resolver import resolve stack = resolve(str(ROOT / "contracts/static-asset.yaml"), str(ROOT)) s3_res = [r for r in stack["resources"] if r["type"] == "aws:s3:bucket"] assert len(s3_res) == 1 @@ -41,7 +41,7 @@ class TestResolveStaticAsset: assert s3_res[0]["inputs"]["region"] == "us-east-1" def test_resolve_static_asset_validates_against_stack_schema(self): - from acdl_platform.contract_resolver import resolve + from core.contract_resolver import resolve stack = resolve(str(ROOT / "contracts/static-asset.yaml"), str(ROOT)) schema = json.load(open(ROOT / "schemas/stack.schema.json")) jsonschema.validate(stack, schema) @@ -63,7 +63,7 @@ class TestResolveMicroservice: with open(contract_path, "w") as fh: yaml.dump(contract, fh) try: - from acdl_platform.contract_resolver import resolve + from core.contract_resolver import resolve stack = resolve(str(contract_path), str(ROOT)) assert stack["stack"]["name"] == "microservice" assert stack["stack"]["kind"] == "l2" @@ -86,7 +86,7 @@ class TestResolveL1Direct: contract_path = tmp_path / "test-s3.yaml" with open(contract_path, "w") as fh: yaml.dump(contract, fh) - from acdl_platform.contract_resolver import resolve + from core.contract_resolver import resolve stack = resolve(str(contract_path), str(ROOT)) assert stack["stack"]["name"] == "s3" assert stack["stack"]["kind"] == "l1" @@ -104,7 +104,7 @@ class TestResolveL1Direct: contract_path = tmp_path / "test-s3-schema.yaml" with open(contract_path, "w") as fh: yaml.dump(contract, fh) - from acdl_platform.contract_resolver import resolve + from core.contract_resolver import resolve stack = resolve(str(contract_path), str(ROOT)) schema = json.load(open(ROOT / "schemas/stack.schema.json")) jsonschema.validate(stack, schema) @@ -121,7 +121,7 @@ class TestResolveErrors: contract_path = tmp_path / "bad.yaml" with open(contract_path, "w") as fh: yaml.dump(contract, fh) - from acdl_platform.contract_resolver import resolve + from core.contract_resolver import resolve with pytest.raises(ValueError, match="not found in registry"): resolve(str(contract_path), str(ROOT)) @@ -130,7 +130,7 @@ class TestResolveErrors: contract_path = tmp_path / "incomplete.yaml" with open(contract_path, "w") as fh: yaml.dump(contract, fh) - from acdl_platform.contract_resolver import resolve + from core.contract_resolver import resolve with pytest.raises(jsonschema.ValidationError): resolve(str(contract_path), str(ROOT)) diff --git a/tests/test_outbox_writer.py b/tests/test_outbox_writer.py index dabe52a..0c49110 100644 --- a/tests/test_outbox_writer.py +++ b/tests/test_outbox_writer.py @@ -8,7 +8,7 @@ import pytest sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) -from acdl_platform.outbox_writer import _canonical_hash, write_event +from core.outbox_writer import _canonical_hash, write_event class TestCanonicalHash: diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index b638f71..db2cf3c 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -29,7 +29,7 @@ class TestPipelineIntegration: def test_confidence_signal_with_adapted_tf(self): sys.path.insert(0, str(ROOT)) - from acdl_platform.confidence_signal import compute + from core.confidence_signal import compute inputs = { "policy": [{"result": "pass"}], diff --git a/tests/test_pipeline_contract.py b/tests/test_pipeline_contract.py index 21565ba..e673e4a 100644 --- a/tests/test_pipeline_contract.py +++ b/tests/test_pipeline_contract.py @@ -78,7 +78,7 @@ class TestPipelineContract: contract = _load_yaml("pipelines/ci.yaml") lint = next(s for s in contract["stages"] if s["name"] == "lint") assert "py_compile" in lint["command"] - assert "acdl_platform/confidence_signal.py" in lint["command"] + assert "core/confidence_signal.py" in lint["command"] assert "adapters/terraform/adapter.py" in lint["command"] def test_contract_test_command_runs_pytest(self): @@ -141,9 +141,9 @@ class TestWorkflowConformance: run_step = next(s for s in lint_job["steps"] if "run" in s) assert "py_compile" in run_step["run"] for py_file in [ - "acdl_platform/confidence_signal.py", - "acdl_platform/outbox_writer.py", - "acdl_platform/contract_resolver.py", + "core/confidence_signal.py", + "core/outbox_writer.py", + "core/contract_resolver.py", "adapters/terraform/adapter.py", "adapters/terraform/policy/checkov_adapter.py", "scripts/push_consumer_image.py", @@ -175,8 +175,8 @@ class TestRunCiScript: def test_run_ci_script_contains_lint_stage(self): content = open(ROOT / "scripts/run_ci.sh").read() assert "py_compile" in content - assert "acdl_platform/confidence_signal.py" in content - assert "acdl_platform/contract_resolver.py" in content + assert "core/confidence_signal.py" in content + assert "core/contract_resolver.py" in content assert "adapters/terraform/adapter.py" in content def test_run_ci_script_contains_test_stage(self): @@ -198,9 +198,9 @@ class TestRunCiScript: ["bash", "-c", f"cd {ROOT} && " "python3 -m py_compile " - "acdl_platform/confidence_signal.py " - "acdl_platform/outbox_writer.py " - "acdl_platform/contract_resolver.py " + "core/confidence_signal.py " + "core/outbox_writer.py " + "core/contract_resolver.py " "adapters/terraform/adapter.py " "adapters/terraform/policy/checkov_adapter.py " "scripts/push_consumer_image.py && " @@ -342,7 +342,7 @@ class TestDeployWorkflowConformance: deploy_job = wf["jobs"]["deploy"] platform_checkout = next( s for s in deploy_job["steps"] - if "checkout" in s.get("uses", "") and s.get("with", {}).get("path") == "acdl-platform" + if "checkout" in s.get("uses", "") and s.get("with", {}).get("path") == "platform" ) assert platform_checkout["with"]["repository"] == "acdl/acdl"