feat(P53): local emulating adapters (D-092) — full local E2E, no AWS

The platform is now fully locally testable without cloud credentials.
The headline E2E (contract -> resolver -> adapter -> S3 state -> ECS
service -> DynamoDB outbox -> contract-ingestor Lambda) runs end-to-end
against the local emulating tier (D-092, REQ-113).

Four local emulating adapters in core/local_emulators.py:
- FlatFileOutbox: flat-file DynamoDB outbox emulator (hash-chained JSONL;
  resumable across instances; chain verification).
- LocalEcsEmulator: local ECS Fargate HTTP 200 emulator (free-port
  binding on 127.0.0.1; health check; clean destroy).
- LocalS3StateBackend: rewrites the terraform S3 backend to a local
  backend (per-stack tfstate in a temp folder).
- LocalLambdaStub: invokes the contract_ingestor handler in-process
  (patches _get_dynamodb / _get_secrets_client / urllib.urlopen;
  DynamoDB writes redirected to the FlatFileOutbox).

run_platform.sh gains a --local flag that short-circuits to the local
emulating tier (no AWS, no Checkov, no DynamoDB).

Regression gate (D-091) now covers 12 capabilities (was 10): +CAP-011
(local E2E microservice) + CAP-012 (local E2E static-assets).

Verified: 513 fast tests pass (was 502; +11 new). 2 slow local E2E
tests pass. run_regression.sh reports 12/12 Verified. run_platform.sh
--local exits 0 with LOCAL E2E OK. No AWS credentials required.

---ci---
project: acdl
phase: 53
milestone: v1.10
status: verify
requirements:
  covered: [REQ-113]
  partial: []
decisions: [D-092]
regression:
  - { capability: CAP-011, status: Verified }
  - { capability: CAP-012, status: Verified }
---/ci---
This commit is contained in:
Jon Chery
2026-07-27 17:39:33 +00:00
parent 9897df04b2
commit 217653d6f4
9 changed files with 858 additions and 76 deletions
+18
View File
@@ -41,6 +41,7 @@ PLAN_ONLY=0
QUIET=0
DEPLOY_UPTIME=0
DECOMMISSION=0
LOCAL_TIER=0
CHANGE_REQUEST_ID=""
ENVIRONMENT_OVERRIDE=""
CONTRACT=""
@@ -60,6 +61,7 @@ for arg in "$@"; do
--quiet) QUIET=1 ;;
--deploy-uptime) DEPLOY_UPTIME=1 ;;
--decommission) DECOMMISSION=1 ;;
--local) LOCAL_TIER=1 ;;
--environment=*) ENVIRONMENT_OVERRIDE="${arg#*=}" ;;
--environment) _prev="--environment" ;;
--*) echo "FAIL: unknown flag: $arg" >&2; exit 1 ;;
@@ -96,6 +98,22 @@ fi
fail() { echo "FAIL: $*" >&2; exit 1; }
# --local: run the headline E2E against the local emulating tier (D-092).
# No AWS credentials, no Checkov, no DynamoDB. Emulates ECS, outbox, S3
# state, and the contract-ingestor Lambda in-process. Exits 0 on success.
if [ "$LOCAL_TIER" = "1" ]; then
[ -n "$CONTRACT" ] || CONTRACT="contracts/microservice.yaml"
echo "=== ACDL Local Emulating Tier (D-092) ==="
echo "contract: $CONTRACT (no AWS credentials required)"
echo ""
ACDL_LOCAL_TIER=1 python3 core/local_emulators.py "$CONTRACT" \
|| fail "local E2E failed"
echo ""
echo "=== LOCAL E2E OK ==="
echo "contract -> resolver -> adapter -> local S3 backend -> local ECS (HTTP 200) -> flat-file outbox -> local Lambda"
exit 0
fi
# stream: pipe a command's stdout+stderr to both a log file and the
# terminal (unless --quiet). Usage: stream <logfile> -- <command...>
stream() {