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:
@@ -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