refactor(P21): rename acdl_platform/ -> core/ (REQ-53)
---ci--- project: acdl phase: 21 milestone: v1.6 status: execute ---/ci--- Rename the acdl_platform/ package to core/ across the directory, all imports in tests/scripts/pipelines/workflows, and doc references. The package is imported as core.confidence_signal / core.contract_resolver / core.outbox_writer. The deploy workflow's platform-repo checkout dir is renamed acdl-platform/ -> platform/ (workspace path, not the python package). Both .gitea + .github workflows stay byte-identical. Note: the original target name 'platform/' shadows Python's stdlib platform module (pytest's import uuid -> platform.system() fails when the repo root is on sys.path, which every test does). 'core/' avoids the clash while honoring the intent (drop the verbose acdl_platform). Tests: 154 pass. run_ci.sh green.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
+3
-3
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+3
-3
@@ -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 \
|
||||
|
||||
@@ -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 <<PY > "$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 ""
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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"}],
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user