From 727c87339b67512fc7b8baf49131258b3cf3e237 Mon Sep 17 00:00:00 2001 From: Jon Chery Date: Tue, 21 Jul 2026 18:53:41 +0000 Subject: [PATCH] fix(P08 prep): rename platform/ -> acdl_platform/ (stdlib shadow fix) ---ci--- project: acdl phase: 8 milestone: v1.1 status: plan-as-execute persona: lead-developer task: T-8.0 type: prerequisite-fix ---/ci--- The Phase 07 P1 ('platform/ package shadows stdlib platform module') became a Phase 08 blocker: boto3 imports uuid -> platform.system(), which fails when the repo's platform/ package is on sys.path[0]. Renamed platform/ -> acdl_platform/ (the verifier's recommended v1.2 fix, pulled forward because Phase 08 needs boto3). - git mv platform/ acdl_platform/ (history preserved) - verify_phase07.sh: updated paths; removed the /tmp workaround (no longer needed; the shadow is gone) - verify_phase06.sh: updated the new-dirs check for the rename - README.md: layout table updated Both verify_phase06.sh and verify_phase07.sh still pass; confidence_signal now imports + runs correctly from the repo root. boto3 imports clean. --- README.md | 2 +- {platform => acdl_platform}/.gitkeep | 0 {platform => acdl_platform}/__init__.py | 0 .../audit_ledger_design.md | 0 .../confidence_signal.py | 0 .../hitl_matrix_design.md | 0 .../separation_of_duties.py | 0 scripts/verify_phase06.sh | 8 +++- scripts/verify_phase07.sh | 42 +++++++------------ 9 files changed, 23 insertions(+), 29 deletions(-) rename {platform => acdl_platform}/.gitkeep (100%) rename {platform => acdl_platform}/__init__.py (100%) rename {platform => acdl_platform}/audit_ledger_design.md (100%) rename {platform => acdl_platform}/confidence_signal.py (100%) rename {platform => acdl_platform}/hitl_matrix_design.md (100%) rename {platform => acdl_platform}/separation_of_duties.py (100%) diff --git a/README.md b/README.md index 9c24deb..ddc013f 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ a configuration file, or a Terraform module. | Path | Purpose | Populated | |------|---------|-----------| -| `platform/` | Platform code: confidence signal, contract resolver, outbox, HITL/ledger designs | Phase 07+ | +| `acdl_platform/` | Platform code: confidence signal, contract resolver, outbox, HITL/ledger designs (renamed from `platform/` in Phase 08 to avoid shadowing the stdlib `platform` module) | Phase 07+ | | `schemas/` | JSON Schemas: IR, PolicyCheckResult, contract | Phase 07 | | `adapters/` | Substrate adapters (Terraform adapter in v1; the only substrate-specific code per §12) | Phase 09 | | `terraform/` | State backend + provider config (S3 state + DynamoDB lock) | Phase 08+ | diff --git a/platform/.gitkeep b/acdl_platform/.gitkeep similarity index 100% rename from platform/.gitkeep rename to acdl_platform/.gitkeep diff --git a/platform/__init__.py b/acdl_platform/__init__.py similarity index 100% rename from platform/__init__.py rename to acdl_platform/__init__.py diff --git a/platform/audit_ledger_design.md b/acdl_platform/audit_ledger_design.md similarity index 100% rename from platform/audit_ledger_design.md rename to acdl_platform/audit_ledger_design.md diff --git a/platform/confidence_signal.py b/acdl_platform/confidence_signal.py similarity index 100% rename from platform/confidence_signal.py rename to acdl_platform/confidence_signal.py diff --git a/platform/hitl_matrix_design.md b/acdl_platform/hitl_matrix_design.md similarity index 100% rename from platform/hitl_matrix_design.md rename to acdl_platform/hitl_matrix_design.md diff --git a/platform/separation_of_duties.py b/acdl_platform/separation_of_duties.py similarity index 100% rename from platform/separation_of_duties.py rename to acdl_platform/separation_of_duties.py diff --git a/scripts/verify_phase06.sh b/scripts/verify_phase06.sh index b4b93c0..fef2f55 100755 --- a/scripts/verify_phase06.sh +++ b/scripts/verify_phase06.sh @@ -22,11 +22,15 @@ out=$(ACDL_GITEA_TOKEN= bash demo/scripts/run_demo.sh --no-upload 2>&1); rc=$? ok "demo/scripts/run_demo.sh --no-upload exits 0" # --- Check 3: new top-level dirs exist and are scaffolded --- -for d in platform schemas adapters terraform modules-ir; do +# Note: platform/ was renamed to acdl_platform/ in Phase 08 (stdlib shadow fix). +for d in acdl_platform schemas adapters terraform modules-ir; do [ -d "$d" ] || fail "missing new top-level dir $d" +done +[ -f "acdl_platform/.gitkeep" ] || [ -f "acdl_platform/__init__.py" ] || fail "acdl_platform/ not scaffolded" +for d in schemas adapters terraform modules-ir; do [ -f "$d/.gitkeep" ] || fail "missing $d/.gitkeep" done -ok "new top-level dirs exist: platform/ schemas/ adapters/ terraform/ modules-ir/" +ok "new top-level dirs exist: acdl_platform/ schemas/ adapters/ terraform/ modules-ir/" # --- Check 4: no stray v1.0 dirs left at repo root --- for stray in modules evidence-ui contracts contracts-repo ACDL_DEMO.md; do diff --git a/scripts/verify_phase07.sh b/scripts/verify_phase07.sh index d499e23..f1cc865 100755 --- a/scripts/verify_phase07.sh +++ b/scripts/verify_phase07.sh @@ -7,43 +7,37 @@ fail() { echo "FAIL: $*" >&2; exit 1; } ok() { echo "ok: $*"; } # --- Check 1: all 9 deliverable files exist --- +# Note: platform/ was renamed to acdl_platform/ in Phase 08 to avoid +# shadowing the stdlib platform module (boto3 imports uuid -> +# platform.system()). for f in docs/architecture-v1.0.md \ schemas/ir.schema.json \ schemas/policy_check_result.schema.json \ schemas/contract.schema.json \ - platform/confidence_signal.py \ - platform/audit_ledger_design.md \ - platform/hitl_matrix_design.md \ - platform/separation_of_duties.py \ + acdl_platform/confidence_signal.py \ + acdl_platform/audit_ledger_design.md \ + acdl_platform/hitl_matrix_design.md \ + acdl_platform/separation_of_duties.py \ adapters/terraform/policy/checkov_adapter.py; do [ -f "$f" ] || fail "missing $f" done ok "all 9 deliverable files exist" # --- Check 2: 3 JSON Schemas are valid Draft 2020-12 --- -# Run python from /tmp so the repo's `platform/` package does not shadow the -# stdlib `platform` module (jsonschema imports uuid -> platform.system(); -# our platform/ shadows it when cwd is repo root and on sys.path[0]). -check_schema() { - ( cd /tmp && python3 -c " -import json, jsonschema -s = json.load(open('$1')) -jsonschema.Draft202012Validator.check_schema(s) -" >/dev/null 2>&1 ) -} -for s in "$ROOT/schemas/ir.schema.json" "$ROOT/schemas/policy_check_result.schema.json" "$ROOT/schemas/contract.schema.json"; do - check_schema "$s" || fail "$(basename "$s") is not valid Draft 2020-12" +for s in schemas/ir.schema.json schemas/policy_check_result.schema.json schemas/contract.schema.json; do + python3 -c "import json, jsonschema; jsonschema.Draft202012Validator.check_schema(json.load(open('$s')))" \ + || fail "$s is not valid Draft 2020-12" done ok "3 JSON Schemas validate as Draft 2020-12" # --- Check 3: 3 .py files py_compile --- -for p in platform/confidence_signal.py platform/separation_of_duties.py adapters/terraform/policy/checkov_adapter.py; do +for p in acdl_platform/confidence_signal.py acdl_platform/separation_of_duties.py adapters/terraform/policy/checkov_adapter.py; do python3 -m py_compile "$p" || fail "$p py_compile failed" done ok "3 .py files py_compile" # --- Check 4: 3 .md design files non-empty --- -for m in platform/audit_ledger_design.md platform/hitl_matrix_design.md docs/architecture-v1.0.md; do +for m in acdl_platform/audit_ledger_design.md acdl_platform/hitl_matrix_design.md docs/architecture-v1.0.md; do [ -s "$m" ] || fail "$m is empty" done ok "3 .md design files non-empty" @@ -67,18 +61,14 @@ ok "D-040..D-044 present in PROJECT.md" # --- Check 8: spike contract validates against contract schema --- echo '{"stack":"l2-static-asset","environment":"dev","inputs":{"bucket_name":"x","region":"us-east-1"}}' > /tmp/spike-contract.json -( cd /tmp && python3 -c " -import json, jsonschema -jsonschema.validate(json.load(open('/tmp/spike-contract.json')), json.load(open('$ROOT/schemas/contract.schema.json'))) -" ) || fail "spike contract does not validate against contract schema" +python3 -c "import json, jsonschema; jsonschema.validate(json.load(open('/tmp/spike-contract.json')), json.load(open('schemas/contract.schema.json')))" \ + || fail "spike contract does not validate against contract schema" ok "spike contract validates against contract schema" # --- Check 9: minimal IR validates against IR schema --- echo '{"version":"1.0.0","stack":{"name":"l2-static-asset","kind":"l2","depth":1},"resources":[{"id":"s3","type":"aws:s3:bucket","module":"l1-s3@1.0.0","inputs":{"bucket_name":"x","region":"us-east-1"}}]}' > /tmp/spike-ir.json -( cd /tmp && python3 -c " -import json, jsonschema -jsonschema.validate(json.load(open('/tmp/spike-ir.json')), json.load(open('$ROOT/schemas/ir.schema.json'))) -" ) || fail "minimal IR does not validate against IR schema" +python3 -c "import json, jsonschema; jsonschema.validate(json.load(open('/tmp/spike-ir.json')), json.load(open('schemas/ir.schema.json')))" \ + || fail "minimal IR does not validate against IR schema" ok "minimal IR validates against IR schema" echo "VERIFIED — Phase 07: architecture v1.0 finalized; 6 files authored + 11 decisions resolved" \ No newline at end of file