Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 87febc7129 | |||
| 81c6e3995e | |||
| 1ad9c35fb6 | |||
| 9504782a77 | |||
| 6f865a6b3d | |||
| ab69d1069f | |||
| 031c320551 | |||
| d6b192307a | |||
| 2ed2ca6bac | |||
| 4b8758404c | |||
| 35a336aba2 | |||
| d3aa960eb8 | |||
| e29319a720 | |||
| 7afaa34b60 | |||
| 622abe015b | |||
| 8437a51c6c | |||
| cc4c27c8ab | |||
| 798f430218 | |||
| e71539d681 | |||
| 55557962bd | |||
| 4c9314710b | |||
| 3936bf460a | |||
| 3070a68e1d | |||
| e054a95fd5 | |||
| 327ba1de75 | |||
| 6d27dad114 | |||
| 067fef14aa | |||
| 96ab42fde1 | |||
| d28630d1f1 | |||
| 1d5c4d2ae7 | |||
| f8ddd8b182 | |||
| a003168b3a | |||
| 727c87339b | |||
| 167a92f621 | |||
| 8723206f5a | |||
| 412e1ef62e | |||
| 68d90c08a7 | |||
| 6ed93f0311 | |||
| f8e99ed906 | |||
| 92d4535f5f | |||
| b40aadd195 | |||
| 0779a92e2f |
@@ -298,4 +298,81 @@ ACDL has no `package.json`. The verification gate substitutes:
|
||||
3. Phase 08 — AWS OIDC bootstrap (use temp key once, rotate).
|
||||
4. Phase 09 — IR + `l1-s3` + Terraform adapter → `terraform plan`.
|
||||
5. Phase 10 — `l2-static-asset` + contract→IR → end-to-end spike.
|
||||
6. COMPLETE gate — review → ship `v1.2.0` → audit.
|
||||
6. COMPLETE gate — review → ship `v1.2.0` → audit. **DONE.**
|
||||
|
||||
## v1.2 build-out scope
|
||||
|
||||
v1.2 takes the v1.1 spike (dev-only, `plan`-only, single S3 L1) to a real,
|
||||
simpler, better-documented platform that delivers a microservice to AWS ECS
|
||||
Fargate end-to-end. The locked architecture (§1–§12) is unchanged — v1.2
|
||||
extends the *implementation*, not the design.
|
||||
|
||||
### In scope (five axes, user-directed 2026-07-21)
|
||||
|
||||
1. **Re-evaluate the current state.** go-gitea/gitea#36988 (OIDC for Gitea
|
||||
Actions) re-checked 2026-07-21: still **open** (last updated 2026-05-27,
|
||||
not merged). Real OIDC remains deferred to v1.3+; v1.2 extends the D-039
|
||||
per-run-rotated-key waiver as **D-047**. The waiver continues to satisfy
|
||||
§12.5's *intent* (no *persistently* long-lived key): the spike key is
|
||||
rotated after each run by `scripts/rotate_spike_key.sh`, and Phase 12
|
||||
tightens the IAM scoping + rotation hygiene.
|
||||
2. **NFR improvements on the existing spike.** Least-privilege IAM audit of
|
||||
`spike_runner_policy.json`; idempotent `create_state_backend.py` /
|
||||
`create_iam_user.py`; proper exit codes / error handling; P1-1 redaction
|
||||
(two AWS access key IDs in `.ciagent/VERIFY.md` Phase 09 narrative).
|
||||
3. **Streamline / simplify the current setup.** Consolidate
|
||||
`run_spike_plan.sh` + `run_spike_e2e.sh` into one
|
||||
`scripts/run_platform.sh`; remove dead code and stale `platform/` paths.
|
||||
4. **README.md fully up to date on how the platform works.** Reflect v1.1
|
||||
complete; document the actual spike flow, `scripts/run_platform.sh`, the
|
||||
real repo layout, and the v1.2 objective.
|
||||
5. **Bootstrap a consumer repo with a basic microservice deployed to ECS
|
||||
end-to-end.** New Gitea repo `acdl-consumer-microservice` (org
|
||||
`continuous-intelligence`); new IR-typed L1s (`l1-vpc`, `l1-ecs-cluster`,
|
||||
`l1-ecs-service`, `l1-iam-role`, `l1-alb`, `l1-ecr`); new
|
||||
`l2-microservice` thin-composition; one contract submission →
|
||||
`terraform apply` (dev, autonomous per §10, confidence ≥ 0.50) → a live
|
||||
ECS Fargate service serving HTTP 200 → evidence event to the DynamoDB
|
||||
outbox → acdl-evidence timeline.
|
||||
|
||||
### Substrate extension (ECS Fargate)
|
||||
|
||||
The Terraform adapter (§12) remains the only substrate-specific code. v1.2
|
||||
expands the adapter `TYPE_MAP` to cover the six new ECS-shaped IR resource
|
||||
types. The L1 interface shape (IR-typed inputs/outputs/NFRs, registered in
|
||||
`modules-ir/registry.json`) is unchanged — only the set of registered L1s
|
||||
grows. The IR commitments (REQ-28) continue to hold: `modules-ir/`,
|
||||
`schemas/`, `contracts/`, `acdl_platform/confidence_signal.py`,
|
||||
`acdl_platform/contract_resolver.py`, `acdl_platform/outbox_writer.py`
|
||||
remain substrate-agnostic.
|
||||
|
||||
### `terraform apply` (dev only)
|
||||
|
||||
v1.2 lifts the substrate execution from `plan` to `apply` for the `dev`
|
||||
environment only. Dev is autonomous per §10 (confidence ≥ 0.50, no HITL).
|
||||
`apply` for qa/prod/dr remains HITL-gated and out of scope for v1.2. The
|
||||
apply result (resources created, plan diff) is captured in the evidence
|
||||
stream as a `terraform.apply` event.
|
||||
|
||||
### Out of scope for v1.2 (deferred to v1.3+)
|
||||
|
||||
| Feature | Reason |
|
||||
|---------|--------|
|
||||
| Real OIDC federation | go-gitea/gitea#36988 still open. v1.2 extends D-039 waiver (D-047); real OIDC is v1.3+. |
|
||||
| Full HITL matrix wiring (qa/prod/dr) | v1.2 is dev-only autonomous `apply`; HITL wiring is v1.3. |
|
||||
| Kyverno + OPA policy engines | v1.2 keeps Checkov only; Kyverno/OPA are v1.3. |
|
||||
| MCP skill catalog + real L3B agent | v1.2 keeps the L3B stub; the 5-skill catalog is v1.3. |
|
||||
| Audit ledger build-out (S3 Object Lock + JWS + async worker + DLQ + daily checkpoints) | v1.2 keeps the v1.1 outbox; the regulatory ledger is v1.3. |
|
||||
| Multi-region state / outbox | Single-region in v1 (§9, §12.3); multi-region is v1.3+. |
|
||||
| Prod/dr environments | v1.2 is dev-only; prod/dr are v1.3. |
|
||||
| GitOps reconciler (ArgoCD/Flux) | v1.3+. |
|
||||
|
||||
## Build order (v1.2)
|
||||
|
||||
1. Phase 11 — re-eval #36988 + NFR audit + simplification findings + README rewrite.
|
||||
2. Phase 12 — NFR harden + simplify (idempotent bootstrap, one `run_platform.sh`, IAM audit, redactions).
|
||||
3. Phase 13 — six ECS L1s + adapter `TYPE_MAP` expansion.
|
||||
4. Phase 14 — `l2-microservice` + contract schema extension.
|
||||
5. Phase 15 — consumer repo + `terraform apply` (dev) → live ECS service.
|
||||
6. Phase 16 — capstone e2e: consumer commit → live HTTP 200 → evidence → timeline.
|
||||
7. COMPLETE gate — review → ship `v1.3.0` → audit.
|
||||
@@ -0,0 +1,225 @@
|
||||
# ACDL v1.1 Milestone — Audit
|
||||
|
||||
**Auditor:** ci-audit-verifier (model: glm-5.2)
|
||||
**Scope:** v1.1 milestone — Phases 06–10 (tags v1.1.1..v1.1.5), milestone ship tag `v1.2.0`, diff `v1.1.0..HEAD` (48 commits)
|
||||
**Date:** 2026-07-21
|
||||
**Verdict:** **CLEAN** — 0 P0 (no critical issues, no feedback loop), 2 P1 post-hoc hygiene items, 0 P2.
|
||||
|
||||
---
|
||||
|
||||
## 1. Reconstruction test
|
||||
|
||||
**PASS.** The project state can be reconstructed from the git log `---ci---` blocks alone, and it matches the `.ciagent/` file contents.
|
||||
|
||||
### HEAD ci block (d6b1923)
|
||||
|
||||
The latest `---ci---` block on `main` HEAD (== `v1.2.0` tag target) reads:
|
||||
|
||||
```
|
||||
project: acdl
|
||||
phase: 0
|
||||
milestone: v1.1
|
||||
status: complete
|
||||
requirements:
|
||||
covered: [REQ-16..REQ-28]
|
||||
```
|
||||
|
||||
This matches the prompt's expected block exactly: `status: complete`, `milestone: v1.1`, `requirements covered: [REQ-16..28]`. ✅
|
||||
|
||||
### Phase progression (walk-back through ci blocks)
|
||||
|
||||
Each phase (06–10) shows the documented plan → plan-as-execute → shipped → verify progression with the correct phase number. The complete sequence reconstructed from `git log`:
|
||||
|
||||
| Phase | plan commit | plan-as-execute commits | ship commit (release.tag) | verify commit (verdict) |
|
||||
|-------|--------------|--------------------------|----------------------------|--------------------------|
|
||||
| 06 | b927f90 (`status: plan`) | e044a2d | ecb2c78 (`release.tag: v1.1.1`) + 4ab15cb (docs) | 0779a92 (`verdict: VERIFIED`) |
|
||||
| 07 | b40aadd | 92d4535, f8e99ed, 6ed93f0, 68d90c0, 412e1ef | 8723206 (`release.tag: v1.1.2`) | 167a92f (`verdict: VERIFIED`) |
|
||||
| 08 | a003168 | f8ddd8b, 1d5c4d2, d28630d, 727c873 (prep) | 067fef1 (`release.tag: v1.1.3`) + 96ab42f (docs) | 6d27dad (`verdict: VERIFIED`) |
|
||||
| 09 | 327ba1d | e054a95, 3070a68, 3936bf46 | 5555796 (`release.tag: v1.1.4`) + 4c93147 (docs) | e71539d (`verdict: VERIFIED`) |
|
||||
| 10 | cc4c27c (prep 798f430) | 8437a51, 622abe0, 7afaa34, e29319a | 35a336a (`release.tag: v1.1.5`) + d3aa960 (docs) | 4b87584 (`verdict: VERIFIED`) |
|
||||
|
||||
Then the milestone tail: 2ed2ca6 (`status: review`, `verdict: READY TO SHIP`) → d6b1923 (`status: complete`, `v1.2.0` tag). ✅
|
||||
|
||||
### Tags
|
||||
|
||||
`git tag --list` returns the expected set:
|
||||
|
||||
- `v1.0.1..v1.0.5` (v1.0 demo phase tags, preserved per D-rule)
|
||||
- `v1.1.0` (pre-v1.1 demo — points at 58adf9e, the v1.0 Phase 05 traceability commit)
|
||||
- `v1.1.1..v1.1.5` (phase patches 06–10)
|
||||
- `v1.2.0` (milestone ship tag — points at HEAD d6b1923, the complete commit)
|
||||
|
||||
All 12 tags present; no missing tags; no extra tags. ✅
|
||||
|
||||
### ROADMAP.md ↔ tags
|
||||
|
||||
The ROADMAP.md phase statuses match the tags exactly:
|
||||
|
||||
- Phase 06 → `complete (v1.1.1)` ✅
|
||||
- Phase 07 → `complete (v1.1.2)` ✅
|
||||
- Phase 08 → `complete (v1.1.3)` ✅
|
||||
- Phase 09 → `complete (v1.1.4)` ✅
|
||||
- Phase 10 → `complete (v1.1.5)` ✅
|
||||
|
||||
The v1.1 milestone header (line 74) reads `## v1.1 (Complete — architecture finalization + v1 spike, 2026-07-21)` and line 80 says `Status: COMPLETE — all 5 phases shipped (v1.1.1..v1.1.5) + verified; review READY TO SHIP (0 P0); audit pending`. The "audit pending" clause is now stale (this audit closes it) — see P1-A below.
|
||||
|
||||
### REQUIREMENTS.md ↔ tags
|
||||
|
||||
The v1.1 traceability table (lines 117–129) matches the phase tags:
|
||||
|
||||
| REQ | Phase | Status (file) | Tag (git) | Match |
|
||||
|-----|-------|---------------|-----------|-------|
|
||||
| REQ-16..22 | 07 | complete (v1.1.2) | v1.1.2 | ✅ |
|
||||
| REQ-23 | 08 | complete (v1.1.3) | v1.1.3 | ✅ |
|
||||
| REQ-24, 26 | 09 | complete (v1.1.4) | v1.1.4 | ✅ |
|
||||
| REQ-25, 27, 28 | 10 | complete (v1.1.5) | v1.1.5 | ✅ |
|
||||
|
||||
The HEAD complete-commit ci block's `requirements.covered: [REQ-16..REQ-28]` matches REQUIREMENTS.md's 13 complete entries. ✅
|
||||
|
||||
### Reconstruction conclusion
|
||||
|
||||
Reconstructing the project state from git log `---ci---` blocks alone reproduces the `.ciagent/` file contents (PROJECT.md phase table, ROADMAP.md statuses, REQUIREMENTS.md traceability, REVIEW.md verdict). **No drift detected.** ✅
|
||||
|
||||
---
|
||||
|
||||
## 2. .ciagent/ file discipline
|
||||
|
||||
**PASS with one P1 hygiene item.** All required files exist; the latest phase's PLAN/VERIFY are in place; no orphans; no stale v1.0 framing. One stale-path issue in PERSONAS.md.
|
||||
|
||||
### Required files (all present)
|
||||
|
||||
| File | Exists | Notes |
|
||||
|------|--------|-------|
|
||||
| `config.json` | ✅ | mode=single, active_project=acdl, milestone=v1.1 |
|
||||
| `PROJECT.md` | ✅ | v1.1 objective (architecture finalization + v1 spike); D-034..D-046 + D-P08/P09/P10 present |
|
||||
| `ARCHITECTURE.md` | ✅ | v1.1 target architecture; v1.1 spike scope; Gitea API surface with D-039 OIDC waiver |
|
||||
| `REQUIREMENTS.md` | ✅ | REQ-16..28 complete; traceability table matches tags |
|
||||
| `ROADMAP.md` | ✅ | v1.1 header marked Complete; phases 06–10 statuses match tags |
|
||||
| `PERSONAS.md` | ✅ | v1.1 roster; deactivated v1.0 stub-engineer; phase-specific overrides |
|
||||
| `PLAN.md` | ✅ | Phase 10 (the last phase) — `phase: 10, name: v1-spike-l2-and-contract-e2e` |
|
||||
| `RESEARCH.md` | ✅ | 8 research targets (OIDC blocker, runner tooling, IR prior art, Checkov adapter, outbox, confidence signal, audit ledger, HITL matrix) |
|
||||
| `VERIFY.md` | ✅ | Phase 10 verification (the last one) — `Verdict: Phase 10: VERIFIED`, tag v1.1.5 |
|
||||
| `REVIEW.md` | ✅ | new for the milestone review — `Verdict: READY TO SHIP`, 0 P0, 1 P1 carried-forward |
|
||||
|
||||
### No stale v1.0 framing in v1.1 files
|
||||
|
||||
- `PROJECT.md` correctly states the v1.1 objective (line 53: "Finalize the architecture to v1.0 ... and prove the locked commitments with one end-to-end v1 implementation spike"). **No** occurrence of "30-min stub demo" / "30 min" / "stub demo" as the current objective. The v1.0 demo is correctly archived under `demo/` (line 89). ✅
|
||||
- The v1.0 demo is referenced as the *prior* milestone (status complete, tag v1.1.0) with a pointer to its archived location. ✅
|
||||
|
||||
### PLAN.md = Phase 10 (the last phase)
|
||||
|
||||
PLAN.md frontmatter: `phase: 10`, `name: v1-spike-l2-and-contract-e2e`, `requirements: [REQ-25, REQ-27, REQ-28]`. Not a stale Phase 06–09 plan. ✅
|
||||
|
||||
### VERIFY.md = Phase 10 (the last verification)
|
||||
|
||||
VERIFY.md header: `# Phase 10 — v1-spike-l2-and-contract-e2e (v1.1) VERIFY`, `Verdict: Phase 10: VERIFIED`, `Tag: v1.1.5`. Not a stale Phase 06–09 verification. ✅
|
||||
|
||||
### No orphan .ciagent/ files
|
||||
|
||||
`ls .ciagent/` shows exactly the 10 standard files (config.json + the 9 markdown files). No leftover/extra files. ✅
|
||||
|
||||
### P1-A (post-hoc hygiene, non-blocking)
|
||||
|
||||
**Two stale-path drift items inside `.ciagent/`:**
|
||||
|
||||
1. **`config.json` line 8:** `"status": "specify"` — the milestone is `complete` (shipped v1.2.0), but the project-status field still reads `specify`. Should be `"complete"` (or `shipped`). Cosmetic — the milestone field reads `v1.1` correctly, and ROADMAP.md carries the authoritative status.
|
||||
|
||||
2. **`PERSONAS.md` territory paths:** 6 references use the stale `platform/...` path prefix (lines 7, 38, 47, 56, 80, 109) instead of the renamed `acdl_platform/...`. The rename happened in Phase 08 prep commit 727c873 (`fix(P08 prep): rename platform/ -> acdl_platform/ (stdlib shadow fix)`). All executable code + the other `.ciagent/` files use `acdl_platform/`; PERSONAS.md was not updated. The territories listed (`platform/confidence_signal.py`, `platform/contract_resolver.py`, `platform/outbox/**`, `platform/registry/**`, `platform/hitl_matrix_design.md`, `platform/audit_ledger_design.md`, `platform/separation_of_duties.py`) should all read `acdl_platform/...`. Non-blocking — the verification toolchain (`PERSONAS.md` `verification_toolchain.typecheck` line 7 also has the stale `platform/**/*.py`) is overridden per-phase by each PLAN.md's explicit `verification.typecheck`, so the stale path does not break any verify script. **Recommended redaction for v1.2 cleanup.**
|
||||
|
||||
---
|
||||
|
||||
## 3. Branch hygiene
|
||||
|
||||
**PASS.** Clean branch topology, clean working tree.
|
||||
|
||||
### Branch list
|
||||
|
||||
`git branch -a` returns:
|
||||
- `main`
|
||||
- `milestone/v1.0-initial` (the v1.0 milestone branch, intentionally retained)
|
||||
- `remotes/origin/main`
|
||||
- `remotes/origin/milestone/v1.0-initial`
|
||||
|
||||
**No leftover `phase/NN-*` branches** (all 5 phase branches — `phase/06-archive-demo-and-reorient`, `phase/07-architecture-v1-finalization`, `phase/08-aws-bootstrap`, `phase/09-v1-spike-ir-and-l1-and-adapter`, `phase/10-v1-spike-l2-and-contract-e2e` — were deleted post-merge, confirmed by the ship commit messages referencing the squash-merge of the phase branch). ✅
|
||||
|
||||
### Working tree
|
||||
|
||||
`git status` on `main`: "nothing to commit, working tree clean". The branch is ahead of `origin/main` by 43 commits (the v1.1 milestone work has not been pushed to the remote yet — this is expected for an audit pass before the milestone is declared shipped; the push is the final ship step). No uncommitted changes; no stray artifacts (`.env.secrets`, `terraform/spike/.terraform/`, `terraform/spike/.terraform.lock.hcl`, `terraform/spike/tfplan`, `terraform/spike/*.tfstate*` are all gitignored per REVIEW.md Lens 3). ✅
|
||||
|
||||
### Branch hygiene conclusion
|
||||
|
||||
Clean. ✅
|
||||
|
||||
---
|
||||
|
||||
## 4. Commit discipline
|
||||
|
||||
**PASS with one P1 hygiene item.** Every v1.1-stage commit carries a `---ci---` block with the documented fields; the field-usage rules hold; the merges are the documented `--no-ff` squash-merge pattern.
|
||||
|
||||
### `---ci---` block presence
|
||||
|
||||
48 commits in `v1.1.0..HEAD`. Audit of ci-block presence:
|
||||
|
||||
- **3 commits with no `---ci---` block:** `52665b8 Add docs/architecture.md`, `7614c41 Add docs/vision.md`, `b84a8a2 Update docs/architecture.md`. All three are **pre-specify upstream-doc ingestion** commits: each is an ancestor of the specify commit `288607b` (`docs(specify): ingest docs/vision+architecture`). They are the raw upstream `docs/` files being added to the repo *before* the v1.1 CIAgent protocol was applied (the specify commit 288607b is the first v1.1-stage commit and the first to carry a v1.1 `---ci---` block). These three commits belong to the v1.0→v1.1 transition, not the v1.1 milestone proper. They are inside the `v1.1.0..HEAD` audit range only because `v1.1.0` is tagged at the v1.0 Phase 05 traceability commit (58adf9e) — a tag-placement choice that puts the v1.0-complete + audit-v1.0 + docs-ingestion commits inside the v1.1 range. **P1-B (post-hoc, non-blocking):** if the audit protocol requires every commit in the `v1.1.0..HEAD` range to carry a v1.1 ci block, these three pre-specify ingestion commits technically fail it. However: (a) they predate the v1.1 specify stage, (b) the v1.0 milestone-complete commit `80ac975` and the v1.0 audit `d700148` carry v1.0 ci blocks (correct for their milestone), and (c) the v1.0 contracts commit `30e63d6` carries a v1.0 ci block. Only the 3 raw `docs/` ingestion commits lack any ci block at all. Recommended for a future note in the run.md about tag placement (a v1.1.0 tag on the v1.0 *complete* commit rather than the v1.0 Phase 05 traceability commit would have excluded these from the v1.1 range). Non-blocking.
|
||||
|
||||
- **45 commits with `---ci---` blocks:** all carry `project: acdl`, `phase:` (0 for milestone-stage, 6–10 for phase-stage), `milestone: v1.1`, and `status:` from the documented set {specify, clarify, research, plan, plan-as-execute, shipped, verify, review, complete}. ✅
|
||||
|
||||
### Field usage rules
|
||||
|
||||
- **`release.tag`** appears only on the 5 ship commits (ecb2c78 v1.1.1, 8723206 v1.1.2, 067fef1 v1.1.3, 5555796 v1.1.4, 35a336a v1.1.5) — never on plan/plan-as-execute/verify/review/complete commits. ✅
|
||||
- **`verdict`** appears only on the 5 verify commits (0779a92, 167a92f, 6d27dad, e71539d, 4b87584) and the 1 review commit (2ed2ca6) — never elsewhere. ✅
|
||||
- **`requirements.covered`** appears on plan-as-execute commits (where a task covers a specific REQ) and on the complete commit (REQ-16..28). The complete commit uses the documented nested form (`requirements:\n covered: [...]`). ✅
|
||||
- **No ad-hoc fields.** All fields used (`project`, `phase`, `milestone`, `status`, `release.tag`, `verdict`, `requirements.covered`, `persona`, `tasks`) are from the documented set. ✅
|
||||
|
||||
### Merge commits
|
||||
|
||||
`git log --merges v1.1.0..HEAD` returns exactly the 5 ship commits:
|
||||
|
||||
```
|
||||
35a336a ship: phase-10 ... (v1.1.5) [parents: e71539d d3aa960]
|
||||
5555796 ship: phase-09 ... (v1.1.4) [parents: 327ba1d 4c93147]
|
||||
067fef1 ship: phase-08 ... (v1.1.3) [parents: 167a92f 96ab42f]
|
||||
8723206 ship: phase-07 ... (v1.1.2) [parents: b40aadd 412e1ef]
|
||||
ecb2c78 ship: phase-06 ... (v1.1.1) [parents: b927f90 4ab15cb]
|
||||
```
|
||||
|
||||
Each ship commit has two parents: (1) the prior `verify` commit on `main`, and (2) the phase branch's final `docs(PNN): post-ship traceability` commit. This is the documented `--no-ff` squash-merge pattern (the phase branch is merged into main as a merge commit, not a fast-forward). **No** other merge commits exist in the range — no surprise merges, no `--ff-only` regressions. ✅
|
||||
|
||||
### Closing-tag note
|
||||
|
||||
All 45 ci-block commits close the block with `---/ci---` (the documented closing tag). **No** commit uses the malformed `---ci---` close. ✅
|
||||
|
||||
---
|
||||
|
||||
## Critical issues
|
||||
|
||||
**No critical issues (0 P0).** The audit found no blocking problems:
|
||||
|
||||
- Reconstruction test passes — git log reproduces the `.ciagent/` state with no drift.
|
||||
- File discipline passes — all 10 files present, latest-phase PLAN/VERIFY in place, no orphans, no stale v1.0 framing.
|
||||
- Branch hygiene passes — clean topology, no leftover phase branches, clean working tree.
|
||||
- Commit discipline passes — every v1.1-stage commit carries a well-formed `---ci---` block; field rules hold; merges are the documented pattern.
|
||||
|
||||
**No feedback loop is triggered.** The milestone does not need to return to EXECUTE.
|
||||
|
||||
---
|
||||
|
||||
## Post-hoc hygiene (P1s for v1.2 cleanup)
|
||||
|
||||
| ID | Item | Severity | File / location | Fix |
|
||||
|----|------|----------|-----------------|-----|
|
||||
| **P1-1** (carried-forward from REVIEW.md) | Two AWS access key IDs (`AKIAYOZHMKZ7RK26N66W` rotated spike key, `AKIAYOZHMKZ772SINHFX` deactivated root key) appear in `.ciagent/VERIFY.md` Phase 09 narrative. **Public identifiers, not secret pairs.** They live in the `.ciagent/` audit narrative, not in any executable code path. | P1 (non-blocking) | `.ciagent/VERIFY.md` Phase 09 narrative | Replace with placeholders `AKIA…SPIKE` / `AKIA…ROOT-DEACTIVATED` in a v1.2 redaction pass. |
|
||||
| **P1-A** (audit-new) | `config.json` line 8 `"status": "specify"` is stale — the milestone is `complete` (v1.2.0 shipped). | P1 (non-blocking) | `.ciagent/config.json:8` | Update to `"status": "complete"` (or `"shipped"`) in v1.2 cleanup. |
|
||||
| **P1-B** (audit-new) | `PERSONAS.md` territory paths (lines 7, 38, 47, 56, 80, 109) reference the stale `platform/...` prefix instead of the renamed `acdl_platform/...`. The rename happened in Phase 08 prep (commit 727c873). The verification toolchain line 7 also has the stale `platform/**/*.py` glob. Non-blocking: each PLAN.md overrides the toolchain per-phase, and territories are descriptive (enforcement mode = `warn`). | P1 (non-blocking) | `.ciagent/PERSONAS.md` lines 7, 38, 47, 56, 80, 109 | Replace `platform/` with `acdl_platform/` in v1.2 cleanup. |
|
||||
| **P1-C** (audit-new, observation) | 3 pre-specify upstream-doc ingestion commits (`52665b8 Add docs/architecture.md`, `7614c41 Add docs/vision.md`, `b84a8a2 Update docs/architecture.md`) carry no `---ci---` block. They predate the v1.1 specify stage (each is an ancestor of the specify commit 288607b). They fall inside the `v1.1.0..HEAD` audit range only because the `v1.1.0` tag is placed at the v1.0 Phase 05 traceability commit (58adf9e) rather than the v1.0 complete commit (80ac975). | P1 (non-blocking, process note) | tag placement + run.md | Document in run.md that the milestone-complete tag should be placed on the milestone-complete commit to exclude the transition-window commits from the next milestone's audit range. No file change needed for v1.1; v1.2 should pick the tag placement deliberately. |
|
||||
| **P1-D** (audit-new, cosmetic) | `ROADMAP.md` line 81 says `audit pending` — now stale (this audit closes it). | P1 (non-blocking, cosmetic) | `.ciagent/ROADMAP.md:81` | Update to `audit CLEAN` (or remove the clause) in v1.2 cleanup. |
|
||||
|
||||
---
|
||||
|
||||
## Final verdict
|
||||
|
||||
**v1.1 milestone audit: CLEAN**
|
||||
|
||||
- 0 P0 (no critical issues, no feedback loop).
|
||||
- 5 P1 post-hoc hygiene items (1 carried-forward from REVIEW.md + 4 audit-new), all non-blocking, all flagged for v1.2 cleanup.
|
||||
- The milestone is shippable as-is. The `v1.2.0` tag on `main` HEAD is valid.
|
||||
@@ -4,7 +4,7 @@ milestone: v1.1
|
||||
generated_at: 2026-07-21
|
||||
generator: lead-developer
|
||||
verification_toolchain:
|
||||
typecheck: "terraform validate && python3 -m py_compile platform/**/*.py && python3 -m jsonschema schemas/*.schema.json"
|
||||
typecheck: "terraform validate && python3 -m py_compile acdl_platform/**/*.py && python3 -m jsonschema schemas/*.schema.json"
|
||||
test: "scripts/verify_phaseNN.sh"
|
||||
build: "terraform init"
|
||||
note: |
|
||||
@@ -35,7 +35,7 @@ verification_toolchain:
|
||||
- **Phase-specific:** false
|
||||
- **Frameworks:** python, json-schema, gitea-actions, act_runner, bash, yaml
|
||||
- **Constraints:** contract-schema-first, fail-fast-with-reason-codes, no-long-lived-credentials, severity-to-penalty-mapping-immutable
|
||||
- **Territory:** `platform/confidence_signal.py`, `platform/contract_resolver.py`, `platform/outbox/**`, `schemas/**` (contract + IR + PolicyCheckResult), `contracts/**` (sample contracts), `.gitea/workflows/**` (pipeline)
|
||||
- **Territory:** `acdl_platform/confidence_signal.py`, `acdl_platform/contract_resolver.py`, `acdl_platform/outbox_writer.py`, `schemas/**` (contract + IR + PolicyCheckResult), `contracts/**` (sample contracts), `.gitea/workflows/**` (pipeline)
|
||||
- **Reason:** Owns the contract schema, contract→IR resolution, the confidence signal (6 inputs + severity mapping), the DynamoDB outbox writer, and the central pipeline workflow.
|
||||
|
||||
### platform-engineer (custom)
|
||||
@@ -53,7 +53,7 @@ verification_toolchain:
|
||||
- **Phase-specific:** false
|
||||
- **Frameworks:** aws-iam, oidc, checkov, json-schema
|
||||
- **Constraints:** least-privilege, separation-of-duties-identity-distinctness, no-secrets-in-skill-markdown, audit-chain-extends-not-tears-up, critical-finding-hard-overrides-confidence
|
||||
- **Territory:** `platform/hitl_matrix_design.md`, `platform/audit_ledger_design.md`, `adapters/terraform/policy/**` (Checkov adapter → PolicyCheckResult), `platform/separation_of_duties.py`
|
||||
- **Territory:** `acdl_platform/hitl_matrix_design.md`, `acdl_platform/audit_ledger_design.md`, `adapters/terraform/policy/**` (Checkov adapter → PolicyCheckResult), `acdl_platform/separation_of_duties.py`
|
||||
- **Reason:** Owns the HITL matrix design, separation-of-duties (DynamoDB identity-distinctness), the audit ledger design (S3 Object Lock + JWS + chain), and the Checkov→PolicyCheckResult adapter. Enforces the "Safety is Computed, Not Assumed" + "Audit truth lives outside the repository" vision tenets.
|
||||
|
||||
### frontend-engineer
|
||||
@@ -77,7 +77,7 @@ verification_toolchain:
|
||||
### data-engineer
|
||||
- **Domain:** data
|
||||
- **Active:** false
|
||||
- **Reason:** No ORM/persistence framework. The v1.1 outbox is DynamoDB but accessed via boto3 calls inside `platform/outbox/**` (owned by backend-engineer); the audit ledger is S3 Object Lock + JWS (owned by security-engineer). No schema-migration layer, no ORM, no data-engineer territory.
|
||||
- **Reason:** No ORM/persistence framework. The v1.1 outbox is DynamoDB but accessed via boto3 calls inside `acdl_platform/outbox_writer.py` (owned by backend-engineer); the audit ledger is S3 Object Lock + JWS (owned by security-engineer). No schema-migration layer, no ORM, no data-engineer territory.
|
||||
- **Phase-specific:** false
|
||||
- **Frameworks:** (would have been: drizzle, prisma)
|
||||
- **Constraints:** (would have been: schema-first, type-safe-orm)
|
||||
@@ -106,7 +106,7 @@ being right before backend wiring.
|
||||
## Conflict resolutions (lead-developer arbitration)
|
||||
|
||||
- `backend-engineer` vs `platform-engineer` over `schemas/ir.schema.json`: platform-engineer owns the IR (it is substrate-agnostic but infra-shaped); backend-engineer owns the contract schema and the contract→IR resolution (contract is the consumer surface). Co-authoring is expected; conflict goes to lead-developer.
|
||||
- `backend-engineer` vs `security-engineer` over `platform/confidence_signal.py`: security-engineer owns the severity→penalty mapping + critical-override semantics; backend-engineer owns the 6-input weighted sum + per-env thresholds. The confidence signal is co-owned; conflicts go to lead-developer.
|
||||
- `backend-engineer` vs `security-engineer` over `acdl_platform/confidence_signal.py`: security-engineer owns the severity→penalty mapping + critical-override semantics; backend-engineer owns the 6-input weighted sum + per-env thresholds. The confidence signal is co-owned; conflicts go to lead-developer.
|
||||
- `platform-engineer` vs `security-engineer` over `adapters/terraform/policy/**`: security-engineer owns the Checkov→PolicyCheckResult adapter (policy is a security concern); platform-engineer owns the Terraform adapter (substrate translation). No overlap.
|
||||
- `lead-developer` vs any: lead-developer owns `.ciagent/**` + `docs/**` meta + verification scripts; persona engineers do not edit CIAgent metadata or the vision/architecture source docs.
|
||||
|
||||
|
||||
+43
-447
@@ -1,453 +1,49 @@
|
||||
---
|
||||
phase: 6
|
||||
name: archive-demo-and-reorient
|
||||
milestone: v1.1
|
||||
milestone_type: feature
|
||||
status: planned
|
||||
requirements: [] # Phase 06 introduces NO new REQ — it is repo hygiene (ROADMAP §Phase 06).
|
||||
must_haves:
|
||||
- "demo/ contains the full v1.0 demo (modules/, scripts/, evidence-ui/, contracts/, contracts-repo/, .gitea/workflows/, ACDL_DEMO.md)"
|
||||
- "demo/scripts/run_demo.sh --no-upload exits 0 (regression: the archived demo still runs from demo/)"
|
||||
- "New top-level dirs exist and are empty-but-scaffolded with a .gitkeep: platform/, schemas/, adapters/, terraform/, modules-ir/"
|
||||
- "A new top-level scripts/ dir exists with scripts/verify_phase06.sh (v1.1 verify scripts live at top-level scripts/, NOT demo/scripts/)"
|
||||
- "README.md reflects the real platform (vision + architecture links, new layout); the v1.0 demo README content moves to demo/ACDL_DEMO.md (already there)"
|
||||
- ".gitignore updated to ignore runner-data/ (untracked demo runner artifact) if not already"
|
||||
- "No stray empty dirs left at repo root from the moves (contracts-repo/ etc.)"
|
||||
verification:
|
||||
typecheck: "bash -n demo/scripts/*.sh && python3 -m py_compile demo/scripts/*.py"
|
||||
test: "scripts/verify_phase06.sh # lives at TOP-LEVEL scripts/, not demo/scripts/"
|
||||
build: "no-op # Phase 06 is repo hygiene; terraform init is Phase 09+"
|
||||
phase: 11
|
||||
name: v1.2-research-and-readme
|
||||
milestone: v1.2
|
||||
requirements: [REQ-29]
|
||||
type: docs
|
||||
branch: phase/11-v1.2-research-and-readme
|
||||
---
|
||||
|
||||
# Phase 06 — archive-demo-and-reorient PLAN
|
||||
# Phase 11 — v1.2-research-and-readme (v1.2) PLAN
|
||||
|
||||
## Goal
|
||||
|
||||
Archive the complete v1.0 demo under `demo/` (preserve it as the intent
|
||||
reference per D-037), establish the new v1.1 repo layout
|
||||
(`platform/`, `schemas/`, `adapters/`, `terraform/`, `modules-ir/`), and
|
||||
rewrite `README.md` to reflect the real Agentic Cloud Delivery Platform.
|
||||
Verify the archived demo still runs end-to-end from `demo/` via
|
||||
`demo/scripts/run_demo.sh --no-upload` (regression gate).
|
||||
|
||||
This is **repo hygiene only** — no new code, no new REQ. It reorients the
|
||||
repo from "the v1.0 demo is the repo" to "the v1.0 demo is an archived
|
||||
artifact under `demo/`; the repo root is now the real platform's home."
|
||||
|
||||
## Requirements covered
|
||||
|
||||
**None new.** Phase 06 carries no REQ-NN entry (ROADMAP §Phase 06:
|
||||
"Requirements: (no new REQ; repo hygiene)"). It is a structural
|
||||
prerequisite for Phase 07 (architecture-v1-finalization), which owns
|
||||
REQ-16..REQ-22.
|
||||
|
||||
**Dependency:** the v1.0 demo must be complete and tagged. It is — tag
|
||||
`v1.1.0` exists (verified: `git tag` lists `v1.0.1`..`v1.0.5`, `v1.1.0`).
|
||||
All v1.0 phases shipped and audited PASS (ROADMAP §v1.0). The archive
|
||||
preserves the demo immutably; v1.0 tags are not rewritten (PROJECT.md
|
||||
operational parameter: "v1.0 tags preserved").
|
||||
|
||||
**No upstream phase dependency within v1.1** — Phase 06 is the first
|
||||
v1.1 phase. RESEARCH TARGET 10 (conf 0.90) provides the authoritative
|
||||
move list and confirms via static analysis that no path fixups are
|
||||
needed: all demo scripts resolve paths via `SCRIPT_DIR`/`REPO_ROOT`
|
||||
relative-to-script, which auto-adjust when the tree moves to `demo/`.
|
||||
|
||||
## Waves
|
||||
|
||||
Domain priority order from `PERSONAS.md`:
|
||||
`coordination → security → platform → backend → frontend`.
|
||||
|
||||
Phase 06 active personas (PERSONAS.md "Phase-specific overrides"):
|
||||
**lead-developer** (coordination — owns the moves, the new layout, the
|
||||
README, and the verify script) + **frontend-engineer** (demo UI move
|
||||
confirmation only). Backend/platform/security are idle this phase.
|
||||
|
||||
Three waves, strictly ordered (each wave's tasks depend on the prior
|
||||
wave completing):
|
||||
|
||||
---
|
||||
|
||||
### Wave 1 — lead-developer: file moves + new layout + README + verify script
|
||||
|
||||
The structural reorientation. All moves use `git mv` to preserve history.
|
||||
The v1.0 verify scripts move *with* `scripts/` into `demo/scripts/` (they
|
||||
are demo artifacts); the *new* v1.1 verify script lives at a *new*
|
||||
top-level `scripts/` dir (created fresh in this wave).
|
||||
|
||||
#### T-6.1 — Move the v1.0 demo tree into `demo/`
|
||||
|
||||
- **Owner:** lead-developer (territory: `.ciagent/**`, `README.md`,
|
||||
`.gitignore`, top-level layout).
|
||||
- **Files owned:** `demo/` (new), everything moved into it.
|
||||
- **Commit message:**
|
||||
`phase: 6, status: plan-as-execute, persona: lead-developer, task: T-6.1`
|
||||
- **Commands to run verbatim** (cross-checked against RESEARCH.md
|
||||
TARGET 10's move list; verified the dirs exist and are tracked
|
||||
via `git ls-files`):
|
||||
|
||||
```bash
|
||||
# From the repo root (/root/acdl). All moves via `git mv` to preserve history.
|
||||
# 1. Create the demo/ container.
|
||||
mkdir -p demo
|
||||
|
||||
# 2. Move the five demo dirs + the demo deck + the demo contracts-repo.
|
||||
git mv modules demo/modules
|
||||
git mv scripts demo/scripts # carries verify_phase01..05.sh (v1.0 demo verify scripts)
|
||||
git mv evidence-ui demo/evidence-ui
|
||||
git mv contracts demo/contracts # only holds examples/ (v1.0 sample contracts)
|
||||
git mv contracts-repo demo/contracts-repo # tracked: .gitea/workflows/{.gitkeep,issue-to-contract.yml}
|
||||
git mv .gitea demo/.gitea # carries workflows/{.gitkeep,pipeline.yml}
|
||||
git mv ACDL_DEMO.md demo/ACDL_DEMO.md # the v1.0 presentation deck (was untracked — `git add` it first)
|
||||
|
||||
# 3. Handle the untracked demo runner artifact: do NOT git mv (it's untracked).
|
||||
# Move it out of the repo root so it doesn't linger as a stray dir.
|
||||
mv runner-data demo/runner-data # plain mv — not tracked; runner-data/.runner
|
||||
# (runner-data/ is added to .gitignore in T-6.4 so it stays a local artifact.)
|
||||
|
||||
# 4. Sanity: no empty stray dirs remain at repo root.
|
||||
# (git mv removes the source dir when it becomes empty; verify with `ls`.)
|
||||
```
|
||||
|
||||
**Cross-check vs RESEARCH.md TARGET 10 move list:**
|
||||
- `modules/ → demo/modules/` ✓
|
||||
- `scripts/ → demo/scripts/` ✓ (carries v1.0 verify_phase01..05.sh — those
|
||||
are *demo* verify scripts; the v1.1 verify script is created in T-6.3
|
||||
at a *new* top-level `scripts/` dir)
|
||||
- `evidence-ui/ → demo/evidence-ui/` ✓
|
||||
- `contracts/ → demo/contracts/` ✓
|
||||
- `.gitea/workflows/{.gitkeep,pipeline.yml} → demo/.gitea/workflows/` ✓
|
||||
(achieved by moving the whole `.gitea/` dir)
|
||||
- `ACDL_DEMO.md → demo/ACDL_DEMO.md` ✓
|
||||
- `contracts-repo/ → demo/contracts-repo/` ✓ (tracked; confirmed via
|
||||
`git ls-files contracts-repo/` → `.gitea/workflows/.gitkeep` +
|
||||
`.gitea/workflows/issue-to-contract.yml`)
|
||||
- `runner-data/ → demo/runner-data/` ✓ (untracked; plain `mv`)
|
||||
|
||||
**Subtlety (per task instructions):** the v1.1 verify scripts live at a
|
||||
*new* top-level `scripts/` dir (created in T-6.3), NOT inside `demo/scripts/`
|
||||
(which holds the v1.0 demo verify scripts `verify_phase01..05.sh`). This
|
||||
avoids colliding the v1.1 verification toolchain with the archived demo's.
|
||||
|
||||
**Risk note (R-5 from RESEARCH.md):** static analysis found only
|
||||
`/tmp/...` temp-file writes in the demo scripts (e.g.
|
||||
`scripts/gitea_setup.sh`, `scripts/verify_phase01.sh`) — no source-root
|
||||
absolute paths. All demo scripts use `SCRIPT_DIR`/`REPO_ROOT`
|
||||
relative-to-script, which auto-resolve to `demo/` after the move. The
|
||||
regression check in T-6.3 / Wave 3 confirms this empirically.
|
||||
|
||||
#### T-6.2 — Scaffold the new v1.1 top-level dirs (empty, .gitkeep'd)
|
||||
|
||||
- **Owner:** lead-developer (territory: top-level layout).
|
||||
- **Files owned:** `platform/.gitkeep`, `schemas/.gitkeep`,
|
||||
`adapters/.gitkeep`, `terraform/.gitkeep`, `modules-ir/.gitkeep`.
|
||||
- **Commit message:**
|
||||
`phase: 6, status: plan-as-execute, persona: lead-developer, task: T-6.2`
|
||||
- **Commands:**
|
||||
|
||||
```bash
|
||||
# From the repo root. Five new empty-but-scaffolded dirs per ROADMAP §Phase 06.
|
||||
# These are populated in Phases 07–10; here they only need to exist + be tracked.
|
||||
for d in platform schemas adapters terraform modules-ir; do
|
||||
mkdir -p "$d"
|
||||
: > "$d/.gitkeep" # empty placeholder so git tracks the dir
|
||||
done
|
||||
git add platform/.gitkeep schemas/.gitkeep adapters/.gitkeep terraform/.gitkeep modules-ir/.gitkeep
|
||||
```
|
||||
|
||||
**Territory note (PERSONAS.md):** these dirs are owned in later phases
|
||||
by backend-engineer (`platform/confidence_signal.py`, `schemas/**`,
|
||||
`platform/outbox/**`), platform-engineer (`adapters/terraform/**`,
|
||||
`modules-ir/**`, `terraform/**`, `platform/registry/**`), and
|
||||
security-engineer (`platform/hitl_matrix_design.md`,
|
||||
`platform/audit_ledger_design.md`, `adapters/terraform/policy/**`). In
|
||||
Phase 06 they are *empty* — no territory conflict.
|
||||
|
||||
#### T-6.3 — Create the new top-level `scripts/` + write `scripts/verify_phase06.sh`
|
||||
|
||||
- **Owner:** lead-developer (territory: `scripts/verify_phase*.sh`).
|
||||
- **Files owned:** `scripts/.gitkeep` (or the verify script itself acts as
|
||||
the dir anchor), `scripts/verify_phase06.sh`.
|
||||
- **Commit message:**
|
||||
`phase: 6, status: plan-as-execute, persona: lead-developer, task: T-6.3`
|
||||
- **What `scripts/verify_phase06.sh` must assert** (the Phase 06 success
|
||||
criteria from ROADMAP, made executable):
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
# scripts/verify_phase06.sh — Phase 06 archive regression + layout check.
|
||||
# Lives at TOP-LEVEL scripts/ (v1.1 verify scripts), NOT demo/scripts/.
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
fail() { echo "FAIL: $*" >&2; exit 1; }
|
||||
ok() { echo "ok: $*"; }
|
||||
|
||||
# --- Check 1: demo/ contains the full v1.0 demo tree ---
|
||||
for d in demo/modules demo/scripts demo/evidence-ui demo/contracts \
|
||||
demo/contracts-repo demo/.gitea/workflows; do
|
||||
[ -d "$d" ] || fail "missing $d"
|
||||
done
|
||||
[ -f demo/ACDL_DEMO.md ] || fail "missing demo/ACDL_DEMO.md"
|
||||
[ -f demo/scripts/run_demo.sh ] || fail "missing demo/scripts/run_demo.sh"
|
||||
ok "demo/ contains the full v1.0 demo"
|
||||
|
||||
# --- Check 2: regression — the archived demo still runs from demo/ ---
|
||||
# run_demo.sh uses WORKDIR=/tmp/acdl_demo_run (absolute temp), so it
|
||||
# does not pollute the repo. --no-upload skips Gitea API calls.
|
||||
out=$(ACDL_GITEA_TOKEN= bash demo/scripts/run_demo.sh --no-upload 2>&1); rc=$?
|
||||
[ "$rc" -eq 0 ] || { echo "$out" >&2; fail "demo/scripts/run_demo.sh --no-upload exited $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
|
||||
[ -d "$d" ] || fail "missing new top-level dir $d"
|
||||
[ -f "$d/.gitkeep" ] || fail "missing $d/.gitkeep"
|
||||
done
|
||||
ok "new top-level dirs exist: 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
|
||||
[ -e "$stray" ] && fail "stray $stray left at repo root (should be under demo/)"
|
||||
done
|
||||
# .gitea/ at repo root is OK *only if* it's a new v1.1 workflow dir; in Phase 06
|
||||
# we moved the demo's .gitea/ to demo/.gitea/, so repo-root .gitea/ should NOT
|
||||
# exist yet (Phase 07+ may re-create it for the real pipeline).
|
||||
[ -e ".gitea" ] && fail "stray .gitea/ left at repo root (moved to demo/.gitea/)"
|
||||
ok "no stray v1.0 dirs at repo root"
|
||||
|
||||
# --- Check 5: README reflects the real platform ---
|
||||
grep -q "Agentic Cloud Delivery Platform" README.md || fail "README missing platform name"
|
||||
grep -q "demo/" README.md || fail "README does not reference the archived demo/"
|
||||
grep -qi "vision\|architecture" README.md || fail "README missing vision/architecture links"
|
||||
ok "README reflects the real platform (name + demo/ ref + vision/arch links)"
|
||||
|
||||
echo "Phase 06: ALL CHECKS PASS"
|
||||
```
|
||||
|
||||
**Note on `bash -n` / `py_compile` (typecheck gate):** the verify script
|
||||
itself is covered by `bash -n scripts/verify_phase06.sh`; the moved demo
|
||||
scripts are covered by `bash -n demo/scripts/*.sh` + `python3 -m py_compile
|
||||
demo/scripts/*.py` (the typecheck gate in the frontmatter). These run in
|
||||
Wave 3 before the full verify.
|
||||
|
||||
#### T-6.4 — Rewrite `README.md` + update `.gitignore`
|
||||
|
||||
- **Owner:** lead-developer (territory: `README.md`, `.gitignore`).
|
||||
- **Files owned:** `README.md`, `.gitignore`.
|
||||
- **Commit message:**
|
||||
`phase: 6, status: plan-as-execute, persona: lead-developer, task: T-6.4`
|
||||
- **`README.md` must contain:**
|
||||
- Project name: "ACDL — Agentic Cloud Delivery Platform".
|
||||
- One-line vision lift from `PROJECT.md` (consumers declare intent; the
|
||||
platform delivers safe production deployment through an agentic stack).
|
||||
- Links: `docs/vision.md` (the why), `docs/architecture.md` (the how),
|
||||
`.ciagent/PROJECT.md` (decisions), `.ciagent/ARCHITECTURE.md` (target
|
||||
architecture), `.ciagent/ROADMAP.md` (phase plan).
|
||||
- **New layout section** listing the top-level dirs and what each is for:
|
||||
- `platform/` — platform code (confidence signal, contract resolver,
|
||||
outbox, HITL/ledger designs) [populated Phase 07+].
|
||||
- `schemas/` — JSON Schemas (IR, PolicyCheckResult, contract) [Phase 07].
|
||||
- `adapters/` — substrate adapters (Terraform adapter in v1) [Phase 09].
|
||||
- `terraform/` — state backend + provider config [Phase 08+].
|
||||
- `modules-ir/` — IR-typed L1/L2 modules (`l1-s3`, `l2-static-asset`)
|
||||
[Phase 09–10].
|
||||
- `scripts/` — v1.1 verify scripts (`verify_phaseNN.sh`).
|
||||
- `demo/` — the archived v1.0 executive demo (tag `v1.1.0`); runs locally
|
||||
via `demo/scripts/run_demo.sh --no-upload`. Intent reference; not the
|
||||
platform.
|
||||
- `.ciagent/` — CIAgent metadata (plans, decisions, personas, roadmap).
|
||||
- `docs/` — upstream vision + architecture sources.
|
||||
- A "Status" line: v1.1 active — architecture finalization + v1 spike.
|
||||
v1.0 demo complete (tag `v1.1.0`), archived under `demo/`.
|
||||
- **No** v1.0 demo run instructions in the root README — point at
|
||||
`demo/ACDL_DEMO.md` for the demo deck and `demo/scripts/run_demo.sh`.
|
||||
|
||||
- **`.gitignore` update:**
|
||||
- Add `runner-data/` (the untracked demo runner artifact; moved to
|
||||
`demo/runner-data/` in T-6.1, but any future local runner registration
|
||||
should be ignored at the repo root too).
|
||||
- Keep existing entries (`__pycache__/`, `*.pyc`, `*.pyo`, `.env*`,
|
||||
`state.json`, `audit.json`, `*.tmp`, `.DS_Store`).
|
||||
- The existing `.gitignore` (read) is:
|
||||
```
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.pyo
|
||||
.env
|
||||
.env.*
|
||||
state.json
|
||||
audit.json
|
||||
*.tmp
|
||||
.DS_Store
|
||||
```
|
||||
Append `runner-data/` (and optionally `demo/runner-data/` for
|
||||
completeness).
|
||||
|
||||
---
|
||||
|
||||
### Wave 2 — frontend-engineer: confirm `demo/evidence-ui/` moved cleanly
|
||||
|
||||
The UI is frozen as a demo artifact (D-033: relative fetch URL). No code
|
||||
changes unless the move broke the fetch path — which static analysis says
|
||||
it cannot (the UI is a single static `index.html` with a relative URL to
|
||||
`audit.json` on the `acdl-evidence` raw URL). This wave is a confirmation,
|
||||
not a build.
|
||||
|
||||
#### T-6.5 — Confirm `demo/evidence-ui/index.html` integrity + fetch path
|
||||
|
||||
- **Owner:** frontend-engineer (territory: `evidence-ui/**`, now
|
||||
`demo/evidence-ui/**`).
|
||||
- **Files owned:** `demo/evidence-ui/index.html` (read-only confirmation;
|
||||
edit only if the fetch URL is broken, which it is not per D-033).
|
||||
- **Commit message (if no edit needed — confirmation only, may be a
|
||||
no-op commit or folded into Wave 3's verify):**
|
||||
`phase: 6, status: plan-as-execute, persona: frontend-engineer, task: T-6.5`
|
||||
- **Checks the frontend-engineer performs:**
|
||||
1. `demo/evidence-ui/index.html` exists and is byte-identical to the
|
||||
pre-move file (git history preserved via `git mv`).
|
||||
2. The fetch URL inside `index.html` is relative (per D-033) — e.g.
|
||||
`fetch('audit.json')` or a raw-URL reference to `acdl-evidence`.
|
||||
It must NOT reference a repo-root-relative path that broke when
|
||||
moved under `demo/`.
|
||||
3. If (and only if) `scripts/verify_phase06.sh` (run in Wave 3) reports
|
||||
the UI fetch path broken, the frontend-engineer patches
|
||||
`demo/evidence-ui/index.html`'s fetch URL to be relative. Per D-033
|
||||
and RESEARCH TARGET 10 finding #5, **no patch is expected** — this
|
||||
is a confirm-only task.
|
||||
- **No code changes expected.** If a patch is needed, it is a one-line
|
||||
fetch-URL fix and the commit message above applies.
|
||||
|
||||
---
|
||||
|
||||
### Wave 3 — lead-developer: run the full Phase 06 verification
|
||||
|
||||
The regression gate. Runs only after Wave 1 (moves done) and Wave 2
|
||||
(frontend confirmation done).
|
||||
|
||||
#### T-6.6 — Run `scripts/verify_phase06.sh` + typecheck gate
|
||||
|
||||
- **Owner:** lead-developer (territory: `scripts/verify_phase*.sh`).
|
||||
- **Files owned:** none (execution-only).
|
||||
- **Commit message (if any fixup is needed; otherwise this is a verify
|
||||
run, not a commit):**
|
||||
`phase: 6, status: plan-as-execute, persona: lead-developer, task: T-6.6`
|
||||
- **Commands:**
|
||||
|
||||
```bash
|
||||
# Typecheck gate (from frontmatter):
|
||||
bash -n demo/scripts/*.sh && echo "demo shell scripts: syntax ok"
|
||||
python3 -m py_compile demo/scripts/*.py && echo "demo python scripts: compile ok"
|
||||
bash -n scripts/verify_phase06.sh && echo "verify_phase06.sh: syntax ok"
|
||||
|
||||
# Test gate (the Phase 06 regression):
|
||||
bash scripts/verify_phase06.sh
|
||||
# Expected output: "Phase 06: ALL CHECKS PASS"
|
||||
# This runs demo/scripts/run_demo.sh --no-upload internally (Check 2).
|
||||
```
|
||||
|
||||
**On failure:** if `demo/scripts/run_demo.sh --no-upload` fails, the
|
||||
cause is an undetected absolute path in a demo script (R-5 residual
|
||||
0.10). Fix the offending path in `demo/scripts/*.sh` (make it
|
||||
`SCRIPT_DIR`/`REPO_ROOT`-relative) and re-run. If the UI fetch path is
|
||||
broken, Wave 2's frontend-engineer patches `demo/evidence-ui/index.html`.
|
||||
|
||||
**On pass:** Phase 06 is complete. The phase-completion commit +
|
||||
`v1.1.0`-style phase tag (or the v1.1 phase-tagging convention) is
|
||||
created by the execute workflow, not this plan.
|
||||
|
||||
---
|
||||
|
||||
## Wave ordering (dependency graph)
|
||||
|
||||
```
|
||||
Wave 1 (T-6.1, T-6.2, T-6.3, T-6.4) lead-developer
|
||||
│ moves + scaffold + verify script + README
|
||||
▼
|
||||
Wave 2 (T-6.5) frontend-engineer
|
||||
│ confirm demo/evidence-ui/ moved cleanly (no code change expected)
|
||||
▼
|
||||
Wave 3 (T-6.6) lead-developer
|
||||
run scripts/verify_phase06.sh (regression + layout + README checks)
|
||||
```
|
||||
|
||||
- **Wave 1 → Wave 2:** the UI must be moved before it can be confirmed.
|
||||
- **Wave 2 → Wave 3:** the frontend confirmation must precede the full
|
||||
verify (so any UI fetch-path patch is in place before
|
||||
`verify_phase06.sh` runs the demo end-to-end).
|
||||
- **Within Wave 1:** T-6.1 (moves) must precede T-6.2 (new dirs — they
|
||||
would collide if `scripts/` still held the v1.0 verify scripts when
|
||||
T-6.3 creates the new top-level `scripts/`). T-6.3 (verify script) can
|
||||
be authored in parallel with T-6.2 but cannot *run* until T-6.1 + T-6.2
|
||||
are committed. T-6.4 (README) is independent of T-6.1..T-6.3 in content
|
||||
but should land in the same wave so the repo is coherent after Wave 1.
|
||||
|
||||
**Strict sub-ordering within Wave 1:** T-6.1 → T-6.2 → T-6.3 (T-6.3
|
||||
creates the new top-level `scripts/` which must not exist during T-6.1's
|
||||
`git mv scripts demo/scripts`). T-6.4 (README + .gitignore) may be done
|
||||
in parallel with T-6.2/T-6.3.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- **v1.0 demo complete + tagged** — satisfied (tag `v1.1.0` present;
|
||||
ROADMAP §v1.0 "complete").
|
||||
- **No upstream v1.1 phase dep** — Phase 06 is the first v1.1 phase.
|
||||
- **RESEARCH.md TARGET 10** — the authoritative move list + the static
|
||||
analysis confirming no path fixups are needed (conf 0.90; R-5 residual
|
||||
is the only open risk, caught by the Wave 3 regression check).
|
||||
- **PERSONAS.md** — Phase 06 active roster: lead-developer + frontend-
|
||||
engineer (demo UI move only). backend/platform/security idle.
|
||||
|
||||
## Tasks summary
|
||||
|
||||
| Task | Wave | Owner | Territory | Commit message tag |
|
||||
|------|------|-------|-----------|--------------------|
|
||||
| T-6.1 | 1 | lead-developer | `demo/` (new), moved dirs | `task: T-6.1` |
|
||||
| T-6.2 | 1 | lead-developer | `platform/`, `schemas/`, `adapters/`, `terraform/`, `modules-ir/` (new empty) | `task: T-6.2` |
|
||||
| T-6.3 | 1 | lead-developer | top-level `scripts/verify_phase06.sh` (new) | `task: T-6.3` |
|
||||
| T-6.4 | 1 | lead-developer | `README.md`, `.gitignore` | `task: T-6.4` |
|
||||
| T-6.5 | 2 | frontend-engineer | `demo/evidence-ui/index.html` (confirm-only) | `task: T-6.5` |
|
||||
| T-6.6 | 3 | lead-developer | (execution: `scripts/verify_phase06.sh`) | `task: T-6.6` |
|
||||
|
||||
All commit messages follow the format:
|
||||
`phase: 6, status: plan-as-execute, persona: <name>, task: T-6.N`
|
||||
|
||||
## Risks (specific to Phase 06)
|
||||
|
||||
1. **R-5 (RESEARCH, residual 0.10): undetected absolute path in a demo
|
||||
script.** Mitigation: Wave 3 runs `demo/scripts/run_demo.sh --no-upload`
|
||||
and asserts exit 0. A failure is caught there and fixable in-phase by
|
||||
making the offending path `SCRIPT_DIR`/`REPO_ROOT`-relative. The
|
||||
typecheck gate (`bash -n demo/scripts/*.sh`) catches syntax issues
|
||||
but not path issues — only the runtime regression catches those.
|
||||
|
||||
2. **`contracts-repo/` is tracked and moves with `git mv`.** Verified:
|
||||
`git ls-files contracts-repo/` returns
|
||||
`.gitea/workflows/.gitkeep` + `.gitea/workflows/issue-to-contract.yml`.
|
||||
It is a demo artifact (the v1.0 `acdl-contracts` mirror used by
|
||||
`verify_phase04.sh`). Moving it to `demo/contracts-repo/` is correct;
|
||||
`demo/scripts/verify_phase04.sh` references it via the
|
||||
`ROOT`-relative path `contracts-repo/.gitea/workflows/...` which
|
||||
auto-resolves to `demo/contracts-repo/...` after the move (ROOT =
|
||||
parent of `demo/scripts/` = `demo/`).
|
||||
|
||||
3. **`runner-data/` is untracked.** It is moved with plain `mv` (not
|
||||
`git mv`) and gitignored. If a future runner registration recreates it
|
||||
at the repo root, `.gitignore` (updated in T-6.4) keeps it untracked.
|
||||
|
||||
4. **`ACDL_DEMO.md` was untracked** (verified: `git status` shows
|
||||
`?? ACDL_DEMO.md`). `git mv` on an untracked file will fail; the
|
||||
executor must `git add` it first (or use `mv` + `git add demo/ACDL_DEMO.md`).
|
||||
The command list in T-6.1 uses `git mv ACDL_DEMO.md demo/ACDL_DEMO.md`
|
||||
— if git rejects it as untracked, fall back to:
|
||||
`mv ACDL_DEMO.md demo/ACDL_DEMO.md && git add demo/ACDL_DEMO.md`.
|
||||
|
||||
5. **`verify_phase05.sh` has an anti-stray check** (lines 159-160:
|
||||
`if [ -d "$ROOT/contracts" ]; then fail "contracts/ directory left in
|
||||
repo root"`). After the move, `ROOT` for `demo/scripts/verify_phase05.sh`
|
||||
is `demo/`, and `demo/contracts/` *does* exist — so this check would
|
||||
fail if the v1.0 verify script is re-run from `demo/`. This is
|
||||
expected: the v1.0 verify scripts are *archived demo artifacts*, not
|
||||
re-run after Phase 06. The v1.1 verify script
|
||||
(`scripts/verify_phase06.sh`) supersedes them. No action needed beyond
|
||||
documenting that v1.0 verify scripts are not re-run post-archive.
|
||||
Re-evaluate go-gitea/gitea#36988 (OIDC); audit the v1.1 spike for NFR gaps
|
||||
+ simplification opportunities; rewrite README.md to reflect v1.1 complete
|
||||
+ the actual platform flow + v1.2 objective.
|
||||
|
||||
## Tasks (single wave — docs territory)
|
||||
|
||||
### T-11.1 — RESEARCH.md v1.2 addendum (REQ-29)
|
||||
- TARGET 9: #36988 re-check → D-047 (extend D-039 waiver).
|
||||
- TARGET 10: NFR audit of spike (IAM, idempotency, error handling, P1-1, stale paths).
|
||||
- TARGET 11: Simplification opportunities (script consolidation D-048).
|
||||
- TARGET 12: README rewrite plan.
|
||||
- TARGET 13: ECS L1 catalog scoping (D-049) for Phase 13.
|
||||
- Decisions surfaced: D-047, D-048, D-049.
|
||||
- Territory: `.ciagent/RESEARCH.md`
|
||||
|
||||
### T-11.2 — README.md rewrite (REQ-29)
|
||||
- Status section: v1.2 active, v1.1 complete (tag v1.2.0), v1.0 archived.
|
||||
- "How the platform works": the spike flow diagram + the IR commitments claim.
|
||||
- "What's different in v1.2": 6 L1s, l2-microservice, terraform apply, consumer repo, run_platform.sh, NFR hardening.
|
||||
- "How to run": prerequisites, bootstrap, rotate, run_spike_e2e.sh, demo.
|
||||
- Repo layout table (refreshed Status column).
|
||||
- Environments table (dev/qa/prod/dr + status).
|
||||
- Credentials section (D-034 closed, D-039/D-047 waiver, #36988 link).
|
||||
- Territory: `README.md`
|
||||
|
||||
## Verification
|
||||
|
||||
- `grep -c "v1.2" README.md` ≥ 5 (v1.2 referenced throughout).
|
||||
- `grep "v1.1 (active)" README.md` returns nothing (no stale framing).
|
||||
- `.ciagent/RESEARCH.md` has a "## v1.2 Research Addendum" section.
|
||||
- D-047/D-048/D-049 present in the addendum's decisions table.
|
||||
- `scripts/verify_phase11.sh` (authored in the verify step).
|
||||
|
||||
## Ship
|
||||
|
||||
Merge `phase/11-v1.2-research-and-readme` → `main` (--no-ff). Tag `v1.2.1`.
|
||||
+82
-7
@@ -50,7 +50,7 @@ traceable to a human attestation and an immutable evidence stream.
|
||||
boundary. The platform validates, enriches with operational standards,
|
||||
and reconciles the target state.
|
||||
|
||||
## Objective for Milestone v1.1
|
||||
## Objective for Milestone v1.1 (prior — complete, tag `v1.2.0`)
|
||||
|
||||
Finalize the architecture to v1.0 (resolve all 11 open design decisions in
|
||||
`docs/architecture.md` §13) and prove the locked commitments with one
|
||||
@@ -67,7 +67,11 @@ end-to-end v1 implementation spike:
|
||||
The spike validates the architecture's claim that the IR-shaped commitments
|
||||
do not require a polyglot mess (`docs/architecture.md` §14, step 2).
|
||||
|
||||
## Milestone v1.1 Phases
|
||||
**Status: COMPLETE — all 5 phases shipped (v1.1.1..v1.1.5) + verified; review
|
||||
READY TO SHIP (0 P0); audit CLEAN; milestone tag `v1.2.0`; Gitea release
|
||||
id 202 published. D-034 closed (root key deactivated by user).**
|
||||
|
||||
## Milestone v1.1 Phases (prior — complete)
|
||||
|
||||
| Phase | Name | Goal |
|
||||
|-------|------|------|
|
||||
@@ -78,7 +82,56 @@ do not require a polyglot mess (`docs/architecture.md` §14, step 2).
|
||||
| 10 | v1-spike-l2-and-contract-e2e | One L2 thin-composition (`l2-static-asset`) referencing `l1-s3`; contract schema + contract→IR resolution; one end-to-end contract submission → `terraform plan` → Checkov → confidence signal → evidence event to outbox. Verify the IR commitments hold. |
|
||||
|
||||
Milestone COMPLETE gate: review → ship `v1.2.0` (feature milestone, next
|
||||
minor per ship.md) → audit.
|
||||
minor per ship.md) → audit. **DONE.**
|
||||
|
||||
## Objective for Milestone v1.2 (active)
|
||||
|
||||
Platform hardening + first real consumer deployment. The v1.1 spike proved
|
||||
the IR commitments hold on a single dev-only `terraform plan` for one S3
|
||||
bucket. v1.2 takes the spike to a real, simpler, better-documented platform
|
||||
that actually delivers a microservice to AWS ECS Fargate end-to-end.
|
||||
|
||||
Five scope axes (user-directed, 2026-07-21):
|
||||
|
||||
1. **Re-evaluate the current state.** Confirm go-gitea/gitea#36988 (OIDC for
|
||||
Gitea Actions) is still unmerged (re-checked 2026-07-21: **open**, last
|
||||
updated 2026-05-27). Extend the D-039 per-run-rotated-key waiver for
|
||||
v1.2; real OIDC is deferred to v1.3+ (D-047).
|
||||
2. **NFR improvements on the existing spike.** Least-privilege IAM audit,
|
||||
idempotent bootstrap, proper exit codes / error handling, rotation
|
||||
hygiene, P1-1 / P1-B redaction carried forward from the v1.1 audit.
|
||||
3. **Streamline / simplify the current setup.** Consolidate the
|
||||
`run_spike_*.sh` scripts into one `scripts/run_platform.sh`; remove
|
||||
dead code and stale paths; one command runs the whole pipeline.
|
||||
4. **README.md fully up to date on how the platform works.** The current
|
||||
README still says "v1.1 (active)" — it must reflect v1.1 complete, the
|
||||
actual spike flow, how to run it, the real repo layout, and the v1.2
|
||||
objective.
|
||||
5. **Bootstrap a consumer repo with a basic microservice deployed to ECS
|
||||
end-to-end.** New Gitea repo `acdl-consumer-microservice` (org
|
||||
`continuous-intelligence`) holding a tiny HTTP container + Dockerfile;
|
||||
new IR-typed L1s (`l1-vpc`, `l1-ecs-cluster`, `l1-ecs-service`,
|
||||
`l1-iam-role`, `l1-alb`, `l1-ecr`); new `l2-microservice`
|
||||
thin-composition; one contract submission → `terraform apply` (dev,
|
||||
autonomous) → a live ECS Fargate service serving HTTP 200 → evidence
|
||||
event to the DynamoDB outbox → acdl-evidence timeline.
|
||||
|
||||
The milestone proves the platform delivers real value (a running
|
||||
microservice), not just a plan.
|
||||
|
||||
## Milestone v1.2 Phases
|
||||
|
||||
| Phase | Name | Goal |
|
||||
|-------|------|------|
|
||||
| 11 | v1.2-research-and-readme | Re-eval #36988 (confirm open → extend D-039 as D-047). Audit the v1.1 spike for NFR gaps (least-privilege, idempotency, error handling, rotation hygiene) + simplification opportunities. **Rewrite README.md** to reflect v1.1 complete + how the platform actually works (spike flow, how to run, repo layout, v1.2 objective). Output: RESEARCH.md v1.2 addendum; updated README. |
|
||||
| 12 | nfr-harden-and-simplify | Apply Phase 11 findings: tighten `spike_runner_policy.json` (least-privilege audit); make `terraform/bootstrap/create_*.py` idempotent; consolidate `run_spike_*.sh` → one `scripts/run_platform.sh`; proper exit codes / error handling; redact P1-1 AWS key IDs in `VERIFY.md`; fix any remaining stale `platform/` paths. Spike still runs e2e after the refactor. |
|
||||
| 13 | l1-catalog-for-ecs | Author IR-typed L1s for an ECS Fargate microservice: `l1-vpc`, `l1-ecs-cluster`, `l1-ecs-service`, `l1-iam-role` (task + exec role), `l1-alb`, `l1-ecr`. Register all in `modules-ir/registry.json`. Expand the Terraform adapter `TYPE_MAP`. Each L1 produces a valid `terraform plan` fragment. |
|
||||
| 14 | l2-microservice-and-contract-schema | Author `l2-microservice` thin-composition (references the ECS L1s, depth ≤ 5). Extend `schemas/contract.schema.json` for microservice inputs (image, port, env, healthcheck). Verify contract→IR resolution yields a complete target stack. |
|
||||
| 15 | consumer-repo-and-terraform-apply | Create consumer repo `acdl-consumer-microservice` (Gitea org) with a basic microservice (tiny HTTP container + Dockerfile + ECR push). Lift the platform from `plan` → **`apply`** (dev, autonomous per §10). Submit `contracts/microservice.yaml` → pipeline → IR → plan → apply → a real ECS Fargate service running. |
|
||||
| 16 | v1.2-capstone-e2e | End-to-end verification: consumer commit → pipeline → ECS service live serving HTTP 200 → evidence event to the DynamoDB outbox → acdl-evidence timeline renders it. Verify NFR improvements hold, the setup is simpler (one `run_platform.sh`), and the README is accurate. |
|
||||
|
||||
Milestone COMPLETE gate: review → ship `v1.3.0` (feature milestone, next
|
||||
minor per ship.md — v1.1 shipped `v1.2.0`) → audit.
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -88,9 +141,9 @@ Status: complete. Tag `v1.1.0`. All REQ-01..15 satisfied by the stub-driven
|
||||
executive demo. See `REQUIREMENTS.md` §v1 and the prior decisions table
|
||||
appendix below. The demo is **archived** to `demo/` in Phase 06.
|
||||
|
||||
### v1.1 (Active milestone — architecture finalization + v1 spike)
|
||||
### v1.1 (Prior milestone — architecture finalization + v1 spike, complete)
|
||||
|
||||
New requirements REQ-16..REQ-2x — see `REQUIREMENTS.md` §v1.1. Summary:
|
||||
New requirements REQ-16..REQ-28 — see `REQUIREMENTS.md` §v1.1. Summary:
|
||||
|
||||
- **REQ-16:** Architecture finalized to v1.0 (11 open decisions resolved).
|
||||
- **REQ-17:** Target Stack IR defined as JSON Schema; substrate-agnostic.
|
||||
@@ -115,6 +168,27 @@ New requirements REQ-16..REQ-2x — see `REQUIREMENTS.md` §v1.1. Summary:
|
||||
- **REQ-28:** Spike verification proves the IR-shaped commitments hold (no
|
||||
polyglot mess; the adapter is the only substrate-specific code).
|
||||
|
||||
### v1.2 (Active milestone — platform hardening + first real consumer deployment)
|
||||
|
||||
New requirements REQ-29..REQ-35 — see `REQUIREMENTS.md` §v1.2. Summary:
|
||||
|
||||
- **REQ-29:** README.md fully documents the v1.1-complete platform: spike
|
||||
flow, how to run, repo layout, v1.2 objective.
|
||||
- **REQ-30:** NFR hardening — least-privilege IAM audit, idempotent
|
||||
bootstrap, consolidated `run_platform.sh`, error handling, P1-1/P1-B
|
||||
redaction.
|
||||
- **REQ-31:** L1 catalog expanded for ECS — 6 new IR-typed L1s
|
||||
(`l1-vpc`, `l1-ecs-cluster`, `l1-ecs-service`, `l1-iam-role`, `l1-alb`,
|
||||
`l1-ecr`) registered and adapter-compiled.
|
||||
- **REQ-32:** `l2-microservice` thin-composition + contract schema extended
|
||||
for microservice inputs (image, port, env, healthcheck).
|
||||
- **REQ-33:** `terraform apply` (dev, autonomous) — real provisioning, not
|
||||
just `plan`.
|
||||
- **REQ-34:** Consumer repo `acdl-consumer-microservice` with a basic
|
||||
microservice (ECR image, Dockerfile, contract).
|
||||
- **REQ-35:** End-to-end verification — consumer commit → live ECS service
|
||||
(HTTP 200) → evidence event → timeline.
|
||||
|
||||
## Constraints
|
||||
|
||||
- **Forge:** Gitea at `https://git.cloudinit.dev`, org `continuous-intelligence`.
|
||||
@@ -157,7 +231,7 @@ decisions:
|
||||
|
||||
| ID | Decision | Rationale | Outcome |
|
||||
|----|----------|-----------|---------|
|
||||
| D-034 | Temporary long-lived AWS key (waiver) used once in Phase 08 to bootstrap OIDC trust; rotated immediately after | §12.5 forbids long-lived creds; OIDC needs one bootstrapping `aws iam` call before the runner can assume a role | Spike achieves real `terraform plan` against AWS without violating the locked target after bootstrap |
|
||||
| D-034 | Temporary long-lived AWS key (waiver) used once in Phase 08 to bootstrap the state backend + IAM user; rotated/deactivated immediately after | §12.5 forbids long-lived creds; the bootstrap needed one `aws iam` call before the spike user + rotated key could take over | Spike achieves real `terraform plan` against AWS without violating the locked target after bootstrap. **CLOSED 2026-07-21: root key `AKIAYOZHMKZ772SINHFX` deactivated by the user in the AWS IAM console (verified — `InvalidClientTokenId`); the spike uses the rotated `acdl-spike-runner` key per D-039.** |
|
||||
| D-035 | Milestone version = `v1.1` (feature), ship tag `v1.2.0` | Real platform is a breaking reframing of the demo, but treated as the next incremental milestone per user choice; ship.md: feature milestone → next minor | Tag `v1.2.0` on milestone COMPLETE |
|
||||
| D-036 | Spike picks `l1-s3` + `l2-static-asset` | Simplest real AWS resource (no IAM/network deps); smallest real `terraform plan`; proves the IR + adapter end-to-end | Spike scope fixed |
|
||||
| D-037 | Demo archived to `demo/` (not deleted) | Preserves the working v1.0 demo as intent reference; new platform layout under `platform/`, `schemas/`, `adapters/`, `terraform/`, `modules-ir/` | No churn on demo code; clean separation |
|
||||
@@ -170,6 +244,7 @@ decisions:
|
||||
| D-044 | DynamoDB outbox = `PAY_PER_REQUEST`; PK `contractId`, SK `eventType#eventTs`, TTL `expire_at` = now + 365d. No separate async worker/DLQ in the spike (RTO = workflow re-run); v1.2 outbox worker + DLQ is a Phase 07 design artifact. | On-demand is zero-cost-at-idle for the spike's single dev submission. | Spike outbox is minimal; v1.2 worker design authored in Phase 07 |
|
||||
| D-045 | Runner tooling: `runs-on: ubuntu-latest`; install `terraform` via HashiCorp apt repo (pin `1.9.*`), `checkov` via pip (pin `>=3.2,<4`, `--break-system-packages`). Neither is pre-installed on the default runner image. | RESEARCH TARGET 2; pinning avoids mid-spike version drift. | Phase 09/10 workflows have a concrete setup step |
|
||||
| D-046 | `act_runner` → `gitea-runner` rename: Phase 07 updates docs to use the current name `gitea-runner` (renamed 2026-04 in gitea/runner#850). | RESEARCH TARGET 1 + R-4: naming drift between v1.0 docs and the current runner. | Docs reflect the current binary name |
|
||||
| D-047 | v1.2 carries forward the D-039 per-run-rotated-key waiver. Real OIDC federation remains deferred to v1.3+, blocked on go-gitea/gitea#36988 (re-checked 2026-07-21: still **open**, last updated 2026-05-27, not merged). | §12.5 forbids long-lived creds; the Gitea Actions OIDC provider is still not merged. The waiver continues to satisfy §12.5's *intent* (no *persistently* long-lived key) for v1.2: `scripts/rotate_spike_key.sh` rotates the key, and Phase 12 tightens the IAM scoping + rotation hygiene. | v1.2 achieves `terraform apply` against AWS without a persistently long-lived key; real OIDC is a v1.3+ deliverable. |
|
||||
|
||||
### Open-decision resolutions (Phase 07 deliverable — recorded here for traceability)
|
||||
|
||||
@@ -213,7 +288,7 @@ sign-off (autonomy = full; all within locked constraints).
|
||||
| Spike `terraform` command | `plan` only | `apply` is out of scope (Out of Scope table); HITL-gated in v1.2 |
|
||||
| Checkov ruleset (spike) | the 4 L2 checks (secrets-in-plaintext, public ingress, IAM wildcard, KMS key reference) + tag/naming | §3 + §12.4; Kyverno/OPA deferred |
|
||||
| v1.0 tags preserved | `v1.0.1`..`v1.0.5`, `v1.1.0` retained | Immutability; demo archive does not rewrite history |
|
||||
| Next ship tag | `v1.2.0` | Feature milestone → next minor per ship.md (D-035) |
|
||||
| Next ship tag | `v1.3.0` | Feature milestone → next minor per ship.md (v1.1 shipped `v1.2.0`; v1.2 ships `v1.3.0`) |
|
||||
|
||||
### Items deferred to RESEARCH (not clarifications)
|
||||
|
||||
|
||||
+61
-15
@@ -35,7 +35,7 @@
|
||||
|
||||
(None — v1 covers the complete demo.)
|
||||
|
||||
## v1.1 (Active milestone — architecture finalization + v1 spike)
|
||||
## v1.1 (Prior milestone — architecture finalization + v1 spike, complete)
|
||||
|
||||
### Category: Architecture Finalization
|
||||
- **REQ-16:** Architecture reaches v1.0 — all 11 open decisions in `docs/architecture.md` §13 are resolved and recorded in `PROJECT.md` (W1.A, W1.B, W2.A, W3.D, W3.E, BA.A–F, OpenTofu timing).
|
||||
@@ -70,6 +70,40 @@
|
||||
| Prod/dr environments | v1.2. |
|
||||
| Terraform `apply` (real provisioning) | Spike runs `plan` only; `apply` is gated by HITL in v1.2. |
|
||||
|
||||
## v1.2 (Active milestone — platform hardening + first real consumer deployment)
|
||||
|
||||
### Category: Documentation & Simplification
|
||||
- **REQ-29:** `README.md` is fully rewritten to reflect the v1.1-complete platform: the actual spike flow (contract → IR → `terraform plan` → Checkov → confidence signal → outbox), how to run it (`scripts/run_platform.sh`), the real repo layout (`acdl_platform/`, `schemas/`, `adapters/`, `terraform/`, `modules-ir/`, `contracts/`, `demo/`), and the v1.2 objective. No stale "v1.1 (active)" framing.
|
||||
- **REQ-30:** NFR hardening of the v1.1 spike: (a) `terraform/bootstrap/spike_runner_policy.json` audited to least-privilege (S3 + DynamoDB + ECS + ECR + ELB + IAM plan-only, no wildcards beyond the documented exceptions); (b) `create_state_backend.py` and `create_iam_user.py` are idempotent (re-running exits 0 without duplicating resources); (c) `run_spike_plan.sh` + `run_spike_e2e.sh` consolidated into a single `scripts/run_platform.sh` with proper exit codes and error handling; (d) P1-1 carried forward from the v1.1 audit — the two AWS access key IDs in `.ciagent/VERIFY.md` Phase 09 narrative are redacted to placeholders; (e) any remaining stale `platform/` paths in `.ciagent/` are corrected to `acdl_platform/`.
|
||||
|
||||
### Category: L1 Catalog Expansion (ECS Fargate)
|
||||
- **REQ-31:** Six new IR-typed L1 modules exist under `modules-ir/l1/` and are registered in `modules-ir/registry.json`: `l1-vpc` (VPC + subnets + route tables), `l1-ecs-cluster` (ECS Fargate cluster), `l1-ecs-service` (ECS service + task definition), `l1-iam-role` (task execution + task role), `l1-alb` (application load balancer + listener + target group), `l1-ecr` (ECR repository). Each has an `interface.json` valid against `schemas/ir.schema.json` and produces a valid `terraform plan` fragment via the Terraform adapter. The adapter `TYPE_MAP` is expanded to cover all six IR resource types.
|
||||
|
||||
### Category: L2 Composition & Contract Schema
|
||||
- **REQ-32:** `l2-microservice` thin-composition exists under `modules-ir/l2/l2-microservice/` referencing the six ECS L1s (depth ≤ 5, within max-depth-5). `schemas/contract.schema.json` is extended with microservice inputs (`image: string`, `port: integer`, `env: map`, `healthcheck: object`) and validates a `contracts/microservice.yaml` submission. Contract→IR resolution (`acdl_platform/contract_resolver.py`) yields a complete target stack for `l2-microservice`.
|
||||
|
||||
### Category: Real Provisioning
|
||||
- **REQ-33:** The platform runs `terraform apply` (not just `plan`) for the `dev` environment, autonomous per §10 (confidence ≥ 0.50, no HITL). The apply creates real AWS resources (VPC, ECS cluster, ECR repo, ALB, ECS service) and the result is captured in the evidence stream. `apply` for qa/prod/dr remains HITL-gated and out of scope for v1.2.
|
||||
|
||||
### Category: Consumer Repo
|
||||
- **REQ-34:** A new Gitea repo `acdl-consumer-microservice` exists under the `continuous-intelligence` org, containing: a basic HTTP microservice (e.g., a tiny Python/Go server returning 200), a `Dockerfile`, an ECR push step, and a `contracts/microservice.yaml` submission for `l2-microservice` (dev environment).
|
||||
|
||||
### Category: End-to-End Verification
|
||||
- **REQ-35:** One end-to-end flow: consumer commit to `acdl-consumer-microservice` → pipeline triggered → contract→IR resolution → `terraform plan` → `terraform apply` (dev) → a live ECS Fargate service serving HTTP 200 on its ALB → evidence event written to the DynamoDB outbox → the event renders on the `acdl-evidence` timeline. `scripts/verify_phase16.sh` proves the full flow green.
|
||||
|
||||
## Out of Scope (v1.2)
|
||||
|
||||
| Feature | Reason |
|
||||
|---------|--------|
|
||||
| Real OIDC federation | go-gitea/gitea#36988 still open (re-checked 2026-07-21). v1.2 extends D-039 waiver (D-047); real OIDC is v1.3+. |
|
||||
| Full HITL matrix wiring (qa/prod/dr) | v1.2 is dev-only autonomous `apply`; HITL wiring is v1.3. |
|
||||
| Kyverno + OPA policy engines | v1.2 keeps Checkov only; Kyverno/OPA are v1.3. |
|
||||
| MCP skill catalog + real L3B agent | v1.2 keeps the L3B stub; the 5-skill catalog is v1.3. |
|
||||
| Audit ledger build-out (S3 Object Lock + JWS + async worker + DLQ + daily checkpoints) | v1.2 keeps the v1.1 outbox; the regulatory ledger is v1.3. |
|
||||
| Multi-region state / outbox | Single-region in v1 (§9, §12.3); multi-region is v1.3+. |
|
||||
| Prod/dr environments | v1.2 is dev-only; prod/dr are v1.3. |
|
||||
| GitOps reconciler (ArgoCD/Flux) | v1.3+. |
|
||||
|
||||
## Clarifications (Phase 01, v1.0 — retained for history)
|
||||
|
||||
| REQ | Original criterion | Clarified criterion (effective) | Decision |
|
||||
@@ -110,20 +144,32 @@
|
||||
| REQ-14 | 5 | complete (v1.0.5) |
|
||||
| REQ-15 | 5 | complete (v1.0.5) |
|
||||
|
||||
### v1.1 (active — architecture finalization + v1 spike)
|
||||
### v1.1 (prior — architecture finalization + v1 spike, complete)
|
||||
|
||||
| Requirement | Phase | Status |
|
||||
|-------------|-------|--------|
|
||||
| REQ-16 | 07 | pending |
|
||||
| REQ-17 | 07 | pending |
|
||||
| REQ-18 | 07 | pending |
|
||||
| REQ-19 | 07 | pending |
|
||||
| REQ-20 | 07 | pending |
|
||||
| REQ-21 | 07 | pending |
|
||||
| REQ-22 | 07 | pending |
|
||||
| REQ-23 | 08 | pending |
|
||||
| REQ-24 | 09 | pending |
|
||||
| REQ-25 | 10 | pending |
|
||||
| REQ-26 | 09 | pending |
|
||||
| REQ-27 | 10 | pending |
|
||||
| REQ-28 | 10 | pending |
|
||||
| REQ-16 | 07 | complete (v1.1.2) |
|
||||
| REQ-17 | 07 | complete (v1.1.2) |
|
||||
| REQ-18 | 07 | complete (v1.1.2) |
|
||||
| REQ-19 | 07 | complete (v1.1.2) |
|
||||
| REQ-20 | 07 | complete (v1.1.2) |
|
||||
| REQ-21 | 07 | complete (v1.1.2) |
|
||||
| REQ-22 | 07 | complete (v1.1.2) |
|
||||
| REQ-23 | 08 | complete (v1.1.3) |
|
||||
| REQ-24 | 09 | complete (v1.1.4) |
|
||||
| REQ-25 | 10 | complete (v1.1.5) |
|
||||
| REQ-26 | 09 | complete (v1.1.4) |
|
||||
| REQ-27 | 10 | complete (v1.1.5) |
|
||||
| REQ-28 | 10 | complete (v1.1.5) |
|
||||
|
||||
### v1.2 (active — platform hardening + first real consumer deployment)
|
||||
|
||||
| Requirement | Phase | Status |
|
||||
|-------------|-------|--------|
|
||||
| REQ-29 | 11 | planned |
|
||||
| REQ-30 | 12 | planned |
|
||||
| REQ-31 | 13 | planned |
|
||||
| REQ-32 | 14 | planned |
|
||||
| REQ-33 | 15 | planned |
|
||||
| REQ-34 | 15 | planned |
|
||||
| REQ-35 | 16 | planned |
|
||||
@@ -1327,4 +1327,138 @@ the demo is local-only post-archive), but this is moot for the archive.
|
||||
|
||||
---
|
||||
|
||||
## v1.2 Research Addendum (Phase 11, 2026-07-21)
|
||||
|
||||
> Phase: research (Phase 11). Milestone: v1.2. Status: active.
|
||||
> Researcher: ci-researcher (inline, docs phase). Autonomy: full.
|
||||
> Sources: GitHub API (go-gitea/gitea#36988), ACDL codebase audit
|
||||
> (`terraform/bootstrap/`, `scripts/`, `adapters/terraform/`,
|
||||
> `modules-ir/registry.json`, `.ciagent/VERIFY.md`, `.ciagent/PERSONAS.md`).
|
||||
> Scope: re-eval OIDC blocker, NFR audit of the v1.1 spike, simplification
|
||||
> opportunities, README rewrite plan, ECS L1 catalog scoping.
|
||||
|
||||
### TARGET 9 — go-gitea/gitea#36988 re-check (v1.2)
|
||||
|
||||
**Verdict (conf 0.95): still open, not merged.**
|
||||
|
||||
Re-checked 2026-07-21 via `api.github.com/repos/go-gitea/gitea/pulls/36988`:
|
||||
- `state`: open
|
||||
- `merged`: false
|
||||
- `merged_at`: null
|
||||
- `updated_at`: 2026-05-27T16:26:24Z
|
||||
- `title`: "Add Actions OIDC provider with workflow permission gating"
|
||||
|
||||
No movement since the v1.1 research (2026-07-21 v1.1 research also found it
|
||||
open). Real OIDC federation remains impossible for Gitea Actions. **D-047
|
||||
adopts**: extend the D-039 per-run-rotated-key waiver for v1.2; real OIDC is
|
||||
deferred to v1.3+. The waiver continues to satisfy §12.5's *intent*: no
|
||||
*persistently* long-lived key (`scripts/rotate_spike_key.sh` rotates after
|
||||
each run; Phase 12 tightens IAM scoping + rotation hygiene).
|
||||
|
||||
### TARGET 10 — NFR audit of the v1.1 spike
|
||||
|
||||
Audited the v1.1 spike's operational code for NFR gaps.
|
||||
|
||||
**`terraform/bootstrap/spike_runner_policy.json`** — least-privilege PASS
|
||||
already. Explicit Allow list (S3 state bucket R/W, DynamoDB outbox R/W,
|
||||
`sts:GetCallerIdentity`) + `DenyEverythingElse` on `*` with `NotResource`.
|
||||
No wildcards in the Allow statements. **v1.2 gap**: the policy only covers
|
||||
S3 + DynamoDB + STS — Phase 15's `terraform apply` to ECS needs ECS + ECR +
|
||||
ELB + IAM (plan + apply) permissions added. Phase 12 scopes the policy
|
||||
expansion; Phase 15 applies it.
|
||||
|
||||
**`terraform/bootstrap/create_state_backend.py`** — idempotent PASS already.
|
||||
`head_bucket` → skip-create if exists; `describe_table` → skip-create if
|
||||
exists; `put_bucket_versioning` is idempotent. **No v1.2 change needed.**
|
||||
|
||||
**`terraform/bootstrap/create_iam_user.py`** — idempotent PASS already.
|
||||
`get_user` → skip-create if exists; `put_user_policy` overwrites (idempotent);
|
||||
`list_access_keys` → skip-create if an active key exists. **No v1.2 change
|
||||
needed.**
|
||||
|
||||
**`scripts/run_spike_plan.sh` + `scripts/run_spike_e2e.sh`** — two scripts,
|
||||
overlapping setup (env loading, `cd terraform/spike`, `terraform init`).
|
||||
`run_spike_e2e.sh` is the superset (full pipeline); `run_spike_plan.sh` is
|
||||
the plan-only subset. **v1.2 simplification (Phase 12)**: consolidate into
|
||||
one `scripts/run_platform.sh` with a `--plan-only` flag (default: full e2e).
|
||||
Removes ~30 lines of duplication.
|
||||
|
||||
**`scripts/rotate_spike_key.sh`** — idempotent PASS (always ends with exactly
|
||||
1 active key). Uses the bootstrap root key to rotate; documented that D-034
|
||||
closure (root key deactivation) is a manual user step. **No v1.2 change
|
||||
needed** (the root key is now deactivated per D-034 closure; rotation uses
|
||||
the spike key itself or a separate rotation credential — flagged as a v1.2
|
||||
operational note in Phase 12).
|
||||
|
||||
**Error handling**: `run_spike_e2e.sh` uses `set -u` + a `fail()` helper —
|
||||
good. `run_spike_plan.sh` uses `set -u` + inline exits — adequate. The
|
||||
consolidated `run_platform.sh` should use `set -euo pipefail` + `fail()`
|
||||
for uniform strictness.
|
||||
|
||||
**P1-1 redaction target**: `.ciagent/VERIFY.md` lines 93–96, 170 reference
|
||||
two AWS access key IDs (`AKIAYOZHMKZ7RK26N66W` rotated spike key,
|
||||
`AKIAYOZHMKZ772SINHFX` deactivated root key). Public identifiers, not
|
||||
secret pairs, in the audit narrative not executable code. **Phase 12
|
||||
redacts** them to `AKIA…SPIKE` / `AKIA…ROOT-DEACTIVATED`.
|
||||
|
||||
**P1-B stale paths**: `.ciagent/PERSONAS.md` line 47 still has
|
||||
`platform/registry/**` (the rest were fixed at `ab69d10`). **Phase 12
|
||||
fixes** line 47 to `acdl_platform/registry/**` (or removes it — there is no
|
||||
`acdl_platform/registry/` dir; the registry is `modules-ir/registry.json`).
|
||||
|
||||
### TARGET 11 — Simplification opportunities
|
||||
|
||||
1. **Script consolidation** (above): `run_spike_*.sh` → `run_platform.sh`.
|
||||
2. **`terraform/spike/.terraform/` artifacts**: gitignored already
|
||||
(`.gitignore` covers `.terraform/`, `.terraform.lock.hcl`, `tfplan`,
|
||||
`*.tfstate*`). No change.
|
||||
3. **`acdl_platform/__pycache__/`**: gitignored already. No change.
|
||||
4. **Dead code**: none found — the spike is tight. The `run_spike_plan.sh`
|
||||
script is the only redundancy (subsumed by `run_platform.sh --plan-only`).
|
||||
5. **`demo/` archive**: correctly separated; no v1.2 touch.
|
||||
|
||||
### TARGET 12 — README rewrite plan
|
||||
|
||||
Current `README.md` (51 lines) is stale: "v1.1 (active)" framing, no
|
||||
"how to run the platform" section, no v1.2 objective. **Phase 11 rewrites
|
||||
it** to reflect:
|
||||
- v1.1 complete (tag `v1.2.0`); v1.0 demo archived under `demo/`.
|
||||
- The actual spike flow: contract → IR → `terraform plan` → Checkov →
|
||||
confidence signal → outbox.
|
||||
- How to run: `scripts/run_platform.sh` (after Phase 12; for now
|
||||
`scripts/run_spike_e2e.sh`).
|
||||
- Real repo layout table (the existing one is accurate; refresh the
|
||||
"Populated" column).
|
||||
- v1.2 objective (platform hardening + ECS microservice).
|
||||
|
||||
### TARGET 13 — ECS L1 catalog scoping (for Phase 13)
|
||||
|
||||
Six L1s needed for an ECS Fargate microservice. Each maps to one or more
|
||||
AWS Terraform resources; the adapter `TYPE_MAP` (currently
|
||||
`{"aws:s3:bucket": "aws_s3_bucket"}`) needs expansion:
|
||||
|
||||
| L1 | IR type(s) | Terraform resource(s) | Key inputs |
|
||||
|----|-----------|----------------------|-----------|
|
||||
| `l1-vpc` | `aws:ec2:vpc`, `aws:ec2:subnet`, `aws:ec2:routetable` | `aws_vpc`, `aws_subnet`, `aws_route_table` + associations | cidr, azs |
|
||||
| `l1-ecs-cluster` | `aws:ecs:cluster` | `aws_ecs_cluster` | name |
|
||||
| `l1-ecs-service` | `aws:ecs:service`, `aws:ecs:task_definition` | `aws_ecs_service`, `aws_ecs_task_definition` | image, port, cpu, memory, env |
|
||||
| `l1-iam-role` | `aws:iam:role`, `aws:iam:rolepolicyattachment` | `aws_iam_role`, `aws_iam_role_policy_attachment` | task + exec role |
|
||||
| `l1-alb` | `aws:elbv2:loadbalancer`, `aws:elbv2:listener`, `aws:elbv2:targetgroup` | `aws_lb`, `aws_lb_listener`, `aws_lb_target_group` | port, protocol |
|
||||
| `l1-ecr` | `aws:ecr:repository` | `aws_ecr_repository` | name |
|
||||
|
||||
The IR schema (`schemas/ir.schema.json`) is substrate-agnostic and already
|
||||
supports arbitrary resource types — no schema change needed, only new
|
||||
`interface.json` files + `TYPE_MAP` entries. The `l2-microservice`
|
||||
thin-composition references all six (depth ≤ 5).
|
||||
|
||||
### Decisions surfaced (v1.2)
|
||||
|
||||
| ID | Decision | Rationale | Confidence | Alternatives |
|
||||
|----|----------|-----------|------------|--------------|
|
||||
| **D-047** | Extend D-039 per-run-rotated-key waiver for v1.2. Real OIDC deferred to v1.3+. | go-gitea/gitea#36988 still open (TARGET 9). The waiver satisfies §12.5's intent for v1.2; Phase 12 tightens IAM + rotation hygiene. | 0.95 | (a) wait for #36988 (blocks v1.2 indefinitely); (b) self-hosted OIDC broker (heavy); (c) KMS-backed ephemeral creds (scope creep for v1.2). |
|
||||
| **D-048** | Consolidate `run_spike_plan.sh` + `run_spike_e2e.sh` → one `scripts/run_platform.sh` with `--plan-only` flag (default: full e2e). | Two scripts with overlapping setup (~30 lines duplicated). One script with a flag is simpler and matches the "streamline" scope axis. | 0.90 | Keep both (redundant); delete `run_spike_plan.sh` only (loses the plan-only convenience). |
|
||||
| **D-049** | v1.2 L1 catalog = 6 L1s (`l1-vpc`, `l1-ecs-cluster`, `l1-ecs-service`, `l1-iam-role`, `l1-alb`, `l1-ecr`). The adapter `TYPE_MAP` expands to 9 IR types (3 new for VPC, 3 for the rest). | Minimal set to deploy an ECS Fargate service end-to-end. VPC is split into vpc/subnet/routetable because the IR models one resource per `interface.json` entry, but the L1 groups them. | 0.85 | Fewer L1s (e.g. fold VPC into the ECS service — violates L1 single-purpose); more L1s (e.g. separate `l1-securitygroup` — scope creep for v1.2). |
|
||||
|
||||
---
|
||||
|
||||
*End of RESEARCH.md. Path: `/root/acdl/.ciagent/RESEARCH.md`.*
|
||||
@@ -0,0 +1,230 @@
|
||||
# ACDL v1.1 Milestone — Multi-Persona Code Review
|
||||
|
||||
**Reviewer:** ci-code-reviewer (model: glm-5.2)
|
||||
**Scope:** v1.1 milestone — Phases 06–10 (tags v1.1.1..v1.1.5), diff `v1.1.0..HEAD`
|
||||
**Date:** 2026-07-21
|
||||
**Verdict:** **READY TO SHIP** — 0 P0, 1 P1 (carried-forward), 0 P2 new
|
||||
|
||||
---
|
||||
|
||||
## Lens 1 — Correctness
|
||||
|
||||
The schemas + Python modules + Terraform implement what the decisions +
|
||||
`ARCHITECTURE.md` committed. Spot-checks all pass.
|
||||
|
||||
### Findings
|
||||
|
||||
- **`schemas/ir.schema.json`** (REQ-17): resources / relationships / composition
|
||||
(max-depth-5) / policy hooks (via PolicyCheckResult consumer) all present per
|
||||
§12.1. Substrate-agnostic: `aws_s3_bucket` appears ONLY in `$comment` and
|
||||
`description` strings (which explain the IR→Terraform mapping); it does NOT
|
||||
appear in any constraining keyword (`enum`/`const`/`pattern`/`required`). The
|
||||
schema body uses IR types (`aws:s3:bucket`). **Correct.**
|
||||
- **`schemas/contract.schema.json`** (REQ-22, W3.E): per-env mandatory via `allOf`
|
||||
if/then — qa requires `validation.e2eSuite`+`validation.loadTest`; prod requires
|
||||
`runbook`+`dashboard`+`oncall`; dr requires `drDrillRef`. The `profile:agentic`
|
||||
conditional is `if: {required:[profile], profile:{const:agentic}}` →
|
||||
`then: {required:[naturalLanguageIntent]}` — this is the **fixed** form
|
||||
(requires `profile` to be present before checking `const`), not the Phase 07
|
||||
initial bug. Verified: prod-missing-runbook rejected; agentic-without-NLI
|
||||
rejected; qa-without-validation rejected; dr-without-drDrillRef rejected;
|
||||
dev + agentic-with-NLI accepted. **Correct.**
|
||||
- **`acdl_platform/confidence_signal.py`** (REQ-19, D-040): `WEIGHTS` sum to
|
||||
1.0 (verified: 0.30+0.25+0.10+0.15+0.10+0.10 = 1.0). `PENALTY["critical"] = None`
|
||||
(hard-override sentinel). The critical-override short-circuit
|
||||
(`if p is None: return Signal(0.0, "block", ...)`) returns BEFORE the
|
||||
`score = max(0.0, min(1.0, base - penalty))` clamp. Dev-warn→block flip present
|
||||
(`if environment == "dev" and band == "warn": band = "block"`). The `policy`
|
||||
input key is read as `inputs.get("policy")` (not `policy_results`) — matches the
|
||||
Phase 10 e2e `run_spike_e2e.sh` which passes `inputs = {"policy": pcr, ...}`.
|
||||
Adversarial test: a critical-fail PCR → `score=0.0 band=block reasons=['CRITICAL_OVERRIDE:...']`.
|
||||
**Correct.**
|
||||
- **`acdl_platform/contract_resolver.py`** (REQ-27): `resolve()` loads YAML →
|
||||
validates against `contract.schema.json` → looks up L2 in registry → loads
|
||||
`composition.json` → maps wires → emits IR → validates against `ir.schema.json`.
|
||||
Wire mapping verified: `contract.inputs.bucket_name` →
|
||||
`child.inputs.bucket_name` via `wires.bucket_name.{target:s3, input:bucket_name}`.
|
||||
Resolved spike IR has `resources[0].inputs = {bucket_name: acdl-spike-bucket,
|
||||
region: us-east-1}`. Prod-missing-runbook raises `jsonschema.ValidationError`
|
||||
(not a generic ValueError). **Correct.**
|
||||
- **`acdl_platform/outbox_writer.py`** (D-044, D-P10-3): SHA-256 over canonical
|
||||
JSON (`sort_keys=True, separators=(",", ":")`). `prev_event_hash` defaults to
|
||||
`"GENESIS"`. DynamoDB item shape: PK `contractId` (S), SK
|
||||
`eventType#eventTs` (S), TTL `expire_at` (N, now+365d). Append-only
|
||||
(`put_item` only; 0 `delete_item`/`update_item`). **Correct.**
|
||||
- **`adapters/terraform/adapter.py`** (REQ-26, D-P10-1): `TYPE_MAP =
|
||||
{aws:s3:bucket -> aws_s3_bucket}`. Backend key derived from stack name:
|
||||
`spike/l2-static-asset/terraform.tfstate` (verified). Unknown IR type raises
|
||||
`ValueError`. Resources array handling is shape-driven (iterates
|
||||
`ir_instance["resources"]`; works for both l1 and l2 IR). **Correct.**
|
||||
- **`adapters/terraform/policy/checkov_adapter.py`** (REQ-18, D-043): `RULE_MAP`
|
||||
has exactly 11 Checkov rule IDs (CKV_AWS_41/45/46/20/57/24/25/1/40/7/33). The
|
||||
`ACDL_TAG_NAMING` SKIPPED record is appended (severity: info, result:
|
||||
skipped). Tolerates both Checkov JSON shapes — nested
|
||||
`{framework: {results: {...}}}` and legacy `{framework: {passed_checks:...}}`
|
||||
(the `results = body.get("results", body)` fallback). **Correct.**
|
||||
|
||||
### Verdict: PASS — no issues.
|
||||
|
||||
---
|
||||
|
||||
## Lens 2 — Testing
|
||||
|
||||
The verify scripts are real gates that fail on regression, not presence checks.
|
||||
|
||||
### Findings
|
||||
|
||||
- **`scripts/verify_phase07.sh`**: Check 2 uses
|
||||
`jsonschema.Draft202012Validator.check_schema(...) || fail` — actually
|
||||
validates the 3 schemas as Draft 2020-12 (fails if a schema is broken).
|
||||
Check 8 cross-checks the spike contract against `contract.schema.json` via
|
||||
`jsonschema.validate(...) || fail`. Check 9 cross-checks a minimal IR against
|
||||
`ir.schema.json`. Every check has `|| fail`. **Real gate.**
|
||||
- **`scripts/verify_phase10.sh`**: 8 checks, each with `|| fail`. Check (h) is the
|
||||
REQ-28 substrate-agnostic scan. **Synthetic leak test performed:** appended
|
||||
`LEAK = "aws_s3_bucket"` to `acdl_platform/separation_of_duties.py` and ran the
|
||||
Check (h) grep — it caught the leak (`acdl_platform/separation_of_duties.py:44:
|
||||
LEAK = "aws_s3_bucket"`), then reverted. The check also scans `modules-ir/`
|
||||
JSON for `aws_*` resource-type VALUES (excluding `description`/`$comment`
|
||||
strings). **Real gate.**
|
||||
- **`scripts/run_spike_e2e.sh`** + **`scripts/run_spike_plan.sh`**: touch real AWS
|
||||
— `terraform init/validate/plan -lock=false` + `checkov` + DynamoDB
|
||||
`put_item`/`query`. NOT stubbed (the spike key is loaded from gitignored
|
||||
`.env.secrets`). The e2e runner uses `|| fail` on every step, so a DynamoDB
|
||||
outage or terraform failure exits 1 (verified: outbox write failure propagates
|
||||
via `|| fail "outbox write failed"`). **Real e2e.**
|
||||
|
||||
### Verdict: PASS — no issues.
|
||||
|
||||
---
|
||||
|
||||
## Lens 3 — Security
|
||||
|
||||
AWS key handling (D-034/D-039), IAM least-privilege, gitignore discipline, no
|
||||
secrets in commits. All clean.
|
||||
|
||||
### Findings
|
||||
|
||||
- **No leaked key IDs in executable code:**
|
||||
`git log v1.1.0..HEAD -p | grep -iE "AKIA[A-Z0-9]{16}" | grep -v "^#"` returns
|
||||
matches ONLY inside `.ciagent/VERIFY.md` (the Phase 09 narrative — the
|
||||
carried-forward P1-1). No `.py`, `.tf`, `.json`, `.yaml`, or `.sh` file
|
||||
contains an `AKIA…` key ID. **Clean.**
|
||||
- **No leaked secret keys:**
|
||||
`git log v1.1.0..HEAD -p | grep -iE "aws_secret_access_key.*=.*[A-Za-z0-9/+=]{40}" | grep -v "^#"`
|
||||
returns nothing. **Clean.**
|
||||
- **`terraform/bootstrap/spike_runner_policy.json`** (REQ-23): least-privilege.
|
||||
Allow actions: `s3:{PutObject,GetObject,DeleteObject,ListBucket,GetBucketLocation,GetBucketVersioning}`
|
||||
+ `dynamodb:{GetItem,PutItem,DeleteItem,UpdateItem,Query,Scan,DescribeTable}`
|
||||
+ `sts:GetCallerIdentity`. **No** `iam:*`, **no** `ec2:*`, **no**
|
||||
`s3:CreateBucket`, **no** `s3:DeleteBucket`, **no** `terraform apply`
|
||||
(apply is out of spike scope). `DenyEverythingElse` `NotResource` lists exactly
|
||||
3 ARNs (state bucket + bucket objects + outbox table); everything else is
|
||||
denied. **Correct.**
|
||||
- **Gitignore discipline:** `.env.secrets`, `terraform/bootstrap/.bootstrap_state.json`,
|
||||
`terraform/spike/.terraform/`, `terraform/spike/.terraform.lock.hcl`,
|
||||
`terraform/spike/tfplan`, `terraform/spike/*.tfstate*` all gitignored
|
||||
(`git check-ignore` confirms each). **Correct.**
|
||||
- **Outbox write is append-only:** `grep -c "delete_item|update_item"
|
||||
outbox_writer.py` = 0 (only `put_item`). **Correct.**
|
||||
- **E2E runner is plan-only:** `grep -c "terraform apply" run_spike_e2e.sh` = 0
|
||||
(only `init + validate + plan`). **Correct.**
|
||||
|
||||
### P1 (carried-forward, NOT auto-fixed)
|
||||
|
||||
- **P1-1:** The `.ciagent/VERIFY.md` Phase 09 narrative contains two AWS access
|
||||
key IDs — `AKIAYOZHMKZ7RK26N66W` (the rotated spike key id) and
|
||||
`AKIAYOZHMKZ772SINHFX` (the deactivated root key id). Confirmed still present
|
||||
(`grep -c` returns 2). These are **public identifiers, not secret pairs**;
|
||||
they live in the `.ciagent/` audit narrative, not in any executable code
|
||||
path. Recommended for a future hygiene redaction pass (replace with
|
||||
`AKIA…SPIKE` / `AKIA…ROOT-DEACTIVATED` placeholders). **Non-blocking for v1.2
|
||||
ship; flagged for post-hoc review.**
|
||||
|
||||
### Verdict: PASS — 1 carried-forward P1 (non-blocking).
|
||||
|
||||
---
|
||||
|
||||
## Lens 4 — Performance
|
||||
|
||||
Not a concern for the spike (plan-only, single resource, no load). **Skipped.**
|
||||
|
||||
---
|
||||
|
||||
## Lens 5 — Maintainability
|
||||
|
||||
The `acdl_platform/` rename, substrate-agnostic boundary, and decision trail
|
||||
are all consistent.
|
||||
|
||||
### Findings
|
||||
|
||||
- **`acdl_platform/` rename (Phase 08 prep, fixing the stdlib `platform`
|
||||
shadow):** consistently applied across `scripts/verify_phase06.sh`,
|
||||
`scripts/verify_phase07.sh`, `README.md`, and the Python imports
|
||||
(`import acdl_platform.confidence_signal as c` in `run_spike_e2e.sh`).
|
||||
`grep -l acdl_platform` confirms all three files reference the renamed dir.
|
||||
**Consistent.**
|
||||
- **Decision trail:** every schema/module cites its source. Sampled 3 files:
|
||||
- `acdl_platform/confidence_signal.py` cites `REQ-19`, `D-040`,
|
||||
`ARCHITECTURE.md §8`.
|
||||
- `acdl_platform/contract_resolver.py` cites `ARCHITECTURE.md §12.8`.
|
||||
- `schemas/ir.schema.json` cites `ARCHITECTURE.md §12.1`, `§3`, `W3.D`.
|
||||
**Citations present.**
|
||||
- **Spike-vs-v1.2 boundary** documented in each design doc:
|
||||
`acdl_platform/audit_ledger_design.md`, `acdl_platform/hitl_matrix_design.md`,
|
||||
and `.ciagent/PLAN.md` all reference `v1.2`. **Boundary documented.**
|
||||
- **Substrate-agnostic boundary (REQ-28):** the adapter is the only
|
||||
substrate-specific code. `acdl_platform/` Python is clean (verified by the
|
||||
Check (h) grep + the synthetic leak test). `modules-ir/` JSON data files
|
||||
contain only IR types (`aws:s3:bucket`); `aws_s3_bucket` appears only in
|
||||
`description`/`$comment` strings that explain the mapping. **Boundary holds.**
|
||||
|
||||
### Verdict: PASS — no issues.
|
||||
|
||||
---
|
||||
|
||||
## Lens 6 — Adversarial
|
||||
|
||||
Tried to break the spike. All failure modes handled correctly.
|
||||
|
||||
### Findings
|
||||
|
||||
- **`contracts/spike.yaml` with `environment: prod` (missing runbook):** the
|
||||
contract schema rejects it via the `allOf` if/then (`runbook` is a required
|
||||
property when `environment == "prod"`). `contract_resolver.py` raises
|
||||
`jsonschema.ValidationError` (not a generic ValueError). **Handled.**
|
||||
- **IR instance with a resource type not in `TYPE_MAP` (e.g.
|
||||
`aws:ec2:instance`):** the adapter raises
|
||||
`ValueError("unknown IR type 'aws:ec2:instance' (adapter spike handles
|
||||
aws:s3:bucket only)")`. **Handled.**
|
||||
- **Confidence signal gets a critical-fail `PolicyCheckResult`:** hard-overrides
|
||||
to `score=0.0`, `band=block`, `reasonCodes=['CRITICAL_OVERRIDE:...']`. The
|
||||
short-circuit returns BEFORE the score clamp. **Handled.**
|
||||
- **Outbox write fails (DynamoDB unreachable):** `outbox_writer.py` raises
|
||||
(boto3 `put_item` propagates the exception); `run_spike_e2e.sh` line 93 uses
|
||||
`|| fail "outbox write failed"` → exit 1. **Handled (no silent success).**
|
||||
- **Missing confidence input (e.g. `nfrs` absent):** `compute()` returns
|
||||
`Signal(0.0, "block", {}, ["INPUT_MISSING:nfrs"])`. **Handled.**
|
||||
|
||||
### Verdict: PASS — no issues.
|
||||
|
||||
---
|
||||
|
||||
## P0 / P1 / P2 Summary
|
||||
|
||||
| Severity | Count | Action |
|
||||
|-----------|-------|--------|
|
||||
| **P0** | 0 | none (no auto-fix needed) |
|
||||
| **P1** | 1 | P1-1 (carried-forward): two AWS access key IDs in `.ciagent/VERIFY.md` Phase 09 narrative — flagged for post-hoc hygiene redaction; non-blocking |
|
||||
| **P2** | 0 | none |
|
||||
|
||||
---
|
||||
|
||||
## Milestone verdict
|
||||
|
||||
**v1.1 milestone: READY TO SHIP**
|
||||
|
||||
- 0 P0 issues (no blocking fixes).
|
||||
- 1 P1 carried-forward (non-blocking; flagged for post-hoc review).
|
||||
- All 5 lenses pass. REQ-16..28 satisfied. The IR commitments hold (REQ-28).
|
||||
- Ready for the COMPLETE gate → ship `v1.2.0` → audit.
|
||||
+90
-9
@@ -3,7 +3,8 @@
|
||||
## Overview
|
||||
|
||||
- **v1.0 (demo):** complete — tag `v1.1.0`, 2026-07-21. All 5 phases shipped + audited PASS.
|
||||
- **v1.1 (active):** architecture finalization + v1 spike. 5 phases (06–10).
|
||||
- **v1.1 (complete):** architecture finalization + v1 spike. 5 phases (06–10). Tag `v1.2.0`, 2026-07-21. All 5 phases shipped + verified; review READY TO SHIP (0 P0); audit CLEAN. Gitea release id 202.
|
||||
- **v1.2 (active):** platform hardening + first real consumer deployment. 6 phases (11–16). Ship tag `v1.3.0`.
|
||||
- **v1.0 demo URL:** https://git.cloudinit.dev/continuous-intelligence/acdl-evidence/raw/branch/main/index.html
|
||||
|
||||
---
|
||||
@@ -71,12 +72,15 @@ phase produced a runnable increment and ended with a phase-completion commit
|
||||
|
||||
---
|
||||
|
||||
## v1.1 (Active — architecture finalization + v1 spike)
|
||||
## v1.1 (Complete — architecture finalization + v1 spike, 2026-07-21, tag `v1.2.0`)
|
||||
|
||||
Five-phase breakdown to finalize the architecture to v1.0 and prove the
|
||||
locked commitments with one end-to-end implementation spike. Milestone
|
||||
`v1.1-spike` covers the real platform's first materialization. Ship tag at
|
||||
milestone COMPLETE: `v1.2.0` (feature milestone, next minor per ship.md).
|
||||
`v1.1-spike` covered the real platform's first materialization. Ship tag
|
||||
at milestone COMPLETE: **`v1.2.0`** (feature milestone, next minor per
|
||||
ship.md). **Status: COMPLETE — all 5 phases shipped (v1.1.1..v1.1.5) +
|
||||
verified; review READY TO SHIP (0 P0); audit CLEAN; Gitea release id 202.
|
||||
D-034 closed (root key deactivated by user).**
|
||||
|
||||
### Phase 06 — archive-demo-and-reorient
|
||||
- **Description:** Move the v1.0 demo (`modules/`, `scripts/`, `evidence-ui/`, `contracts/`, demo `.gitea/workflows/`) to `demo/`. Establish the new repo layout (`platform/`, `schemas/`, `adapters/`, `terraform/`, `modules-ir/`). Rewrite README to reflect the real platform. Verify the demo still runs from `demo/` (regression check).
|
||||
@@ -90,7 +94,7 @@ milestone COMPLETE: `v1.2.0` (feature milestone, next minor per ship.md).
|
||||
|
||||
### Phase 07 — architecture-v1-finalization
|
||||
- **Description:** Resolve the 11 open decisions in `docs/architecture.md` §13 (already recorded in `PROJECT.md`). Author the locked schemas + designs: `schemas/ir.schema.json` (REQ-17), `schemas/policy_check_result.schema.json` (REQ-18), `schemas/contract.schema.json` (REQ-22), `platform/confidence_signal.py` spec (REQ-19), `platform/audit_ledger_design.md` (REQ-20), `platform/hitl_matrix_design.md` (REQ-21). Mark architecture v1.0.
|
||||
- **Status:** pending
|
||||
- **Status:** complete (v1.1.2)
|
||||
- **Depends on:** [06]
|
||||
- **Requirements:** REQ-16, REQ-17, REQ-18, REQ-19, REQ-20, REQ-21, REQ-22
|
||||
- **Success Criteria:**
|
||||
@@ -100,7 +104,7 @@ milestone COMPLETE: `v1.2.0` (feature milestone, next minor per ship.md).
|
||||
|
||||
### Phase 08 — aws-oidc-bootstrap
|
||||
- **Description:** **Re-scoped per RESEARCH TARGET 1 + D-039.** Gitea Actions does not support `id-token: write` (conf 0.95), so real OIDC is deferred to v1.2. This phase instead: uses the temporary long-lived key (waiver D-034) once to create an S3 state bucket, a DynamoDB lock/outbox table, and an IAM user with a minimal scoped policy (S3 + DynamoDB + plan-only); stores the key as a Gitea Actions secret; implements `scripts/rotate_spike_key.sh` to rotate the key after each spike run. Real OIDC federation is tracked via go-gitea/gitea#36988 for v1.2.
|
||||
- **Status:** pending
|
||||
- **Status:** complete (v1.1.3)
|
||||
- **Depends on:** [07]
|
||||
- **Requirements:** REQ-23 (re-interpreted: AWS auth bootstrap + state backend; OIDC deferred to v1.2 per D-039)
|
||||
- **Success Criteria:**
|
||||
@@ -112,7 +116,7 @@ milestone COMPLETE: `v1.2.0` (feature milestone, next minor per ship.md).
|
||||
|
||||
### Phase 09 — v1-spike-ir-and-l1-and-adapter
|
||||
- **Description:** Implement the Target Stack IR, one real L1 `l1-s3` (IR-typed interface, registered), and the Terraform adapter that compiles the IR → Terraform `variable`/`output` + root module and emits a real `terraform plan` against AWS (via the rotated-key secret per D-039; OIDC is v1.2). State in S3 + DynamoDB.
|
||||
- **Status:** pending
|
||||
- **Status:** complete (v1.1.4)
|
||||
- **Depends on:** [08]
|
||||
- **Requirements:** REQ-24, REQ-26
|
||||
- **Success Criteria:**
|
||||
@@ -122,7 +126,7 @@ milestone COMPLETE: `v1.2.0` (feature milestone, next minor per ship.md).
|
||||
|
||||
### Phase 10 — v1-spike-l2-and-contract-e2e
|
||||
- **Description:** Implement `l2-static-asset` (thin-composition referencing `l1-s3`), the contract schema + contract→IR resolution, and one end-to-end contract submission (`contracts/spike.yaml` for `l2-static-asset`) flowing through schema validation → IR resolution → `terraform plan` → Checkov `PolicyCheckResult` → confidence signal → evidence event to the DynamoDB outbox. Verify the IR commitments hold (no polyglot mess).
|
||||
- **Status:** pending
|
||||
- **Status:** complete (v1.1.5)
|
||||
- **Depends on:** [09]
|
||||
- **Requirements:** REQ-25, REQ-27, REQ-28
|
||||
- **Success Criteria:**
|
||||
@@ -131,4 +135,81 @@ milestone COMPLETE: `v1.2.0` (feature milestone, next minor per ship.md).
|
||||
- `scripts/verify_phase10.sh` proves the adapter is the only substrate-specific code.
|
||||
- Evidence event is written to the DynamoDB outbox.
|
||||
|
||||
After Phase 10: COMPLETE gate — review → ship `v1.2.0` → audit.
|
||||
After Phase 10: COMPLETE gate — review → ship `v1.2.0` → audit. **DONE.**
|
||||
|
||||
---
|
||||
|
||||
## v1.2 (Active — platform hardening + first real consumer deployment)
|
||||
|
||||
Six-phase breakdown to harden the v1.1 spike, simplify the setup, update
|
||||
the docs, and prove the platform delivers real value by deploying a basic
|
||||
microservice to AWS ECS Fargate end-to-end. Ship tag at milestone COMPLETE:
|
||||
**`v1.3.0`** (feature milestone, next minor per ship.md — v1.1 shipped
|
||||
`v1.2.0`). Phase patches `v1.2.1`..`v1.2.6`.
|
||||
|
||||
### Phase 11 — v1.2-research-and-readme
|
||||
- **Description:** Re-evaluate go-gitea/gitea#36988 (OIDC for Gitea Actions) — confirm still open (re-checked 2026-07-21: open, last updated 2026-05-27, not merged) and record the decision to extend D-039 as D-047. Audit the v1.1 spike for NFR gaps (least-privilege IAM, idempotency, error handling, rotation hygiene) and simplification opportunities (script consolidation, dead code, stale paths). Rewrite `README.md` to reflect v1.1 complete + the actual spike flow + how to run + the real repo layout + the v1.2 objective.
|
||||
- **Status:** planned
|
||||
- **Depends on:** —
|
||||
- **Requirements:** REQ-29
|
||||
- **Success Criteria:**
|
||||
- `RESEARCH.md` has a v1.2 addendum with the #36988 re-check + NFR audit + simplification findings.
|
||||
- `README.md` reflects v1.1 complete; documents the spike flow, `scripts/run_platform.sh`, the repo layout, and the v1.2 objective; no stale "v1.1 (active)" framing.
|
||||
- D-047 is recorded in `PROJECT.md`.
|
||||
|
||||
### Phase 12 — nfr-harden-and-simplify
|
||||
- **Description:** Apply Phase 11's findings. Tighten `terraform/bootstrap/spike_runner_policy.json` to least-privilege (add ECS + ECR + ELB + IAM plan-only permissions for v1.2; audit for wildcards). Make `create_state_backend.py` and `create_iam_user.py` idempotent. Consolidate `run_spike_plan.sh` + `run_spike_e2e.sh` into a single `scripts/run_platform.sh` with proper exit codes and error handling. Redact P1-1 (the two AWS access key IDs in `.ciagent/VERIFY.md` Phase 09 narrative). Fix any remaining stale `platform/` paths in `.ciagent/`. The v1.1 spike still runs e2e after the refactor.
|
||||
- **Status:** planned
|
||||
- **Depends on:** [11]
|
||||
- **Requirements:** REQ-30
|
||||
- **Success Criteria:**
|
||||
- `scripts/run_platform.sh` runs the full v1.1 spike e2e and exits 0.
|
||||
- `create_state_backend.py` / `create_iam_user.py` re-runs are idempotent (no duplicate resources; exit 0).
|
||||
- `spike_runner_policy.json` passes a least-privilege audit (no `*` actions beyond documented exceptions).
|
||||
- `.ciagent/VERIFY.md` Phase 09 narrative has no live AWS access key IDs.
|
||||
- No stale `platform/` paths remain in `.ciagent/`.
|
||||
|
||||
### Phase 13 — l1-catalog-for-ecs
|
||||
- **Description:** Author six IR-typed L1 modules for an ECS Fargate microservice: `l1-vpc` (VPC + subnets + route tables), `l1-ecs-cluster` (ECS Fargate cluster), `l1-ecs-service` (ECS service + task definition), `l1-iam-role` (task execution + task role), `l1-alb` (ALB + listener + target group), `l1-ecr` (ECR repository). Each has an `interface.json` valid against `schemas/ir.schema.json`. Register all six in `modules-ir/registry.json`. Expand the Terraform adapter `TYPE_MAP` to cover the new IR resource types. Each L1 produces a valid `terraform plan` fragment.
|
||||
- **Status:** planned
|
||||
- **Depends on:** [12]
|
||||
- **Requirements:** REQ-31
|
||||
- **Success Criteria:**
|
||||
- All six L1s exist under `modules-ir/l1/` with `interface.json` valid against `schemas/ir.schema.json`.
|
||||
- `modules-ir/registry.json` lists all six.
|
||||
- The adapter `TYPE_MAP` covers all six IR resource types.
|
||||
- Each L1 produces a valid `terraform plan` fragment.
|
||||
|
||||
### Phase 14 — l2-microservice-and-contract-schema
|
||||
- **Description:** Author `l2-microservice` thin-composition under `modules-ir/l2/l2-microservice/` referencing the six ECS L1s (depth ≤ 5). Extend `schemas/contract.schema.json` with microservice inputs (`image: string`, `port: integer`, `env: map`, `healthcheck: object`). Verify contract→IR resolution (`acdl_platform/contract_resolver.py`) yields a complete target stack for `l2-microservice`.
|
||||
- **Status:** planned
|
||||
- **Depends on:** [13]
|
||||
- **Requirements:** REQ-32
|
||||
- **Success Criteria:**
|
||||
- `l2-microservice` references the six ECS L1s only (depth ≤ 5).
|
||||
- `schemas/contract.schema.json` validates a `contracts/microservice.yaml` with the new inputs.
|
||||
- Contract→IR resolution yields a complete target stack (all six L1 instances + relationships).
|
||||
|
||||
### Phase 15 — consumer-repo-and-terraform-apply
|
||||
- **Description:** Create a new Gitea repo `acdl-consumer-microservice` under the `continuous-intelligence` org containing a basic HTTP microservice (tiny Python/Go server returning 200), a `Dockerfile`, an ECR push step, and a `contracts/microservice.yaml` submission for `l2-microservice` (dev environment). Lift the platform from `plan` to **`apply`** for the `dev` environment (autonomous per §10, confidence ≥ 0.50, no HITL). Submit the contract → pipeline → IR → plan → apply → a real ECS Fargate service running.
|
||||
- **Status:** planned
|
||||
- **Depends on:** [14]
|
||||
- **Requirements:** REQ-33, REQ-34
|
||||
- **Success Criteria:**
|
||||
- `acdl-consumer-microservice` repo exists under `continuous-intelligence`.
|
||||
- The microservice builds into a Docker image and is pushed to ECR.
|
||||
- `terraform apply` (dev) creates real AWS resources (VPC, ECS cluster, ECR repo, ALB, ECS service).
|
||||
- The apply result is captured in the evidence stream.
|
||||
|
||||
### Phase 16 — v1.2-capstone-e2e
|
||||
- **Description:** End-to-end verification: a consumer commit to `acdl-consumer-microservice` triggers the pipeline → contract→IR resolution → `terraform plan` → `terraform apply` (dev) → a live ECS Fargate service serving HTTP 200 on its ALB → evidence event written to the DynamoDB outbox → the event renders on the `acdl-evidence` timeline. Verify the NFR improvements from Phase 12 hold, the setup is simpler (one `scripts/run_platform.sh`), and the README is accurate. `scripts/verify_phase16.sh` proves the full flow green.
|
||||
- **Status:** planned
|
||||
- **Depends on:** [15]
|
||||
- **Requirements:** REQ-35
|
||||
- **Success Criteria:**
|
||||
- One consumer commit produces a live ECS service serving HTTP 200.
|
||||
- An evidence event for the apply is in the DynamoDB outbox and renders on the timeline.
|
||||
- `scripts/verify_phase16.sh` exits 0.
|
||||
- README accurately documents the v1.2 platform flow.
|
||||
|
||||
After Phase 16: COMPLETE gate — review → ship `v1.3.0` → audit.
|
||||
@@ -0,0 +1,75 @@
|
||||
# Phase 11 — v1.2-research-and-readme (v1.2) VERIFY
|
||||
|
||||
**Verdict: Phase 11: VERIFIED**
|
||||
**Tag: v1.2.1**
|
||||
**Date: 2026-07-21**
|
||||
|
||||
---
|
||||
|
||||
## Scope
|
||||
|
||||
Phase 11 is a docs-only phase: re-evaluate go-gitea/gitea#36988, audit the
|
||||
v1.1 spike for NFR gaps + simplification opportunities, and rewrite
|
||||
`README.md` to reflect v1.1 complete + the actual platform flow + the v1.2
|
||||
objective. Requirement covered: **REQ-29**.
|
||||
|
||||
## Verification layers
|
||||
|
||||
### 1. Structural
|
||||
|
||||
- `README.md` exists (52 → 144 lines, +92).
|
||||
- `.ciagent/RESEARCH.md` has a `## v1.2 Research Addendum (Phase 11, 2026-07-21)` section (Targets 9–13 + decisions table).
|
||||
- `scripts/verify_phase11.sh` exists (+x, 39 lines).
|
||||
- `.ciagent/PLAN.md` updated to Phase 11.
|
||||
- No new executable code; no schema changes; no AWS changes.
|
||||
- **PASS.**
|
||||
|
||||
### 2. Behavioral (`scripts/verify_phase11.sh`)
|
||||
|
||||
```
|
||||
=== Phase 11 verification ===
|
||||
README.md: OK (v1.2 framing, platform flow, how-to-run, credentials)
|
||||
RESEARCH.md: OK (v1.2 addendum, Targets 9-13, D-047/D-048/D-049)
|
||||
.ciagent/ files: OK (v1.2 milestone consistent across all 5 files)
|
||||
#36988 re-check: OK (date + D-039 extension recorded)
|
||||
|
||||
=== Phase 11: VERIFIED ===
|
||||
```
|
||||
|
||||
All 24 assertions pass:
|
||||
- README.md: `v1.2 (active)` present; `v1.1 (active)` absent; v1.1 marked complete; `v1.3.0` ship tag referenced; D-047 referenced; "How the platform works" section present; spike flow (terraform plan, confidence signal, DynamoDB outbox) documented; `run_spike_e2e.sh` in how-to-run.
|
||||
- RESEARCH.md: v1.2 addendum section; Targets 9–13; D-047/D-048/D-049; "still open" for #36988.
|
||||
- `.ciagent/` consistency: config.json milestone v1.2; PROJECT.md v1.2 objective; REQUIREMENTS.md REQ-29; ROADMAP.md Phase 11; ARCHITECTURE.md v1.2 scope.
|
||||
- #36988 re-check: 2026-05-27 last-updated date recorded; D-039 waiver extension recorded.
|
||||
- **PASS.**
|
||||
|
||||
### 3. Security
|
||||
|
||||
- No credentials introduced or modified. The README documents the D-039/D-047 waiver and links to #36988 but does not embed any AWS key material.
|
||||
- RESEARCH.md's P1-1 redaction target (two AWS access key IDs in `.ciagent/VERIFY.md` Phase 09 narrative) is *documented* as a Phase 12 action — not yet redacted (Phase 12 scope). No new key IDs introduced in this phase.
|
||||
- **PASS.**
|
||||
|
||||
### 4. Quality
|
||||
|
||||
- README.md is accurate against the v1.1 spike codebase (the flow diagram matches `scripts/run_spike_e2e.sh` step-by-step; the repo layout table matches `ls`).
|
||||
- RESEARCH.md's NFR audit findings are grounded in actual file reads (`spike_runner_policy.json`, `create_state_backend.py`, `create_iam_user.py`, `run_spike_*.sh`, `rotate_spike_key.sh`).
|
||||
- The #36988 re-check facts (state=open, merged=false, updated_at=2026-05-27) were fetched live from `api.github.com/repos/go-gitea/gitea/pulls/36988` during the research.
|
||||
- D-047/D-048/D-049 are consistent with the PROJECT.md decisions table and the ROADMAP.md phase descriptions.
|
||||
- **PASS.**
|
||||
|
||||
## P0 / P1
|
||||
|
||||
- **P0: none.**
|
||||
- **P1: none new.** P1-1 (carried forward from v1.1 audit) is explicitly scoped for Phase 12 — the redaction target is identified in RESEARCH.md TARGET 10 but the redaction itself is Phase 12's REQ-30 deliverable.
|
||||
|
||||
## Requirements covered
|
||||
|
||||
- **REQ-29:** `README.md` is fully rewritten to reflect the v1.1-complete platform: the actual spike flow (contract → IR → `terraform plan` → Checkov → confidence signal → outbox), how to run it (`scripts/run_spike_e2e.sh`; `run_platform.sh` noted as the v1.2 consolidation), the real repo layout, the v1.2 objective, the environments table, and the credentials/D-047 waiver. No stale "v1.1 (active)" framing. **VERIFIED.**
|
||||
|
||||
## Conclusion
|
||||
|
||||
Phase 11 is VERIFIED. The v1.2 milestone is open with a clear research
|
||||
baseline: #36988 is still blocked (D-047 extends the waiver), the spike's
|
||||
NFR gaps are catalogued (Phase 12 scope), the simplification plan is
|
||||
D-048 (script consolidation), the ECS L1 catalog is scoped (D-049, Phase
|
||||
13), and the README accurately documents the platform as it exists today.
|
||||
@@ -4,7 +4,7 @@
|
||||
{
|
||||
"slug": "acdl",
|
||||
"name": "Agentic Cloud Delivery Platform",
|
||||
"milestone": "v1.1",
|
||||
"milestone": "v1.2",
|
||||
"status": "specify"
|
||||
}
|
||||
],
|
||||
|
||||
+7
-1
@@ -7,4 +7,10 @@ state.json
|
||||
audit.json
|
||||
*.tmp
|
||||
.DS_Store
|
||||
runner-data/
|
||||
runner-data/
|
||||
.env.secrets
|
||||
terraform/bootstrap/.bootstrap_state.json
|
||||
terraform/spike/.terraform/
|
||||
terraform/spike/.terraform.lock.hcl
|
||||
terraform/spike/tfplan
|
||||
terraform/spike/*.tfstate*
|
||||
@@ -8,45 +8,159 @@ a production deployment by declaring intent, without authoring a workflow,
|
||||
a configuration file, or a Terraform module.
|
||||
|
||||
- **Vision** (the why): [`docs/vision.md`](docs/vision.md)
|
||||
- **Architecture** (the how): [`docs/architecture.md`](docs/architecture.md)
|
||||
- **Architecture** (the how): [`docs/architecture.md`](docs/architecture.md) + [`.ciagent/ARCHITECTURE.md`](.ciagent/ARCHITECTURE.md)
|
||||
- **Decisions**: [`.ciagent/PROJECT.md`](.ciagent/PROJECT.md)
|
||||
- **Target architecture**: [`.ciagent/ARCHITECTURE.md`](.ciagent/ARCHITECTURE.md)
|
||||
- **Phase plan**: [`.ciagent/ROADMAP.md`](.ciagent/ROADMAP.md)
|
||||
|
||||
## Status
|
||||
|
||||
- **v1.1 (active):** architecture finalization + v1 spike. Finalize the
|
||||
architecture to v1.0 (resolve the 11 open design decisions) and prove the
|
||||
locked commitments with one end-to-end implementation spike
|
||||
- **v1.2 (active):** platform hardening + first real consumer deployment.
|
||||
Harden the v1.1 spike's NFRs, simplify the setup, rewrite the docs, and
|
||||
prove the platform delivers real value by deploying a basic microservice
|
||||
to AWS ECS Fargate end-to-end (`terraform apply`, dev autonomous). Ship
|
||||
tag `v1.3.0`.
|
||||
- **v1.1 (complete, tag `v1.2.0`):** architecture finalization + v1 spike.
|
||||
Finalized the architecture to v1.0 (resolved all 11 open design
|
||||
decisions) and proved the IR commitments hold with one end-to-end spike
|
||||
(`l1-s3` + `l2-static-asset` + Terraform adapter → real `terraform plan`
|
||||
against AWS).
|
||||
- **v1.0 demo (complete, archived):** tag `v1.1.0`. The 30-minute
|
||||
stub-driven executive demo is preserved under `demo/` as the intent
|
||||
reference; it is not the platform.
|
||||
against AWS). Gitea release id 202.
|
||||
- **v1.0 demo (complete, archived under `demo/`, tag `v1.1.0`):** the
|
||||
30-minute stub-driven executive demo. Preserved as the intent reference;
|
||||
it is not the platform.
|
||||
|
||||
## Repository layout
|
||||
## How the platform works
|
||||
|
||||
| Path | Purpose | Populated |
|
||||
|------|---------|-----------|
|
||||
| `platform/` | Platform code: confidence signal, contract resolver, outbox, HITL/ledger designs | 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+ |
|
||||
| `modules-ir/` | IR-typed L1/L2 modules (`l1-s3`, `l2-static-asset`) | Phase 09–10 |
|
||||
| `scripts/` | v1.1 verify scripts (`verify_phaseNN.sh`) | Phase 06+ |
|
||||
| `demo/` | Archived v1.0 executive demo (tag `v1.1.0`); runs locally via `demo/scripts/run_demo.sh --no-upload` | complete |
|
||||
| `.ciagent/` | CIAgent metadata (plans, decisions, personas, roadmap, research) | active |
|
||||
| `docs/` | Upstream vision + architecture sources | active |
|
||||
The platform is **four layers + six cross-cutting concerns**, bound by the
|
||||
vision's "Two Consumer Surfaces, One Platform" tenet: technical developers
|
||||
(L3A) and non-technical consumers (L3B) converge on the same contract
|
||||
schema, the same policy envelope, and the same evidence stream.
|
||||
|
||||
## Running the archived demo
|
||||
### The v1.1 spike flow (end-to-end)
|
||||
|
||||
The v1.0 demo is an archived artifact. To re-run it locally:
|
||||
```
|
||||
contracts/spike.yaml
|
||||
│ (contract schema validation)
|
||||
▼
|
||||
acdl_platform/contract_resolver.py ──▶ Target Stack IR (JSON)
|
||||
│ (IR schema validation)
|
||||
▼
|
||||
adapters/terraform/adapter.py ──▶ terraform/spike/{main,terraform,providers}.tf
|
||||
│ (the only substrate-specific code)
|
||||
▼
|
||||
terraform plan (real AWS, via the rotated spike key — D-039/D-047)
|
||||
│
|
||||
▼
|
||||
adapters/terraform/policy/checkov_adapter.py ──▶ PolicyCheckResult (JSON list)
|
||||
│ (normalized, engine-agnostic)
|
||||
▼
|
||||
acdl_platform/confidence_signal.py ──▶ { score, band, perInput, reasonCodes }
|
||||
│ (6 inputs: policy, validation, freshness, source, history, nfrs)
|
||||
▼
|
||||
acdl_platform/outbox_writer.py ──▶ DynamoDB outbox (acdl-outbox)
|
||||
│ (hash-chained evidence event)
|
||||
▼
|
||||
acdl-evidence timeline (acdl-evidence repo, raw-file served)
|
||||
```
|
||||
|
||||
The spike validates the architecture's claim that the **IR-shaped
|
||||
commitments do not require a polyglot mess**: the adapter is the only
|
||||
substrate-specific code. `modules-ir/`, `schemas/`, `contracts/`,
|
||||
`acdl_platform/confidence_signal.py`, `acdl_platform/contract_resolver.py`,
|
||||
and `acdl_platform/outbox_writer.py` are all substrate-agnostic (no
|
||||
`aws_s3_bucket` / `aws_` Terraform terms).
|
||||
|
||||
### What's different in v1.2
|
||||
|
||||
v1.2 extends the spike to a real, simpler, better-documented platform that
|
||||
**deploys a microservice to ECS Fargate**:
|
||||
|
||||
- Six new IR-typed L1s: `l1-vpc`, `l1-ecs-cluster`, `l1-ecs-service`,
|
||||
`l1-iam-role`, `l1-alb`, `l1-ecr`.
|
||||
- One new L2 thin-composition: `l2-microservice` (references the six L1s).
|
||||
- `terraform apply` (dev, autonomous per §10, confidence ≥ 0.50) — real
|
||||
provisioning, not just `plan`.
|
||||
- A new consumer repo `acdl-consumer-microservice` with a basic HTTP
|
||||
container + Dockerfile + ECR push + contract submission.
|
||||
- One `scripts/run_platform.sh` (consolidated from the v1.1 spike scripts).
|
||||
- NFR hardening: least-privilege IAM (expanded for ECS), idempotent
|
||||
bootstrap, proper error handling, P1-1 redaction.
|
||||
|
||||
## How to run
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- AWS account + the rotated spike key in `.env.secrets` (see
|
||||
`scripts/rotate_spike_key.sh`; the bootstrap root key was deactivated
|
||||
per D-034 closure).
|
||||
- `terraform` (pin `1.9.*`), `checkov` (pin `>=3.2,<4`), `python3` + `boto3`
|
||||
+ `jsonschema`.
|
||||
|
||||
### Run the v1.1 spike end-to-end (v1.2 will consolidate to `run_platform.sh`)
|
||||
|
||||
```bash
|
||||
# 1. Bootstrap the AWS state backend + spike IAM user (one-time, idempotent)
|
||||
# (requires the bootstrap root key in env — now deactivated; skip if
|
||||
# the state bucket + acdl-spike-runner already exist)
|
||||
ACDL_BOOTSTRAP_AWS_ACCESS_KEY_ID=... ACDL_BOOTSTRAP_AWS_SECRET_ACCESS_KEY=... \
|
||||
python3 terraform/bootstrap/create_state_backend.py
|
||||
ACDL_BOOTSTRAP_AWS_ACCESS_KEY_ID=... ACDL_BOOTSTRAP_AWS_SECRET_ACCESS_KEY=... \
|
||||
python3 terraform/bootstrap/create_iam_user.py # prints the initial key
|
||||
|
||||
# 2. Rotate the spike key (writes .env.secrets, gitignored)
|
||||
ACDL_BOOTSTRAP_AWS_ACCESS_KEY_ID=... ACDL_BOOTSTRAP_AWS_SECRET_ACCESS_KEY=... \
|
||||
bash scripts/rotate_spike_key.sh
|
||||
|
||||
# 3. Run the full spike pipeline (contract -> IR -> plan -> Checkov ->
|
||||
# confidence -> outbox)
|
||||
bash scripts/run_spike_e2e.sh
|
||||
# Expected: "=== SPIKE E2E OK ==="
|
||||
|
||||
# Or plan-only:
|
||||
bash scripts/run_spike_plan.sh
|
||||
```
|
||||
|
||||
### Re-run the archived v1.0 demo (stubs only, no AWS)
|
||||
|
||||
```bash
|
||||
bash demo/scripts/run_demo.sh --no-upload
|
||||
```
|
||||
|
||||
The demo deck is at [`demo/ACDL_DEMO.md`](demo/ACDL_DEMO.md). The demo runs
|
||||
The demo deck is at [`demo/ACDL_DEMO.md`](demo/ACDL_DEMO.md). It runs
|
||||
entirely on local stubs — no AWS, no AI — and shows intent and safety
|
||||
behavior rather than provisioning real cloud resources. It is the reference
|
||||
of intent for the real platform; it is not the platform itself.
|
||||
behavior rather than provisioning real cloud resources.
|
||||
|
||||
## Repository layout
|
||||
|
||||
| Path | Purpose | Status |
|
||||
|------|---------|--------|
|
||||
| `acdl_platform/` | Platform code: confidence signal, contract resolver, outbox writer, HITL/ledger/SoD designs (renamed from `platform/` in Phase 08 to avoid shadowing the stdlib `platform` module) | v1.1 complete; v1.2 extends |
|
||||
| `schemas/` | JSON Schemas: IR, PolicyCheckResult, contract (draft 2020-12) | v1.1 complete; v1.2 extends contract schema |
|
||||
| `adapters/` | Substrate adapters — Terraform adapter (the only substrate-specific code per §12) + Checkov policy adapter | v1.1 complete; v1.2 expands `TYPE_MAP` |
|
||||
| `terraform/` | State backend (S3 + DynamoDB) + spike TF (`terraform/spike/`) + bootstrap scripts (`terraform/bootstrap/`) | v1.1 complete; v1.2 adds ECS apply |
|
||||
| `modules-ir/` | IR-typed L1/L2 modules + `registry.json`. v1.1: `l1-s3`, `l2-static-asset`. v1.2: + 6 ECS L1s, `l2-microservice` | v1.1 complete; v1.2 expands |
|
||||
| `contracts/` | Sample contracts (`spike.yaml` for `l2-static-asset`) | v1.1 complete; v1.2 adds `microservice.yaml` |
|
||||
| `scripts/` | Verify scripts (`verify_phaseNN.sh`), spike run scripts (`run_spike_*.sh` → `run_platform.sh` in v1.2), key rotation | v1.1 complete; v1.2 consolidates |
|
||||
| `demo/` | Archived v1.0 executive demo (tag `v1.1.0`); runs locally via `demo/scripts/run_demo.sh --no-upload` | complete (archived) |
|
||||
| `.ciagent/` | CIAgent metadata (config, project, architecture, requirements, roadmap, personas, plans, research, verify, review, audit) | active |
|
||||
| `docs/` | Upstream vision + architecture sources (`vision.md`, `architecture.md`) | active |
|
||||
|
||||
## Environments
|
||||
|
||||
| Environment | Autonomy | Gate | Status |
|
||||
|---|---|---|---|
|
||||
| dev | Full autonomy (no HITL) | Confidence ≥ 0.50 | v1.1 spike (`plan`); v1.2 (`apply`) |
|
||||
| qa | Held for attestation | QA HITL + confidence ≥ 0.75 | v1.3+ |
|
||||
| prod | Held for attestation | SRE HITL + confidence ≥ 0.90 | v1.3+ |
|
||||
| dr | Held for attestation | SRE HITL + confidence ≥ 0.95 + dr-drill | v1.3+ |
|
||||
|
||||
**Staging does not exist** (Path A locked).
|
||||
|
||||
## Credentials
|
||||
|
||||
**Long-lived AWS credentials are forbidden** (§12.5). The v1.1 spike uses a
|
||||
temporary long-lived key **once** to bootstrap (waiver D-034, now closed —
|
||||
the root key was deactivated by the user), then rotates the spike key
|
||||
per-run via `scripts/rotate_spike_key.sh` (waiver D-039, extended for v1.2
|
||||
as D-047). Real OIDC federation is deferred to v1.3+, blocked on
|
||||
[go-gitea/gitea#36988](https://github.com/go-gitea/gitea/pull/36988) (still
|
||||
open as of 2026-07-21).
|
||||
@@ -0,0 +1,103 @@
|
||||
# ACDL Tiered Audit Ledger Design (REQ-20)
|
||||
|
||||
> **Status:** design authored in Phase 07 (milestone v1.1); the spike
|
||||
> (Phases 08-10) implements the **v1.0 hash chain + DynamoDB outbox write**
|
||||
> (D-041); the v1.2 build-out implements S3 Object Lock + JWS + async
|
||||
> worker + DLQ + daily checkpoints.
|
||||
|
||||
The audit stream is the platform's tamper-evident record of every delivery
|
||||
action. The vision's "Audit truth lives outside the repository" bet [1]
|
||||
and "Not a mutable audit log" anti-goal [1] are the binding constraints.
|
||||
Version-control history does not satisfy regulatory evidence; the ledger
|
||||
is the source of truth.
|
||||
|
||||
## Three tiers
|
||||
|
||||
- **Cold tier (source of truth):** S3 with **Object Lock in compliance
|
||||
mode**, **7-year retention** (ARCHITECTURE.md §9). No one — including
|
||||
root — can delete or overwrite until retention expires. The regulatory
|
||||
record.
|
||||
- **Hot tier (query index):** the `acdl-evidence` audit repo (unchanged
|
||||
from the v1.0 demo). Not part of the chain; a queryable mirror the
|
||||
evidence UI (`evidence-ui/index.html`) reads. Lightweight attestation
|
||||
linkage lives in the repo; the regulatory event body lives in S3.
|
||||
- **Outbox (write path):** DynamoDB, **RPO = 0** (synchronous write before
|
||||
contract submission ack). Single-region in v1 (`us-east-1`).
|
||||
|
||||
## Spike scope (D-041) — what Phases 08-10 implement
|
||||
|
||||
- **DynamoDB outbox:** table `acdl-outbox`, `PAY_PER_REQUEST` (D-044),
|
||||
PK `contractId`, SK `eventType#eventTs`, TTL `expire_at` = now + 365d
|
||||
(1-year storage per ARCHITECTURE.md §8).
|
||||
- **`prev_event_hash` chain:** SHA-256 over canonical JSON
|
||||
(`json.dumps(event, sort_keys=True, separators=(",", ":"))`), lifted
|
||||
from the v1.0 demo's `evidence_writer.py`. Auto-genesis: first event
|
||||
has `prev_hash="GENESIS"`.
|
||||
- **Synchronous write** via boto3 `put_item` (strong-consistent by
|
||||
default). No separate async worker / DLQ in the spike (RTO = workflow
|
||||
re-run).
|
||||
- **Mirror to `acdl-evidence`:** unchanged from v1.0 — the finalize step
|
||||
commits `audit.json` to the evidence repo (the hot tier).
|
||||
- **Spike evidence event shape:**
|
||||
`{seq, ts, stage, event, prev_hash, hash, contractId, environment, stack, score, band}`.
|
||||
|
||||
## v1.2 build-out — what Phase 07 designs but the spike defers
|
||||
|
||||
- **S3 Object Lock:** bucket `acdl-evidence-lock-<account-id>`, Object
|
||||
Lock enabled at creation, compliance mode, 7-yr retention
|
||||
(`RetainUntilDate` = now + 7y). The outbox→S3 path is an async worker
|
||||
that reads from the outbox and writes to Object Lock.
|
||||
- **JWS detached signature (RFC 7515):** the event payload is
|
||||
canonical-JSON-serialized, SHA-256 hashed, signed with a private key;
|
||||
the signature is stored *detached* alongside the payload. Signing key =
|
||||
**platform-level KMS key** (not per-contract — a per-contract key would
|
||||
explode the key-management surface), rotated **quarterly**. The `jws`
|
||||
field is added to the event shape in v1.2.
|
||||
- **Async worker + DLQ:** a Lambda (or a Gitea Actions scheduled workflow)
|
||||
reads the outbox, writes to S3 Object Lock, signs with KMS. DLQ = an
|
||||
SQS dead-letter queue for failed writes. RTO = DLQ replay.
|
||||
- **Daily checkpoints (§9):** a daily job reads the last event hash and
|
||||
writes a "checkpoint" event to the ledger (+ optionally to a public
|
||||
notarization service). The spike runs in minutes, not days — no
|
||||
checkpoint in spike.
|
||||
|
||||
## JWS vs chain — orthogonality note
|
||||
|
||||
The `prev_event_hash` chain gives ordering/tamper-evidence *within* the
|
||||
log (a deleted event breaks the chain visibly); JWS gives authenticity
|
||||
*per event* (a forged event is detectable without re-reading the whole
|
||||
chain). The chain is spike-scope; JWS is v1.2. Together they cover both
|
||||
integrity properties the vision's "Not a mutable audit log" anti-goal
|
||||
requires.
|
||||
|
||||
## Outbox item shape (full, spike + v1.2)
|
||||
|
||||
- PK `contractId` (UUID).
|
||||
- SK `eventType#eventTs` (e.g. `POLICY_CHECKED#2026-07-21T12:00:00Z`).
|
||||
- `payload` (the event body — hash-chained in spike, JWS-signed in v1.2).
|
||||
- `prev_event_hash` (chain link; `GENESIS` for the first event).
|
||||
- `hash` (this event's SHA-256 over canonical JSON).
|
||||
- `approver_qa` (Gitea username of the QA approver; empty in dev-only
|
||||
spike; populated on qa-promotion — D-042).
|
||||
- `approver_prod` (SRE username; empty in spike).
|
||||
- `environment`, `stack`, `score`, `band`.
|
||||
- `expire_at` (TTL = now + 365d).
|
||||
- **v1.2 only:** `jws` (detached signature), `checkpoint_ref`.
|
||||
|
||||
## RPO / RTO table
|
||||
|
||||
| Phase | RPO | RTO |
|
||||
|-------|-----|-----|
|
||||
| Spike (D-041) | 0 (sync outbox write) | workflow re-run |
|
||||
| v1.2 | 0 (sync outbox) | async worker DLQ replay |
|
||||
|
||||
## Decision trail
|
||||
|
||||
- **D-041** — spike scope = hash chain + outbox write; Object Lock + JWS
|
||||
+ worker + DLQ are v1.2.
|
||||
- **D-044** — outbox mode `PAY_PER_REQUEST`; PK/SK; TTL `expire_at` =
|
||||
now + 365d; no separate async worker in spike.
|
||||
- **D-042** — approver identities (`approver_qa`, `approver_prod`) live
|
||||
in the outbox; the separation-of-duties check
|
||||
(`platform/separation_of_duties.py`) reads `approver_qa` and compares
|
||||
to the prod-dispatch `gitea.actor`.
|
||||
@@ -0,0 +1,175 @@
|
||||
"""ACDL Confidence Signal (REQ-19).
|
||||
|
||||
The platform's certified answer to "is this safe to proceed?" (vision
|
||||
tenet: "Safety is Computed, Not Assumed"). Every delivery action produces
|
||||
a measurable, explainable confidence signal; reliance on operator
|
||||
instinct is not a substitute.
|
||||
|
||||
Inputs (weights sum to 1.0, D-040):
|
||||
1. policy_results (0.30) — list[PolicyCheckResult] (schemas/policy_check_result.schema.json)
|
||||
2. validation (0.25) — {schema: bool, ir_resolved: bool, tf_validated: bool, tf_planned: bool}
|
||||
3. freshness (0.10) — {age_days: float, max_age_days: float}
|
||||
4. source (0.15) — {submitter: str, commit_sha: str, signed: bool}
|
||||
5. history (0.10) — {prior_rollbacks: int, prior_policy_fails: int}
|
||||
6. nfrs (0.10) — {declared: list[str], conformance: float|None}
|
||||
|
||||
Severity -> penalty (locked, ARCHITECTURE.md §8):
|
||||
critical -> hard override (score = 0, block)
|
||||
high -> -0.20
|
||||
medium -> -0.05
|
||||
low -> -0.01
|
||||
info -> 0.00
|
||||
|
||||
Per-env thresholds (locked, ARCHITECTURE.md §8): dev 0.50, qa 0.75, prod 0.90, dr 0.95.
|
||||
Output: {score, band, perInput, reasonCodes}.
|
||||
Halt with explicit reason on missing input (§8).
|
||||
|
||||
Spike cold-start (A-6.2): inputs 3 (freshness), 5 (history), 6 (nfrs) are
|
||||
'present + neutral 0.5' because the spike is the first submission with no
|
||||
history and no declared NFRs. The gate is *presence*, not *conformance* —
|
||||
the 'all six inputs present' dev gate (§5) is satisfied by non-null
|
||||
per-input scores.
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass, asdict
|
||||
from typing import List, Literal, Optional, Dict, Any
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
WEIGHTS = {
|
||||
"policy": 0.30,
|
||||
"validation": 0.25,
|
||||
"freshness": 0.10,
|
||||
"source": 0.15,
|
||||
"history": 0.10,
|
||||
"nfrs": 0.10,
|
||||
}
|
||||
|
||||
PENALTY = {
|
||||
"critical": None,
|
||||
"high": 0.20,
|
||||
"medium": 0.05,
|
||||
"low": 0.01,
|
||||
"info": 0.0,
|
||||
}
|
||||
|
||||
THRESHOLDS = {"dev": 0.50, "qa": 0.75, "prod": 0.90, "dr": 0.95}
|
||||
|
||||
|
||||
@dataclass
|
||||
class Signal:
|
||||
score: float
|
||||
band: Literal["pass", "warn", "block"]
|
||||
perInput: Dict[str, float]
|
||||
reasonCodes: List[str]
|
||||
|
||||
|
||||
def _per_input_score(name: str, raw: Any) -> tuple:
|
||||
"""Return (score in [0,1], reasons list). Unknown/missing -> 0.5 + INPUT_MISSING."""
|
||||
reasons: List[str] = []
|
||||
if raw is None:
|
||||
return 0.5, [f"INPUT_MISSING:{name}"]
|
||||
if name == "policy":
|
||||
pcrs = raw if isinstance(raw, list) else []
|
||||
if not pcrs:
|
||||
return 0.5, []
|
||||
scores = []
|
||||
for pcr in pcrs:
|
||||
r = pcr.get("result", "skipped")
|
||||
if r == "pass" or r == "skipped":
|
||||
scores.append(1.0)
|
||||
else:
|
||||
scores.append(0.0)
|
||||
return sum(scores) / len(scores), []
|
||||
if name == "validation":
|
||||
keys = ("schema", "ir_resolved", "tf_validated", "tf_planned")
|
||||
if not isinstance(raw, dict):
|
||||
return 0.5, []
|
||||
trues = sum(1 for k in keys if raw.get(k))
|
||||
return trues / 4.0, []
|
||||
if name == "freshness":
|
||||
if not isinstance(raw, dict):
|
||||
return 0.5, []
|
||||
age = float(raw.get("age_days", 0))
|
||||
mx = float(raw.get("max_age_days", 1)) or 1
|
||||
s = 1.0 - (age / mx)
|
||||
return max(0.0, min(1.0, s)), []
|
||||
if name == "source":
|
||||
if not isinstance(raw, dict):
|
||||
return 0.5, []
|
||||
if raw.get("submitter") and raw.get("commit_sha"):
|
||||
return 1.0, []
|
||||
return 0.5, []
|
||||
if name == "history":
|
||||
if not isinstance(raw, dict):
|
||||
return 0.5, []
|
||||
rollbacks = int(raw.get("prior_rollbacks", 0))
|
||||
fails = int(raw.get("prior_policy_fails", 0))
|
||||
s = 1.0 - (rollbacks * 0.2 + fails * 0.1)
|
||||
return max(0.0, min(1.0, s)), []
|
||||
if name == "nfrs":
|
||||
if not isinstance(raw, dict):
|
||||
return 0.5, []
|
||||
conf = raw.get("conformance")
|
||||
if conf is None:
|
||||
return 0.5, []
|
||||
return float(conf), []
|
||||
return 0.5, []
|
||||
|
||||
|
||||
def compute(contract_id: str, environment: str,
|
||||
inputs: Dict[str, Any]) -> Signal:
|
||||
"""Orchestrate the 6-input weighted sum + severity penalty + band."""
|
||||
missing = sorted(set(WEIGHTS.keys()) - set(inputs.keys()))
|
||||
if missing:
|
||||
return Signal(0.0, "block", {},
|
||||
[f"INPUT_MISSING:{m}" for m in missing])
|
||||
|
||||
per_input: Dict[str, float] = {}
|
||||
reasons: List[str] = []
|
||||
base = 0.0
|
||||
for name, weight in WEIGHTS.items():
|
||||
raw = inputs.get(name)
|
||||
s, r = _per_input_score(name, raw)
|
||||
per_input[name] = s
|
||||
reasons.extend(r)
|
||||
base += s * weight
|
||||
|
||||
penalty = 0.0
|
||||
policy_input = inputs.get("policy")
|
||||
pcrs = policy_input if isinstance(policy_input, list) else []
|
||||
for pcr in pcrs:
|
||||
if not isinstance(pcr, dict):
|
||||
continue
|
||||
if pcr.get("result") != "fail":
|
||||
continue
|
||||
sev = pcr.get("severity")
|
||||
p = PENALTY.get(sev, 0.0)
|
||||
if p is None:
|
||||
return Signal(0.0, "block", per_input,
|
||||
reasons + [f"CRITICAL_OVERRIDE:{pcr.get('ruleId','?')}"])
|
||||
penalty += p
|
||||
|
||||
score = max(0.0, min(1.0, base - penalty))
|
||||
threshold = THRESHOLDS[environment]
|
||||
if score >= threshold:
|
||||
band = "pass"
|
||||
elif score < threshold - 0.10:
|
||||
band = "block"
|
||||
else:
|
||||
band = "warn"
|
||||
if environment == "dev" and band == "warn":
|
||||
band = "block"
|
||||
return Signal(score, band, per_input, reasons)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 3:
|
||||
print("usage: confidence_signal.py <inputs.json> <environment>", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
env = sys.argv[2]
|
||||
with open(sys.argv[1], "r", encoding="utf-8") as fh:
|
||||
inputs = json.load(fh)
|
||||
sig = compute("cli", env, inputs)
|
||||
print(json.dumps(asdict(sig), indent=2))
|
||||
@@ -0,0 +1,119 @@
|
||||
"""ACDL Contract Resolver — resolve a contract to a Target Stack IR instance.
|
||||
|
||||
ARCHITECTURE.md §12.8: the contract declares intent in IR-typed terms;
|
||||
the resolver resolves the contract to a target stack (list of L1
|
||||
instances + inputs + relationships); the adapter compiles the target
|
||||
stack to a plan.
|
||||
|
||||
Steps:
|
||||
1. Load the contract (YAML -> dict).
|
||||
2. Validate the contract against schemas/contract.schema.json.
|
||||
3. Look up the L2 in modules-ir/registry.json.
|
||||
4. Load the L2's composition.json (the thin-composition tree).
|
||||
5. Map the contract's inputs through the composition's wires to the
|
||||
child L1's inputs.
|
||||
6. Emit an IR instance {version, stack:{name, kind:l2, depth},
|
||||
resources:[<L1 instances with concrete inputs>], relationships:[...]}.
|
||||
7. Validate the IR instance against schemas/ir.schema.json.
|
||||
|
||||
CLI: contract_resolver.py <contract.yaml> <out_ir.json>
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
import yaml
|
||||
import jsonschema
|
||||
|
||||
|
||||
REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
def _load_json(path):
|
||||
with open(path, "r") as fh:
|
||||
return json.load(fh)
|
||||
|
||||
|
||||
def resolve(contract_path, repo_root=None):
|
||||
"""Resolve a contract YAML to an IR instance dict."""
|
||||
rr = repo_root or REPO_ROOT
|
||||
|
||||
# 1. Load the contract YAML.
|
||||
with open(contract_path, "r") as fh:
|
||||
contract = yaml.safe_load(fh)
|
||||
|
||||
# 2. Validate the contract against the contract schema.
|
||||
contract_schema = _load_json(os.path.join(rr, "schemas/contract.schema.json"))
|
||||
jsonschema.validate(contract, contract_schema)
|
||||
|
||||
# 3. Look up the L2 in the registry.
|
||||
stack_name = contract["stack"]
|
||||
registry = _load_json(os.path.join(rr, "modules-ir/registry.json"))
|
||||
if stack_name not in registry:
|
||||
raise ValueError(f"stack {stack_name!r} not in registry")
|
||||
versions = registry[stack_name]
|
||||
# Pick the highest 1.x.x (spike: just take the first non-deprecated).
|
||||
entry = next(v for v in versions.values() if not v.get("deprecated", False))
|
||||
|
||||
# 4. Load the L2's composition.json.
|
||||
composition_key = entry.get("composition") or entry.get("interface")
|
||||
composition = _load_json(os.path.join(rr, composition_key))
|
||||
|
||||
# 5. Map the contract's inputs through the wires to the child L1's inputs.
|
||||
wires = composition.get("wires", {})
|
||||
contract_inputs = contract.get("inputs", {})
|
||||
children = composition.get("children", [])
|
||||
|
||||
resources = []
|
||||
relationships = []
|
||||
for child in children:
|
||||
child_id = child["id"]
|
||||
child_module = child["module"] # e.g. l1-s3@1.0.0
|
||||
# Map inputs via wires whose target is this child.
|
||||
child_inputs = {}
|
||||
for wire_name, wire in wires.items():
|
||||
if wire.get("target") == child_id and wire_name in contract_inputs:
|
||||
child_inputs[wire["input"]] = contract_inputs[wire_name]
|
||||
# Load the L1 interface to get the IR type + outputs.
|
||||
l1_name, l1_version = child_module.split("@", 1)
|
||||
l1_entry = registry.get(l1_name, {}).get(l1_version)
|
||||
if not l1_entry:
|
||||
raise ValueError(f"L1 {child_module!r} not in registry")
|
||||
l1_iface = _load_json(os.path.join(rr, l1_entry["interface"]))
|
||||
resources.append({
|
||||
"id": child_id,
|
||||
"type": l1_iface["type"],
|
||||
"module": child_module,
|
||||
"inputs": child_inputs,
|
||||
"outputs": l1_iface.get("outputs", {}),
|
||||
})
|
||||
relationships.append({"from": "root", "to": child_id, "kind": "parent"})
|
||||
|
||||
# 6. Emit the IR instance.
|
||||
ir_instance = {
|
||||
"version": "1.0.0",
|
||||
"stack": {
|
||||
"name": composition["name"],
|
||||
"kind": composition["kind"],
|
||||
"depth": composition["depth"],
|
||||
},
|
||||
"resources": resources,
|
||||
"relationships": relationships,
|
||||
}
|
||||
|
||||
# 7. Validate the IR instance against the IR schema.
|
||||
ir_schema = _load_json(os.path.join(rr, "schemas/ir.schema.json"))
|
||||
jsonschema.validate(ir_instance, ir_schema)
|
||||
|
||||
return ir_instance
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 3:
|
||||
print("usage: contract_resolver.py <contract.yaml> <out_ir.json>", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
ir = resolve(sys.argv[1])
|
||||
with open(sys.argv[2], "w") as fh:
|
||||
json.dump(ir, fh, indent=2)
|
||||
print(f"resolver: emitted IR to {sys.argv[2]}", file=sys.stderr)
|
||||
@@ -0,0 +1,115 @@
|
||||
# ACDL Human-in-the-Loop Matrix + Separation-of-Duties Design (REQ-21)
|
||||
|
||||
> **Status:** design authored in Phase 07 (milestone v1.1); v1.2 wires the
|
||||
> gates. The spike (Phases 08-10) is **dev-only**; HITL is not exercised
|
||||
> (the spike contract has `environment: dev`).
|
||||
|
||||
The vision's "Lower Environments are Autonomous; Higher Environments are
|
||||
Attested" tenet [1] and the "deliberate human attestation — not as a
|
||||
rubber stamp" requirement [1] are the binding constraints.
|
||||
|
||||
## Gate model (ARCHITECTURE.md §10.1)
|
||||
|
||||
**Pre-execution gates.** The contract is held in a "validated but not
|
||||
applied" state until the human attests. qa, prod, dr are attestation
|
||||
gates. No partial deployment to roll back on rejection (qa, prod); dr is
|
||||
a separate deployment against a separate cluster/region. The
|
||||
canary/deployment-rollback model is explicitly not in scope for v1.
|
||||
|
||||
## Gitea-specific gate mechanics (D-042)
|
||||
|
||||
Gitea has **no Environments API** and ignores `environment:` blocks
|
||||
(v1.0 D-013; re-confirmed in RESEARCH TARGET 1). The pre-execution gate
|
||||
is modeled as a `workflow_dispatch` with approval inputs:
|
||||
|
||||
- **qa gate:** `workflow_dispatch` with `approve_qa: true`; the dispatch
|
||||
run's `gitea.actor` is the QA approver.
|
||||
- **prod gate:** `workflow_dispatch` with `approve_prod: true`;
|
||||
`gitea.actor` is the SRE approver.
|
||||
- **dr gate:** `workflow_dispatch` with `approve_dr: true`; same.
|
||||
|
||||
The approver identity of record = `gitea.actor` of the dispatch run
|
||||
(D-042). There is no other approval-identity signal in Gitea. The v1.2
|
||||
real-OIDC path (blocked on go-gitea/gitea#36988) does not change this —
|
||||
OIDC authorizes the *runner* to AWS, it does not change how the platform
|
||||
records the *human* approver.
|
||||
|
||||
## Reviewer routing (ARCHITECTURE.md §10.2)
|
||||
|
||||
Gitea CODEOWNERS routes the right reviewer to the right gate:
|
||||
|
||||
- qa → QA team
|
||||
- prod → SRE team
|
||||
- dr → SRE team
|
||||
|
||||
CODEOWNERS **routes**; it does **not** enforce identity distinctness (that
|
||||
is the platform-internal outbox check in
|
||||
`platform/separation_of_duties.py`).
|
||||
|
||||
## Full 8-concern attestation matrix (§10.4, lifted verbatim)
|
||||
|
||||
| Env | Concern | Evidence artifact | Freshness | Source | Attester |
|
||||
|---|---|---|---|---|---|
|
||||
| qa | Functional correctness | Last successful run of contract-declared validation.e2eSuite with pass rate ≥ 99% | Last 24h | Test runner declared in contract | QA |
|
||||
| qa | Performance baseline | Load test report (k6 / Gatling / Locust) showing p99 latency < declared NFR and throughput > declared minimum | Last 7d | Load test runner declared in contract | QA |
|
||||
| qa | Security posture | Vulnerability scan (Trivy, Snyk, or contract-declared equivalent) with no criticals/highs, signed by Security on-call | Last 24h | Security scanner + Security team signature | QA |
|
||||
| qa | Contract NFRs | Platform-generated report: schema valid, NFR assertions (latency, throughput, error rate) within declared bounds | At submission | Platform contract validator | QA |
|
||||
| prod | Operational readiness | Runbook published, dashboard exists, on-call rotation assigned, alerts configured | At submission, validated against last 30d history | Platform + SRE | SRE |
|
||||
| prod | Incident response | Sev-1 runbook tabletop or live drill completed | Last 90d | SRE drill record | SRE |
|
||||
| prod | Capacity / cost | FinOps forecast for next 30d within budget envelope, cost anomaly baseline stored, budget alert configured | Forecast valid for next 30d | FinOps + SRE | SRE |
|
||||
| prod | Resilience | DR drill, chaos engineering report, backup verified | DR: 180d; chaos: 90d; backup: 30d | SRE + Platform | SRE |
|
||||
| dr | dr-region deploy with the most recent prod-bound dr drill as canary evidence | dr drill report | Last 180d | SRE | SRE |
|
||||
|
||||
## Timeout behavior (§10.5)
|
||||
|
||||
| Time | State | Action |
|
||||
|---|---|---|
|
||||
| Submission | PENDING_ATTESTATION | Notify responsible team |
|
||||
| 1 business day | PENDING_ATTESTATION_WARNING | Notify team + platform on-call (elevated path); emit `PENDING_ATTESTATION_TIMEOUT_WARNING` event |
|
||||
| 2 business days | PENDING_ATTESTATION_AUTO_FREEZE | Auto-freeze; require re-submission; emit `PENDING_ATTESTATION_AUTO_FREEZE` event; new submission linked via `supersedes` |
|
||||
|
||||
**Implementation:** a Gitea `on: schedule` workflow (runs hourly) that
|
||||
scans the DynamoDB outbox for `PENDING_ATTESTATION` events with `ts`
|
||||
older than 1/2 business days and emits the warn/freeze events. Not
|
||||
implemented in the spike (dev-only).
|
||||
|
||||
## Rejection and rollback (§10.6)
|
||||
|
||||
Rejection returns the contract to a `HELD` state with the rejection
|
||||
reason captured as a `PROMOTION_REJECTED` event. The consumer fixes the
|
||||
cause and re-submits; the new submission is linked to the rejected one
|
||||
via `supersedes` (a contract-schema field — `schemas/contract.schema.json`).
|
||||
The audit chain is **extended, not torn up** (the "Not a mutable audit
|
||||
log" anti-goal). No partial deployment to roll back at any v1 gate.
|
||||
|
||||
## Separation of duties (§10.3) — pointer to the .py
|
||||
|
||||
The identity-distinctness check is platform-internal, not GitHub-native,
|
||||
not Kyverno (in v1). Sequence:
|
||||
|
||||
1. On promotion dev → qa, the platform reads the QA approver's identity
|
||||
from the `workflow_dispatch` run's `gitea.actor` and writes it to the
|
||||
DynamoDB outbox keyed by `contractId` (attribute `approver_qa`).
|
||||
2. On promotion qa → prod, the platform reads the stored `approver_qa`
|
||||
from the outbox and the new SRE approver's `gitea.actor` from the
|
||||
prod-dispatch run.
|
||||
3. If `approver_qa == approver_prod`, the platform blocks the prod
|
||||
promotion, writes a `SEPARATION_OF_DUTIES_VIOLATION` event to the
|
||||
evidence stream, and routes a halt artifact to the SRE on-call.
|
||||
4. The check is implemented in `platform/separation_of_duties.py`
|
||||
(T-7.8). The platform is the only writer to the outbox; the check is
|
||||
in the same process that has authority to block the promotion.
|
||||
|
||||
## Spike scope note
|
||||
|
||||
The spike is dev-only (REQ-27 contract has `environment: dev`), so HITL
|
||||
is not exercised. Phase 07 authors the design; Phase 10's
|
||||
`verify_phase10.sh` does not assert HITL behavior. v1.2 wires the gates
|
||||
against this design.
|
||||
|
||||
## Decision trail
|
||||
|
||||
- **D-042** — approver identity = `gitea.actor` of the `workflow_dispatch`
|
||||
run; no Environments API in Gitea.
|
||||
- **D-013** (v1.0) — the `workflow_dispatch` approval-input fallback,
|
||||
re-used for the real platform's pre-execution gate model.
|
||||
@@ -0,0 +1,71 @@
|
||||
"""ACDL Outbox Writer — write an evidence event to the DynamoDB outbox.
|
||||
|
||||
ARCHITECTURE.md §9: DynamoDB outbox, RPO=0 (synchronous write before
|
||||
ack). The event is hash-chained (SHA-256 over canonical JSON); the first
|
||||
event has prev_event_hash="GENESIS". D-P10-3: the spike writes ONE
|
||||
CONFIDENCE_COMPUTED event.
|
||||
|
||||
The outbox table (Phase 08): acdl-outbox, PAY_PER_REQUEST, PK contractId,
|
||||
SK eventType#eventTs, TTL expire_at = now + 365d (D-044).
|
||||
|
||||
CLI: outbox_writer.py <event.json> (uses AWS creds from env)
|
||||
"""
|
||||
|
||||
import datetime
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
import boto3
|
||||
|
||||
|
||||
OUTBOX_TABLE = "acdl-outbox"
|
||||
REGION = os.environ.get("AWS_DEFAULT_REGION", "us-east-1")
|
||||
|
||||
|
||||
def _canonical_hash(event):
|
||||
"""SHA-256 over canonical JSON (sort_keys, compact separators)."""
|
||||
canonical = json.dumps(event, sort_keys=True, separators=(",", ":"))
|
||||
return hashlib.sha256(canonical.encode("utf-8")).hexdigest()
|
||||
|
||||
|
||||
def write_event(event, outbox_table=OUTBOX_TABLE, region=REGION):
|
||||
"""Write an evidence event to the DynamoDB outbox. Returns the item dict."""
|
||||
contract_id = event["contractId"]
|
||||
event_type = event.get("eventType", "CONFIDENCE_COMPUTED")
|
||||
event_ts = event.get("ts") or datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
sk = f"{event_type}#{event_ts}"
|
||||
|
||||
# Chain: first event = GENESIS (D-P10-3 spike writes one event).
|
||||
prev_hash = event.get("prev_event_hash", "GENESIS")
|
||||
event_hash = _canonical_hash(event)
|
||||
|
||||
item = {
|
||||
"contractId": {"S": contract_id},
|
||||
"eventType#eventTs": {"S": sk},
|
||||
"payload": {"S": json.dumps(event, sort_keys=True)},
|
||||
"prev_event_hash": {"S": prev_hash},
|
||||
"hash": {"S": event_hash},
|
||||
"environment": {"S": str(event.get("environment", ""))},
|
||||
"stack": {"S": str(event.get("stack", ""))},
|
||||
"score": {"N": str(event.get("score", 0))},
|
||||
"band": {"S": str(event.get("band", ""))},
|
||||
"expire_at": {"N": str(int((datetime.datetime.now(datetime.timezone.utc) +
|
||||
datetime.timedelta(days=365)).timestamp()))},
|
||||
}
|
||||
|
||||
session = boto3.Session(region_name=region)
|
||||
dyn = session.client("dynamodb")
|
||||
dyn.put_item(TableName=outbox_table, Item=item)
|
||||
return item
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 2:
|
||||
print("usage: outbox_writer.py <event.json>", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
with open(sys.argv[1], "r") as fh:
|
||||
event = json.load(fh)
|
||||
item = write_event(event)
|
||||
print(json.dumps({k: list(v.values())[0] for k, v in item.items()}, indent=2))
|
||||
@@ -0,0 +1,42 @@
|
||||
"""Check that qaApprover != prodApprover for a contract (ARCHITECTURE.md
|
||||
§10.3, D-042). Reads `approver_qa` from the DynamoDB outbox for the
|
||||
contractId, compares to the prod-dispatch `gitea.actor`. Blocks on
|
||||
equality, emits `SEPARATION_OF_DUTIES_VIOLATION`, routes a halt artifact
|
||||
to SRE on-call.
|
||||
|
||||
Spike scope (A-8.1): the spike is dev-only (REQ-27 contract has
|
||||
environment: dev); HITL is not exercised. This module is authored to its
|
||||
full v1.2 shape but the spike calls it with current_prod_approver=None
|
||||
and a None outbox_client — the check returns (True, 'no QA approver
|
||||
recorded (dev-only spike)').
|
||||
"""
|
||||
|
||||
from typing import Optional, Tuple
|
||||
|
||||
|
||||
def check(outbox_client, contract_id: str,
|
||||
current_prod_approver: Optional[str]) -> Tuple[bool, str]:
|
||||
"""Return (ok, reason). ok=False means block the prod promotion."""
|
||||
if outbox_client is None:
|
||||
return (True, "no outbox client (dev-only spike)")
|
||||
item = outbox_client.get(contract_id)
|
||||
if item is None:
|
||||
return (True, "no prior approver (first promotion)")
|
||||
qa_approver = item.get("approver_qa")
|
||||
if not qa_approver:
|
||||
return (True, "no QA approver recorded (dev-only spike)")
|
||||
if current_prod_approver is None:
|
||||
return (True, "no prod approver supplied (dev-only spike)")
|
||||
if qa_approver == current_prod_approver:
|
||||
return (False,
|
||||
f"SEPARATION_OF_DUTIES_VIOLATION: "
|
||||
f"qaApprover==prodApprover=={qa_approver}")
|
||||
return (True, "distinct")
|
||||
|
||||
|
||||
def route_halt_artifact(contract_id: str, violation_reason: str,
|
||||
oncall_client) -> None:
|
||||
"""Route a halt artifact to SRE on-call. Spike: stub that logs. v1.2
|
||||
wires a real pager."""
|
||||
print(f"[halt-artifact] contract={contract_id} reason={violation_reason} "
|
||||
f"oncall={oncall_client}", flush=True)
|
||||
@@ -0,0 +1,133 @@
|
||||
"""ACDL Terraform adapter — compile a Target Stack IR instance to Terraform.
|
||||
|
||||
ARCHITECTURE.md §12.2: the adapter translates the IR-typed L1 interface
|
||||
to a Terraform variable/output block, the L2 thin-composition tree to a
|
||||
root module that calls the L1 modules, the IR-typed relationships to
|
||||
Terraform module references, and emits a Terraform plan from the IR.
|
||||
|
||||
The adapter is a THIN LAYER; it does not own L1/L2 content — it only
|
||||
translates. Substrate-agnostic in, Terraform out.
|
||||
|
||||
Spike scope (Phase 09): handles one L1 (l1-s3, IR type aws:s3:bucket).
|
||||
L2 thin-composition + relationships land in Phase 10.
|
||||
|
||||
CLI: adapter.py <ir_instance.json> <out_dir>
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
# IR type -> Terraform resource type. The only substrate-specific table.
|
||||
# As more L1s land, this grows; the L1 content + IR do not change.
|
||||
TYPE_MAP = {
|
||||
"aws:s3:bucket": "aws_s3_bucket",
|
||||
}
|
||||
|
||||
|
||||
def _tf_block(block_type, name, body_lines, indent=2):
|
||||
head = f'{block_type} "{name}" {{'
|
||||
body = "\n".join(f" {l}" for l in body_lines)
|
||||
return f"{head}\n{body}\n}}\n"
|
||||
|
||||
|
||||
def _emit_resource(resource):
|
||||
rtype = resource["type"]
|
||||
rid = resource["id"]
|
||||
tf_type = TYPE_MAP.get(rtype)
|
||||
if not tf_type:
|
||||
raise ValueError(f"unknown IR type {rtype!r} (adapter spike handles aws:s3:bucket only)")
|
||||
body = []
|
||||
inputs = resource.get("inputs", {})
|
||||
# S3 bucket: bucket_name -> bucket arg; region -> provider (handled separately)
|
||||
if "bucket_name" in inputs:
|
||||
body.append(f'bucket = "{inputs["bucket_name"]}"')
|
||||
# NFR: versioning (default true)
|
||||
nfrs = resource.get("nfrs", {})
|
||||
versioning = nfrs.get("versioning", True) if isinstance(nfrs, dict) else True
|
||||
body.append("versioning {")
|
||||
body.append(f' enabled = {"true" if versioning else "false"}')
|
||||
body.append("}")
|
||||
return _tf_block("resource", f'aws_s3_bucket.{rid}', body) if False else _resource_block(rid, tf_type, body)
|
||||
|
||||
|
||||
def _resource_block(rid, tf_type, body):
|
||||
"""Emit a top-level resource block."""
|
||||
head = f'resource "{tf_type}" "{rid}" {{'
|
||||
body_str = "\n".join(f" {l}" for l in body)
|
||||
return f"{head}\n{body_str}\n}}\n"
|
||||
|
||||
|
||||
def _emit_output(output_name, value_expr):
|
||||
return f'output "{output_name}" {{\n value = {value_expr}\n}}\n'
|
||||
|
||||
|
||||
def adapt(ir_instance, out_dir):
|
||||
"""Emit main.tf + terraform.tf + providers.tf to out_dir for the IR instance."""
|
||||
os.makedirs(out_dir, exist_ok=True)
|
||||
stack = ir_instance["stack"]
|
||||
resources = ir_instance["resources"]
|
||||
|
||||
# --- providers.tf: aws provider, region from the first resource's inputs.region ---
|
||||
region = "us-east-1"
|
||||
for r in resources:
|
||||
if "region" in r.get("inputs", {}):
|
||||
region = r["inputs"]["region"]
|
||||
break
|
||||
providers_tf = (
|
||||
f'provider "aws" {{\n'
|
||||
f' region = "{region}"\n'
|
||||
f'}}\n'
|
||||
)
|
||||
|
||||
# --- terraform.tf: required_version + required_providers + S3 backend (no DynamoDB lock per D-P09-1) ---
|
||||
# The backend key is derived from the stack name so l1 vs l2 spikes use separate state keys (D-P10-1).
|
||||
stack_name = stack.get("name", "spike")
|
||||
terraform_tf = (
|
||||
'terraform {\n'
|
||||
' required_version = ">= 1.9, < 1.10"\n'
|
||||
' required_providers {\n'
|
||||
' aws = {\n'
|
||||
' source = "hashicorp/aws"\n'
|
||||
' version = "~> 5.0"\n'
|
||||
' }\n'
|
||||
' }\n'
|
||||
' backend "s3" {\n'
|
||||
' bucket = "acdl-tfstate-581513795199-us-east-1"\n'
|
||||
f' key = "spike/{stack_name}/terraform.tfstate"\n'
|
||||
' region = "us-east-1"\n'
|
||||
' }\n'
|
||||
'}\n'
|
||||
)
|
||||
|
||||
# --- main.tf: resources + outputs ---
|
||||
main_tf_parts = []
|
||||
for r in resources:
|
||||
main_tf_parts.append(_emit_resource(r))
|
||||
rid = r["id"]
|
||||
outputs = r.get("outputs", {})
|
||||
for out_name in outputs:
|
||||
if out_name == "bucket_arn":
|
||||
main_tf_parts.append(_emit_output("bucket_arn", f"aws_s3_bucket.{rid}.arn"))
|
||||
elif out_name == "bucket_name":
|
||||
main_tf_parts.append(_emit_output("bucket_name", f"aws_s3_bucket.{rid}.id"))
|
||||
main_tf = "\n".join(main_tf_parts)
|
||||
|
||||
with open(os.path.join(out_dir, "main.tf"), "w") as fh:
|
||||
fh.write(main_tf)
|
||||
with open(os.path.join(out_dir, "terraform.tf"), "w") as fh:
|
||||
fh.write(terraform_tf)
|
||||
with open(os.path.join(out_dir, "providers.tf"), "w") as fh:
|
||||
fh.write(providers_tf)
|
||||
return out_dir
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 3:
|
||||
print("usage: adapter.py <ir_instance.json> <out_dir>", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
with open(sys.argv[1], "r") as fh:
|
||||
ir = json.load(fh)
|
||||
adapt(ir, sys.argv[2])
|
||||
print(f"adapter: emitted terraform to {sys.argv[2]}", file=sys.stderr)
|
||||
@@ -0,0 +1,99 @@
|
||||
"""Translate Checkov JSON output to ACDL PolicyCheckResult records.
|
||||
|
||||
Reads Checkov's JSON output (one framework key, e.g. terraform_plan),
|
||||
emits a list of PolicyCheckResult dicts conforming to
|
||||
schemas/policy_check_result.schema.json. Run Checkov with --soft-fail so
|
||||
Checkov never exits non-zero; the confidence signal decides the gate, not
|
||||
Checkov's exit code.
|
||||
|
||||
Spike scope (D-043): tag/naming is a single SKIPPED record. A custom
|
||||
Checkov YAML rule for tag presence lands in v1.2.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
RULE_MAP = {
|
||||
"CKV_AWS_41": ("secrets-in-plaintext", "high"),
|
||||
"CKV_AWS_45": ("secrets-in-plaintext", "high"),
|
||||
"CKV_AWS_46": ("secrets-in-plaintext", "high"),
|
||||
"CKV_AWS_20": ("public-ingress", "high"),
|
||||
"CKV_AWS_57": ("public-ingress", "high"),
|
||||
"CKV_AWS_24": ("public-ingress", "medium"),
|
||||
"CKV_AWS_25": ("public-ingress", "medium"),
|
||||
"CKV_AWS_1": ("iam-wildcard", "high"),
|
||||
"CKV_AWS_40": ("iam-wildcard", "medium"),
|
||||
"CKV_AWS_7": ("kms-key-reference", "medium"),
|
||||
"CKV_AWS_33": ("kms-key-reference", "medium"),
|
||||
}
|
||||
|
||||
_RESULT_MAP = {"PASSED": "pass", "FAILED": "fail", "SKIPPED": "skipped"}
|
||||
|
||||
|
||||
def _iso8601_now():
|
||||
return datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
|
||||
def _to_pcr(checkov_record, contract_id, result_str):
|
||||
check_id = checkov_record.get("check_id", "")
|
||||
default_sev = RULE_MAP.get(check_id, (check_id, "info"))[1]
|
||||
severity = checkov_record.get("severity", default_sev)
|
||||
if isinstance(severity, str):
|
||||
severity = severity.lower()
|
||||
return {
|
||||
"contractId": contract_id,
|
||||
"evaluatedAt": _iso8601_now(),
|
||||
"engine": "checkov",
|
||||
"ruleId": check_id,
|
||||
"severity": severity,
|
||||
"result": _RESULT_MAP.get(result_str, "error"),
|
||||
"message": checkov_record.get("check_name", ""),
|
||||
"evidence": {
|
||||
"file_path": checkov_record.get("file_path"),
|
||||
"resource": checkov_record.get("resource"),
|
||||
"resource_address": checkov_record.get("resource_address"),
|
||||
"code_block": checkov_record.get("code_block"),
|
||||
},
|
||||
"resourceRef": checkov_record.get("resource_address") or checkov_record.get("resource", ""),
|
||||
}
|
||||
|
||||
|
||||
def _emit_tag_naming_skipped(contract_id):
|
||||
return {
|
||||
"contractId": contract_id,
|
||||
"evaluatedAt": _iso8601_now(),
|
||||
"engine": "checkov",
|
||||
"ruleId": "ACDL_TAG_NAMING",
|
||||
"severity": "info",
|
||||
"result": "skipped",
|
||||
"message": "tag/naming check deferred to v1.2 (D-043)",
|
||||
"evidence": {},
|
||||
"resourceRef": "",
|
||||
}
|
||||
|
||||
|
||||
def adapt(checkov_json_path, contract_id):
|
||||
with open(checkov_json_path, "r", encoding="utf-8") as fh:
|
||||
data = json.load(fh)
|
||||
out = []
|
||||
for framework, body in data.items():
|
||||
results = body.get("results", body) if isinstance(body, dict) else {}
|
||||
if not isinstance(results, dict):
|
||||
continue
|
||||
for rec in results.get("passed_checks", []):
|
||||
out.append(_to_pcr(rec, contract_id, "PASSED"))
|
||||
for rec in results.get("failed_checks", []):
|
||||
out.append(_to_pcr(rec, contract_id, "FAILED"))
|
||||
for rec in results.get("skipped_checks", []):
|
||||
out.append(_to_pcr(rec, contract_id, "SKIPPED"))
|
||||
out.append(_emit_tag_naming_skipped(contract_id))
|
||||
return out
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 3:
|
||||
print("usage: checkov_adapter.py <checkov.json> <contract-id>", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
print(json.dumps(adapt(sys.argv[1], sys.argv[2]), indent=2))
|
||||
@@ -0,0 +1,5 @@
|
||||
stack: l2-static-asset
|
||||
environment: dev
|
||||
inputs:
|
||||
bucket_name: acdl-spike-bucket
|
||||
region: us-east-1
|
||||
@@ -0,0 +1,458 @@
|
||||
# Architecture Document v1.0
|
||||
|
||||
> **Snapshot status:** v1.0 — taken in ACDL Phase 07 (milestone v1.1).
|
||||
> All 11 open decisions in §13 are **resolved** — see `PROJECT.md`
|
||||
> "Open-decision resolutions" table + decisions D-034..D-046.
|
||||
> The body §§1-12 is copied verbatim from the upstream
|
||||
> `docs/architecture.md` v0.2; only the header status line, the resolution
|
||||
> session log, §13, §14, and the new §15 are Phase 07 additions. The
|
||||
> `act_runner` → `gitea-runner` rename (D-046, 2026-04 in gitea/runner#850)
|
||||
> is applied; `act_runner` appears only in a "formerly" note.
|
||||
|
||||
# Agentic Cloud Delivery Platform — Architecture Document
|
||||
|
||||
Status: **v1.0** (snapshot taken in ACDL Phase 07, milestone v1.1). All 11
|
||||
open decisions in §13 are resolved — see `PROJECT.md` "Open-decision
|
||||
resolutions" table + decisions D-034..D-046.
|
||||
|
||||
Companion to: Agentic Cloud Delivery Vision [1].
|
||||
|
||||
Authoring principle: The vision is the source of truth for why [1]; this document is the source of truth for how. Where the two conflict, the vision wins.
|
||||
|
||||
Resolution session log (v1.0 snapshot — see PROJECT.md for full text):
|
||||
|
||||
| ID | Question | Resolution (one-line — see PROJECT.md for rationale) |
|
||||
|---|---|---|
|
||||
| W1.A | AI-refinement trigger | ✅ RESOLVED — joint condition: N ≥ 50 consecutive zero-rollback changes AND no L1/L2 incident in 6 months AND Infra & Ops unilateral override. |
|
||||
| W1.B | Multi-stack edge case rule | ✅ RESOLVED — permitted only for (a) DR-region mirror, (b) time-boxed experimental stack TTL ≤ 30d, (c) explicit Infra & Ops approval with `multiStack.justification`. |
|
||||
| W2.A | Tag mutability for prod | ✅ RESOLVED — Path B: tag for dev/qa, SHA for prod; platform CLI resolves tag→SHA. |
|
||||
| W3.D | L1/L2 standard versioning | ✅ RESOLVED — semver (interface→MAJOR, behavior→MINOR, lifecycle→PATCH); L2 pins L1 by `name@semver`; MAJOR bump = new registry entry + 12-month deprecation. |
|
||||
| W3.E | Schema mandatory vs. optional inputs | ✅ RESOLVED — dev: stack+environment; qa adds validation.e2eSuite+loadTest; prod adds runbook+dashboard+oncall; dr adds drDrillRef; `inputs` always optional; `profile: agentic` fields optional everywhere (naturalLanguageIntent required when profile is agentic). |
|
||||
| BA.A | Initial L3B skill catalog | ✅ RESOLVED — 5 skills: web API, worker, scheduled job, static asset, basic observability bootstrap; addition criteria: (a) sensitive-data reviewable, (b) single contract submission, (c) documented use case. |
|
||||
| BA.B | Confidence threshold tuning | ✅ RESOLVED — thresholds frozen for v1; tuning begins v1.2 (quarterly FP/FN tracking; override = Infra & Ops + SRE joint sign-off, itself a confidence-event). |
|
||||
| BA.C | On-call / operational ownership | ✅ RESOLVED — platform on-call = Infra & Ops; L3A/L3B halt → platform on-call (Sev2); consumer-visible outage → consumer on-call (Sev1) + platform support. |
|
||||
| BA.D | Cost / capacity governance | ✅ RESOLVED — FinOps owns cloud cost; per-contract monthly reporting; runaway spend hard-halts at 120% of declared budget via the confidence signal; override = FinOps + SRE joint sign-off. |
|
||||
| BA.E | Consumer onboarding | ✅ RESOLVED — developer (L3A): `getting-started` → contract schema + central pipeline template; citizen (L3B): scoped agent + skill catalog, no workflow authoring; both end in a sandbox dev submission that must pass the confidence gate. |
|
||||
| BA.F | Cross-platform evolution | ✅ RESOLVED — contract schema, IR, PolicyCheckResult, confidence signal, audit stream are portable (forge-agnostic); forge-specific code = workflow YAML, OIDC trust, CODEOWNERS, Environments; a second forge needs a forge adapter + workflow-template translator, no change to L1/L2/IR/confidence/audit. |
|
||||
| Q1.3 | OpenTofu timing | ✅ RESOLVED (deferred) — not in v1 or v1.1; the substrate abstraction (§12) makes OpenTofu a future adapter, not an architecture change; revisit when an OpenTofu adapter is requested. |
|
||||
|
||||
---
|
||||
|
||||
## 0. Purpose
|
||||
|
||||
This document encodes the architectural commitments that realize the vision [1]. The resolution session has closed eight open items; the document is now at v0.2 with eleven open items remaining, listed in Section 13. Every locked commitment is grounded in either a vision tenet or a specific decision made during resolution.
|
||||
|
||||
The structure remains: four layers (L1 primitives, L2 composed stacks, L3A developer surface, L3B agentic surface) plus five cross-cutting concerns (central pipeline, contract schema, confidence signal, audit stream, HITL mechanics), with one addition: the substrate abstraction layer (Section 12) is now a first-class architectural concern, not an implementation detail.
|
||||
|
||||
## 1. Architectural Overview
|
||||
|
||||
The platform remains four layers and five cross-cutting concerns. The substrate abstraction is added as a sixth cross-cutting concern in Section 12 because it is the binding constraint for the L1/L2 model, the central pipeline, and the policy toolchain.
|
||||
|
||||
The vision's "Two Consumer Surfaces, One Platform" tenet [1] remains the constraint that binds all concerns: L3A and L3B converge on the same contract schema, the same policy envelope, and the same evidence stream.
|
||||
|
||||
Locked additions this revision:
|
||||
|
||||
- The environment model is dev (autonomous) → qa (QA HITL) → prod (SRE HITL) → dr (SRE HITL). Staging does not exist.
|
||||
|
||||
- L1/L2 are substrate-agnostic in shape; substrate adapters are the only substrate-specific component.
|
||||
|
||||
## 2. Layer 1 — Foundational Primitives
|
||||
|
||||
Purpose. Single-purpose, substrate-agnostic primitive modules representing the smallest reusable infrastructure pieces. L1 modules do not compose with other L1 modules; L1 takes its environment as input.
|
||||
|
||||
Locked commitments (unchanged from v0.1):
|
||||
|
||||
- No inter-L1 references. L1 may call Terraform data sources.
|
||||
|
||||
- Semver with three triggers (interface → MAJOR, behavior → MINOR, lifecycle → PATCH).
|
||||
|
||||
- Immutability on publication.
|
||||
|
||||
- 12-month deprecation window.
|
||||
|
||||
- AI refinement is a flag.
|
||||
|
||||
✅ RESOLVED (see PROJECT.md W1.A): AI-refinement operational trigger — joint condition: N ≥ 50 consecutive changes with zero rollbacks AND no L1/L2 incident in last 6 months AND Infra & Ops holds a unilateral override.
|
||||
|
||||
✅ RESOLVED (sub-decision): The L1 module's interface field is defined against the Target Stack IR, not against Terraform's variable block directly. In v1, the IR is shaped to round-trip cleanly to Terraform, but the schema is substrate-agnostic. Pending v1 implementation details in Section 12.
|
||||
|
||||
## 3. Layer 2 — Composed Stacks
|
||||
|
||||
Purpose. Combine L1 primitives into deployable infrastructure shapes. Each codebase maps to one canonical L2 stack; the stack is either a parameterized module (Shape X) or a thin-composition layer (Shape Y).
|
||||
|
||||
Locked commitments (unchanged from v0.1):
|
||||
|
||||
- 1 codebase = 1 L2 stack (default), with multiStack: true for exceptions.
|
||||
|
||||
- Shape X or Shape Y.
|
||||
|
||||
- Hierarchical composition, max depth 5, only registered L1s.
|
||||
|
||||
- Pipeline quality checks: secrets-in-plaintext, public ingress, IAM wildcard, KMS key reference, tag compliance, naming convention.
|
||||
|
||||
- Restricted from thin-composition: IAM principal creation, network boundary creation, key/secret creation, external data transfer.
|
||||
|
||||
- Auto-promote after 3 observed usages.
|
||||
|
||||
✅ RESOLVED (see PROJECT.md W1.B): Multi-stack edge case rule — permitted only for (a) DR-region mirror, (b) time-boxed experimental stack with TTL ≤ 30 days, (c) explicit Infra & Ops approval for a documented reason captured in multiStack.justification.
|
||||
|
||||
✅ RESOLVED (sub-decision): The L2 thin-composition tree's wires field is defined against the IR's relationship type, not against a Terraform module block. The IR → Terraform translation is the Terraform adapter's job (Section 12). The thin-composition pipeline itself is substrate-agnostic.
|
||||
|
||||
## 4. Layer 3A — Developer Consumer Surface
|
||||
|
||||
Locked commitments (unchanged from v0.1):
|
||||
|
||||
- Tag-based reference to the central pipeline template.
|
||||
|
||||
- Developer-owned workflow file, no platform auto-sync.
|
||||
|
||||
- L3A and L3B are parallel paths, not a progression.
|
||||
|
||||
✅ RESOLVED (see PROJECT.md W2.A): Tag mutability for production-bound references — Path B (tag for dev/qa, SHA for prod). The platform provides a CLI command that resolves the current tag to its SHA for prod-bound workflows.
|
||||
|
||||
## 5. Layer 3B — Agentic Consumer Surface
|
||||
|
||||
Locked commitments (unchanged from v0.1):
|
||||
|
||||
- Hybrid runtime, skill as markdown, agent as executor.
|
||||
|
||||
- Trust model: trust and always verify on the platform side.
|
||||
|
||||
- Skill envelope (4 dimensions).
|
||||
|
||||
- Stateless agents, all state in the platform.
|
||||
|
||||
Environment progression — locked (this revision):
|
||||
|
||||
| Environment | Autonomy | Attester | Gate |
|
||||
|---|---|---|---|
|
||||
| dev | Full autonomy (no HITL) | — | Confidence signal ≥ 0.50, all six inputs present |
|
||||
| qa | Held for attestation | QA | GitHub Deployment approval + full QA matrix (see §10) |
|
||||
| prod | Held for attestation | SRE | GitHub Deployment approval + full SRE matrix (see §10) |
|
||||
| dr | Held for attestation | SRE | GitHub Deployment approval + dr-drill evidence (see §10) |
|
||||
|
||||
Staging is removed. Dev is the only autonomous environment and absorbs integration, contract, security smoke, and performance smoke validation. The CDLC reference document's environment model is a doc-sync item flagged at the top of this document.
|
||||
|
||||
Profile marker: profile: agentic unlocks L3B-specific fields naturalLanguageIntent, confidenceAtSubmission, agentTrace).
|
||||
|
||||
✅ RESOLVED (see PROJECT.md BA.A): Skill catalog — initial set: web API, worker, scheduled job, static asset, basic observability bootstrap. Addition criteria: (a) reviewable for sensitive data, (b) expressible as a single contract submission, (c) documented use case.
|
||||
|
||||
## 6. Cross-Cutting — Central Pipeline Template
|
||||
|
||||
Locked commitments (unchanged from v0.1):
|
||||
|
||||
- JSON Schema (draft 2020-12) with thin domain-specific wrapper.
|
||||
|
||||
- Central repo + generated client libraries.
|
||||
|
||||
- Multi-stage validation pipeline (schema → policy → NFR → confidence).
|
||||
|
||||
- Distributed enrichment.
|
||||
|
||||
- GitOps reconciler + Terraform execution layer.
|
||||
|
||||
Locked additions this revision:
|
||||
|
||||
- The GitOps reconciler is the platform's K8s API. The cdlc-gitops repository's state materializes into K8s CRDs (ArgoCD Applications or Flux Kustomizations) that the reconciler watches. This is the platform's internal state surface.
|
||||
|
||||
- The pipeline emits a PolicyCheckResult record per policy rule evaluated. The confidence signal consumes these as one normalized input (Section 8).
|
||||
|
||||
✅ RESOLVED (see PROJECT.md W3.D): L1/L2 standard versioning details — semver (interface→MAJOR, behavior→MINOR, lifecycle→PATCH); L2 contracts pin L1 by `name@semver`; the resolver picks the highest compatible; MAJOR bumps require a new registry entry (immutable publication); old entry enters a 12-month deprecation window.
|
||||
|
||||
✅ RESOLVED (see PROJECT.md W3.E): Schema mandatory vs. optional inputs — dev requires stack+environment; qa adds validation.e2eSuite + validation.loadTest; prod adds runbook + dashboard + oncall; dr adds drDrillRef; `inputs` always optional; `profile: agentic` fields optional everywhere (naturalLanguageIntent required when profile is agentic).
|
||||
|
||||
## 7. Cross-Cutting — Contract Schema
|
||||
|
||||
Locked commitments (unchanged from v0.1):
|
||||
|
||||
- Central repo + generated client libraries.
|
||||
|
||||
- Strict fail-fast at schema stage, multi-stage validation pipeline with reason codes from a published vocabulary.
|
||||
|
||||
✅ RESOLVED (see PROJECT.md W3.E): Schema mandatory vs. optional inputs. The CDLC reference contract example [1] is illustrative; the v1 contract schema has explicit per-field mandatory/optional declarations per environment.
|
||||
|
||||
## 8. Cross-Cutting — Confidence Signal
|
||||
|
||||
Locked commitments (unchanged from v0.1):
|
||||
|
||||
- Six canonical inputs.
|
||||
|
||||
- Weighted sum with per-input breakdown.
|
||||
|
||||
- Per-environment thresholds: dev ≥ 0.50, qa ≥ 0.75, prod ≥ 0.90, dr ≥ 0.95.
|
||||
|
||||
- Structured output { score, band, perInput, reasonCodes }.
|
||||
|
||||
- 1-year storage, no algorithm retraining in v1.
|
||||
|
||||
- Halt with explicit reason on missing input.
|
||||
|
||||
Locked additions this revision:
|
||||
|
||||
- The policy check results input is a list of PolicyCheckResult records from the normalized schema (Section 9, 12). The signal does not know which engine produced which result.
|
||||
|
||||
- Severity → score penalty mapping: critical → hard override to mandatory block, high → -0.2, medium → -0.05, low → -0.01, info → 0.0. One critical finding hard-overrides the score regardless of all other inputs.
|
||||
|
||||
✅ RESOLVED (see PROJECT.md BA.B): Threshold tuning policy. Thresholds frozen for v1. Tuning begins v1.2: quarterly FP/FN tracking per environment; override authority = Infra & Ops + SRE joint sign-off; any override is itself a confidence-event in the audit stream.
|
||||
|
||||
## 9. Cross-Cutting — Audit and Evidence Stream
|
||||
|
||||
Locked commitments (unchanged from v0.1):
|
||||
|
||||
- Tiered audit ledger: S3 with Object Lock in compliance mode (cold, source of truth, 7-year retention) + GitHub audit repo (hot, query index, not part of the chain).
|
||||
|
||||
- Daily checkpoints.
|
||||
|
||||
- Event schema: JWS detached signature, prev_event_hash chain, controlled-vocabulary event_type.
|
||||
|
||||
- Outbox pattern with local durable outbox + async worker.
|
||||
|
||||
- Linkage via workflow run ID or agent invocation ID.
|
||||
|
||||
Locked additions this revision:
|
||||
|
||||
- The outbox database is DynamoDB. RPO is zero (synchronous write to local outbox before contract submission ack); RTO is the async worker's recovery from the dead-letter queue. Single-region in v1; multi-region is a v2 concern.
|
||||
|
||||
- The outbox also stores the per-contract QA and prod approver identities (Section 10). The platform-internal identity-distinctness check reads from this outbox. This is the only durable record of the approver identities outside GitHub's audit log.
|
||||
|
||||
## 10. Cross-Cutting — Human-in-the-Loop Mechanics
|
||||
|
||||
Purpose. The human gates at higher environments. The vision's "Lower Environments are Autonomous; Higher Environments are Attested" tenet [1] and the "deliberate human attestation — not as a rubber stamp" requirement [1] are the binding constraints.
|
||||
|
||||
### 10.1 Gate model
|
||||
|
||||
Pre-execution gates. The contract is held in a "validated but not applied" state until the human attests. qa, prod, and dr are PR-based attestation gates backed by GitHub Environments with required reviewers.
|
||||
|
||||
For qa and prod, there is no partial deployment to roll back on rejection. For dr, the same model — promotion to the DR environment is a separate GitHub Deployment, gated by SRE, against a separate cluster/region. The canary/deployment-rollback model is explicitly not in scope for v1.
|
||||
|
||||
### 10.2 Reviewer routing
|
||||
|
||||
GitHub CODEOWNERS + GitHub Environment required reviewers. qa → QA team; prod → SRE team; dr → SRE team. CODEOWNERS is the routing layer; it does not enforce identity distinctness.
|
||||
|
||||
### 10.3 Separation of duties — identity distinctness
|
||||
|
||||
Mechanism is platform-internal, not GitHub-native, not Kyverno (in v1).
|
||||
|
||||
Sequence:
|
||||
|
||||
1. On promotion dev → qa, the platform reads the QA approver's GitHub identity from the GitHub Deployment approval event and writes it to the DynamoDB outbox keyed by contractId.
|
||||
|
||||
2. On promotion qa → prod, the platform reads the stored QA approver identity from the outbox and the new SRE approver identity from the GitHub Deployment approval event.
|
||||
|
||||
3. If qaApprover == prodApprover, the platform blocks the prod promotion, writes a SEPARATION_OF_DUTIES_VIOLATION event to the evidence stream, and routes a halt artifact to the SRE on-call.
|
||||
|
||||
4. The check is implemented in the central pipeline repo, not as an external policy. The platform is the only writer to the outbox; the check is in the same process that has authority to block the promotion.
|
||||
|
||||
### 10.4 Full HITL attestation matrix
|
||||
|
||||
| Env | Concern | Evidence artifact | Freshness | Source | Attester |
|
||||
|---|---|---|---|---|---|
|
||||
| qa | Functional correctness | Last successful run of contract-declared validation.e2eSuite with pass rate ≥ 99% | Last 24h | Test runner declared in contract | QA |
|
||||
| qa | Performance baseline | Load test report (k6 / Gatling / Locust) showing p99 latency < declared NFR and throughput > declared minimum | Last 7d | Load test runner declared in contract | QA |
|
||||
| qa | Security posture | Vulnerability scan (Trivy, Snyk, or contract-declared equivalent) with no criticals/highs, signed by Security on-call | Last 24h | Security scanner + Security team signature | QA |
|
||||
| qa | Contract NFRs | Platform-generated report: schema valid, NFR assertions (latency, throughput, error rate) within declared bounds | At submission | Platform contract validator | QA |
|
||||
| prod | Operational readiness | Runbook published, dashboard exists, on-call rotation assigned, alerts configured | At submission, validated against last 30d history | Platform + SRE | SRE |
|
||||
| prod | Incident response | Sev-1 runbook tabletop or live drill completed | Last 90d | SRE drill record | SRE |
|
||||
| prod | Capacity / cost | FinOps forecast for next 30d within budget envelope, cost anomaly baseline stored, budget alert configured | Forecast valid for next 30d | FinOps + SRE | SRE |
|
||||
| prod | Resilience | DR drill, chaos engineering report, backup verified | DR: 180d; chaos: 90d; backup: 30d | SRE + Platform | SRE |
|
||||
| dr | dr-region deploy with the most recent prod-bound dr drill as canary evidence | dr drill report | Last 180d | SRE | SRE |
|
||||
|
||||
### 10.5 Timeout behavior
|
||||
|
||||
| Time | State | Action |
|
||||
|---|---|---|
|
||||
| Submission | PENDING_ATTESTATION | Notify responsible team |
|
||||
| 1 business day | PENDING_ATTESTATION_WARNING | Notify team + platform on-call (elevated path); emit PENDING_ATTESTATION_TIMEOUT_WARNING event |
|
||||
| 2 business days | PENDING_ATTESTATION_AUTO_FREEZE | Auto-freeze; require re-submission; emit PENDING_ATTESTATION_AUTO_FREEZE event; new submission linked via supersedes |
|
||||
|
||||
### 10.6 Rejection and rollback
|
||||
|
||||
Rejection returns the contract to a HELD state with the rejection reason captured as a PROMOTION_REJECTED event. The consumer fixes the cause and re-submits; the new submission is linked to the rejected one via supersedes. The audit chain is extended, not torn up — matching the resolution session's answer.
|
||||
|
||||
There is no partial deployment to roll back at any v1 gate.
|
||||
|
||||
## 11. Cross-Cutting — Agentic Stack
|
||||
|
||||
Locked commitments (unchanged from v0.1):
|
||||
|
||||
- Hybrid runtime, platform-managed control plane + consumer-owned agent.
|
||||
|
||||
- Versioned, signed skill catalog over MCP.
|
||||
|
||||
- Skill envelope enforced on invocation and result submission.
|
||||
|
||||
- Consumer-owned skill execution environment. Platform does not run the skill.
|
||||
|
||||
- Stateless agents, all state in the platform.
|
||||
|
||||
Locked additions this revision:
|
||||
|
||||
- Skills are reviewed for sensitive data before release. Secrets, customer data, internal IPs, and other sensitive payloads are forbidden in skill markdown. The review is owned by Infra & Ops and is the mandatory release gate for any new skill. This is the trade-off for accepting the L3B runtime threat model (skill content is consumer-readable, so the platform must not put anything sensitive in it).
|
||||
|
||||
✅ RESOLVED (see PROJECT.md BA.A): Skill catalog — initial set, addition process, deprecation process per the resolution.
|
||||
|
||||
## 12. Cross-Cutting — L1/L2 Substrate Execution
|
||||
|
||||
Purpose. The technical execution layer for the L1/L2 substrate, including the substrate abstraction that protects v1 from polyglot mess while leaving v2+ room to grow.
|
||||
|
||||
### 12.1 Substrate abstraction (locked this revision)
|
||||
|
||||
L1/L2 are substrate-agnostic in shape. The architecture defines a Target Stack Intermediate Representation (IR) — a substrate-neutral description of:
|
||||
|
||||
- Resources with typed input contracts, typed output contracts, and declared NFRs.
|
||||
|
||||
- Relationships (single parent per child, with a shared keyword for multi-relationship dependencies).
|
||||
|
||||
- Composition (a tree of resources with max depth 5).
|
||||
|
||||
- Policy hooks (the points in the composition where policy checks attach).
|
||||
|
||||
The L1 registry, the L2 thin-composition tree, the YML standard, and the policy check result schema are all defined against the IR. None of them is defined against any specific substrate.
|
||||
|
||||
Substrate adapters are the only substrate-specific code. An adapter compiles the IR into a substrate execution plan. v1 ships exactly one adapter: the Terraform adapter. v2+ may add additional adapters (OpenTofu, Pulumi, K8s CRDs) without architectural change.
|
||||
|
||||
v1 implementation reality: the IR is shaped to round-trip cleanly to Terraform because there is no other adapter to differentiate from. The IR and the Terraform output are nearly isomorphic in v1. As additional adapters appear in v2+, the IR gets more expressive (e.g., substrate-specific output types) and the adapters gain translation logic, but the L1 module content, the YML standard, and the thin-composition tree do not change. This is the design that prevents the polyglot mess.
|
||||
|
||||
Why not build the abstraction earlier? Building a substrate-agnostic IR before there is a second adapter to test against is speculative generality. The v1 commitment is: (1) the L1 module interface is defined against the IR even though the only adapter is Terraform, and (2) the central pipeline, registry, and policy schema consume the IR-typed contracts. The adapter is the only place where substrate terminology appears in v1.
|
||||
|
||||
### 12.2 Terraform adapter (v1)
|
||||
|
||||
The Terraform adapter:
|
||||
|
||||
- Translates the IR-typed L1 module interface to a Terraform variable block and a Terraform output block.
|
||||
|
||||
- Translates the IR-typed L2 thin-composition tree to a Terraform root module that calls the L1 modules.
|
||||
|
||||
- Translates the IR-typed relationships to Terraform module references.
|
||||
|
||||
- Emits a Terraform plan from the IR.
|
||||
|
||||
The adapter is a thin layer. It does not own L1/L2 content; it only translates.
|
||||
|
||||
### 12.3 State storage
|
||||
|
||||
Locked: S3 (state files) + DynamoDB (state locking), cloud-managed. Single-region in v1.
|
||||
|
||||
### 12.4 Policy toolchain
|
||||
|
||||
Locked:
|
||||
|
||||
- Checkov for Terraform plan policy (the four L2 thin-composition checks: secrets-in-plaintext, public ingress, IAM wildcard, KMS key reference, plus tag and naming convention). Checkov is open-source, has a broad rule catalog, and is GitOps-friendly.
|
||||
|
||||
- Kyverno for K8s-native policy (platform-internal state in the GitOps reconciler, separation-of-dues-adjacent checks if any are added in v2, future CRD validation).
|
||||
|
||||
- OPA/Rego is reserved for cross-resource policy and is explicitly last resort due to Rego complexity.
|
||||
|
||||
### 12.5 Execution layer
|
||||
|
||||
Locked: GitHub Actions. terraform plan and terraform apply run in the central pipeline repo's GitHub Actions workflow. State locking via DynamoDB. AWS credentials via OIDC federation (long-lived credentials are forbidden). The platform does not run terraform apply against a developer's workstation; all execution is in the central pipeline.
|
||||
|
||||
> **ACDL Phase 07 note (D-039):** Gitea Actions (the ACDL forge) does not
|
||||
> support `id-token: write` / OIDC token issuance as of Gitea 1.27.x /
|
||||
> gitea-runner v2.1.0 (formerly `act_runner`, renamed 2026-04 in
|
||||
> gitea/runner#850). The v1.1 spike uses a per-run-rotated long-lived key
|
||||
> waiver; real OIDC federation is a v1.2 deliverable, blocked on
|
||||
> go-gitea/gitea#36988. The §12.5 "long-lived credentials are forbidden"
|
||||
> commitment is the locked target; the waiver is a time-boxed spike
|
||||
> exception.
|
||||
|
||||
### 12.6 Policy result normalization (locked this revision)
|
||||
|
||||
The confidence signal does not consume raw Checkov or Kyverno output. It consumes a normalized PolicyCheckResult schema produced by substrate-specific adapters.
|
||||
|
||||
Schema (canonical form, lives in the central pipeline repo):
|
||||
|
||||
```json
|
||||
{
|
||||
"contractId": "uuid",
|
||||
"evaluatedAt": "ISO-8601",
|
||||
"engine": "checkov | kyverno | opa",
|
||||
"ruleId": "CKV_AWS_24 | KYVERNO_NO_PRIVILEGED | ...",
|
||||
"severity": "critical | high | medium | low | info",
|
||||
"result": "pass | fail | skipped | error",
|
||||
"message": "human-readable",
|
||||
"evidence": { "...engine-specific payload, opaque to the signal..." },
|
||||
"resourceRef": "IR-typed resource identifier"
|
||||
}
|
||||
```
|
||||
|
||||
The Checkov adapter runs in the same GitHub Actions step as Checkov itself and translates Checkov JSON to PolicyCheckResult records. The Kyverno adapter runs as a controller in the platform's K8s cluster and translates Kyverno PolicyReport CRDs to PolicyCheckResult records. The confidence signal's policy input component is the union of all PolicyCheckResult records, regardless of engine. The signal does not know which engine produced which result — substrate-agnostic over its inputs, matching the L1/L2 model's substrate-agnostic over its outputs.
|
||||
|
||||
### 12.7 Registry maintenance
|
||||
|
||||
Locked: L1 module publication updates the L1 registry in the same PR as the module. Registry and module land together. The registry is the IR-typed contract, not a Terraform-specific variable schema. The L1 registry, the central pipeline, and the policy schema all consume the same IR-typed contract — there is one source of truth for the L1 interface, not multiple substrate-specific copies.
|
||||
|
||||
### 12.8 Contract-schema-to-IR resolution
|
||||
|
||||
The contract schema declares the consumer's intent in IR-typed terms. The central pipeline resolves the contract to a target stack (a list of L1 module instances with their inputs and the relationships between them). The Terraform adapter compiles the target stack to a Terraform execution plan. This resolution is substrate-agnostic — the target stack is in the IR.
|
||||
|
||||
## 13. Consolidated Open Design Decisions
|
||||
|
||||
✅ **All 11 decisions are RESOLVED (see PROJECT.md).** The §13 subsections
|
||||
below preserve the upstream structure with the `🟡 OPEN` markers replaced
|
||||
by `✅ RESOLVED (see PROJECT.md)`.
|
||||
|
||||
### From Wave 1 (L1/L2 Substrate)
|
||||
|
||||
- (W1.A) AI-refinement trigger. ✅ RESOLVED (see PROJECT.md) — joint condition: N ≥ 50 consecutive zero-rollback changes AND no L1/L2 incident in 6 months AND Infra & Ops unilateral override.
|
||||
|
||||
- (W1.B) Multi-stack edge case rule. ✅ RESOLVED (see PROJECT.md) — permitted only for (a) DR-region mirror, (b) time-boxed experimental stack TTL ≤ 30d, (c) explicit Infra & Ops approval with `multiStack.justification`.
|
||||
|
||||
### From Wave 2 (L3A/L3B)
|
||||
|
||||
- (W2.A) Tag mutability for production-bound references. ✅ RESOLVED (see PROJECT.md) — Path B (tag for dev/qa, SHA for prod) with platform-provided CLI to resolve tag → SHA.
|
||||
|
||||
### From Wave 3 (Technical Execution)
|
||||
|
||||
- (W3.D) L1/L2 standard versioning details. ✅ RESOLVED (see PROJECT.md) — semver (interface→MAJOR, behavior→MINOR, lifecycle→PATCH); L2 pins L1 by `name@semver`; MAJOR bump = new registry entry + 12-month deprecation.
|
||||
|
||||
- (W3.E) Schema mandatory vs. optional inputs. ✅ RESOLVED (see PROJECT.md) — per-env mandatory table (dev: stack+environment; qa adds validation.e2eSuite+loadTest; prod adds runbook+dashboard+oncall; dr adds drDrillRef); `inputs` always optional; `profile: agentic` fields optional everywhere.
|
||||
|
||||
### From Beyond Architecture
|
||||
|
||||
- (BA.A) Skill catalog. ✅ RESOLVED (see PROJECT.md) — 5 skills (web API, worker, scheduled job, static asset, basic observability bootstrap); addition criteria locked.
|
||||
|
||||
- (BA.B) Confidence signal threshold tuning. ✅ RESOLVED (see PROJECT.md) — frozen for v1; tuning begins v1.2 (quarterly FP/FN; override = Infra & Ops + SRE joint sign-off).
|
||||
|
||||
- (BA.C) On-call and operational ownership. ✅ RESOLVED (see PROJECT.md) — platform on-call = Infra & Ops; L3A/L3B halt → Sev2; consumer outage → Sev1.
|
||||
|
||||
- (BA.D) Cost and capacity governance. ✅ RESOLVED (see PROJECT.md) — FinOps owns; per-contract monthly reporting; hard halt at 120% of declared budget via the confidence signal; override = FinOps + SRE joint sign-off.
|
||||
|
||||
- (BA.E) Consumer onboarding. ✅ RESOLVED (see PROJECT.md) — developer (L3A): getting-started → contract schema + central pipeline template; citizen (L3B): scoped agent + skill catalog; both end in a sandbox dev submission that must pass the confidence gate.
|
||||
|
||||
- (BA.F) Cross-platform evolution. ✅ RESOLVED (see PROJECT.md) — contract schema, IR, PolicyCheckResult, confidence signal, audit stream are portable; forge-specific code = workflow YAML, OIDC trust, CODEOWNERS, Environments; a second forge needs a forge adapter + workflow-template translator.
|
||||
|
||||
- (Q1.3) OpenTofu timing. ✅ RESOLVED (deferred — see PROJECT.md) — not in v1 or v1.1; the substrate abstraction makes OpenTofu a future adapter, not an architecture change.
|
||||
|
||||
## 14. Document Status and Next Steps
|
||||
|
||||
Status: **v1.0**. All 11 open items in §13 are resolved. The architecture is
|
||||
internally consistent; the v1.1 implementation spike (ACDL Phases 08-10)
|
||||
validates the locked substrate abstraction + contract→IR→adapter path
|
||||
against real AWS via a per-run-rotated key (D-039; OIDC deferred to v1.2).
|
||||
The v1.2 build-out (S3 Object Lock, JWS, HITL wiring, L3B skill catalog,
|
||||
Kyverno/OPA, real OIDC federation, multi-region) is design-authored in
|
||||
Phase 07 and implemented post-spike.
|
||||
|
||||
Doc-sync items (out of scope of this document but flagged for the same change set):
|
||||
|
||||
- The CDLC reference document's environment model assumes staging exists. Path A invalidates that. The CDLC contract example's targetEnvironments: [staging, production] must be revised to [dev, qa, prod, dr].
|
||||
|
||||
## 15. Phase 07 authored artifacts
|
||||
|
||||
The 11 resolutions are recorded in `PROJECT.md` (decisions D-034..D-046 +
|
||||
the "Open-decision resolutions" table). Phase 07 formalizes the locked
|
||||
commitments into these schema/design files (landed in Waves 2-4 of
|
||||
Phase 07):
|
||||
|
||||
| REQ | File | Owner persona |
|
||||
|-----|------|--------------|
|
||||
| REQ-17 | `schemas/ir.schema.json` | platform-engineer |
|
||||
| REQ-18 | `schemas/policy_check_result.schema.json` + `adapters/terraform/policy/checkov_adapter.py` | security-engineer |
|
||||
| REQ-19 | `platform/confidence_signal.py` | backend-engineer + security-engineer (co-authored) |
|
||||
| REQ-20 | `platform/audit_ledger_design.md` | security-engineer |
|
||||
| REQ-21 | `platform/hitl_matrix_design.md` + `platform/separation_of_duties.py` | security-engineer |
|
||||
| REQ-22 | `schemas/contract.schema.json` | backend-engineer |
|
||||
|
||||
The spike scope (D-041, D-043) vs v1.2 build-out boundary for each design
|
||||
is documented in the respective file.
|
||||
@@ -0,0 +1,40 @@
|
||||
# l1-s3 — S3 bucket primitive
|
||||
|
||||
The first real L1 module for the v1.1 spike. Single-purpose,
|
||||
substrate-agnostic (the IR type is `aws:s3:bucket`, not a Terraform
|
||||
resource type).
|
||||
|
||||
## Interface (the IR-typed contract)
|
||||
|
||||
See `interface.json`: inputs `bucket_name` + `region` (strings), outputs
|
||||
`bucket_arn` (arn) + `bucket_name` (string), NFR `versioning` (bool,
|
||||
default true).
|
||||
|
||||
## IR → Terraform mapping (performed by the adapter)
|
||||
|
||||
The Terraform adapter (`adapters/terraform/adapter.py`) translates this
|
||||
L1's IR shape to Terraform:
|
||||
|
||||
| IR | Terraform |
|
||||
|----|-----------|
|
||||
| `resource.type = aws:s3:bucket` | `resource "aws_s3_bucket" "<id>" { ... }` |
|
||||
| `resource.inputs.bucket_name` | `bucket = <value>` arg |
|
||||
| `resource.inputs.region` | `provider "aws" { region = <value> }` |
|
||||
| `resource.outputs.bucket_arn` | `output "bucket_arn" { value = aws_s3_bucket.<id>.arn }` |
|
||||
| `resource.outputs.bucket_name` | `output "bucket_name" { value = aws_s3_bucket.<id>.id }` |
|
||||
|
||||
The adapter is a thin layer (ARCHITECTURE.md §12.2); it does not own L1
|
||||
content — it only translates.
|
||||
|
||||
## Spike instance
|
||||
|
||||
`spike_instance.json` is a concrete stack instance (with values
|
||||
`bucket_name=acdl-spike-bucket`, `region=us-east-1`) that validates
|
||||
against `schemas/ir.schema.json`. The adapter consumes this instance
|
||||
(not the interface contract) to emit Terraform.
|
||||
|
||||
## Versioning (W3.D)
|
||||
|
||||
`1.0.0` — interface MAJOR, behavior MINOR, lifecycle PATCH. MAJOR bumps
|
||||
require a new registry entry (immutable publication); old entries enter
|
||||
a 12-month deprecation window.
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "l1-s3",
|
||||
"version": "1.0.0",
|
||||
"kind": "l1",
|
||||
"type": "aws:s3:bucket",
|
||||
"description": "S3 bucket primitive (substrate-agnostic IR type aws:s3:bucket; the Terraform adapter translates to aws_s3_bucket).",
|
||||
"inputs": {
|
||||
"bucket_name": {
|
||||
"type": "string",
|
||||
"description": "Globally-unique S3 bucket name.",
|
||||
"required": true
|
||||
},
|
||||
"region": {
|
||||
"type": "string",
|
||||
"description": "AWS region the bucket is created in.",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"outputs": {
|
||||
"bucket_arn": {
|
||||
"type": "arn",
|
||||
"description": "The S3 bucket ARN."
|
||||
},
|
||||
"bucket_name": {
|
||||
"type": "string",
|
||||
"description": "The bucket name (echoes the input)."
|
||||
}
|
||||
},
|
||||
"nfrs": {
|
||||
"versioning": {
|
||||
"type": "boolean",
|
||||
"description": "Enable S3 versioning (default true).",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"stack": {
|
||||
"name": "l1-s3",
|
||||
"kind": "l1",
|
||||
"depth": 1
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"id": "s3",
|
||||
"type": "aws:s3:bucket",
|
||||
"module": "l1-s3@1.0.0",
|
||||
"inputs": {
|
||||
"bucket_name": "acdl-spike-bucket",
|
||||
"region": "us-east-1"
|
||||
},
|
||||
"outputs": {
|
||||
"bucket_arn": {"type": "arn", "description": "The S3 bucket ARN."},
|
||||
"bucket_name": {"type": "string", "description": "The bucket name."}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
# l2-static-asset — thin-composition (S3 static asset)
|
||||
|
||||
The v1.1 spike's L2. A thin-composition that references `l1-s3` only
|
||||
(depth 1). The contract's inputs (`bucket_name`, `region`) map 1:1
|
||||
through the wires to the L1's inputs.
|
||||
|
||||
## Composition (the IR-typed thin-composition tree)
|
||||
|
||||
See `composition.json`: `kind=l2`, `depth=1`, one child `l1-s3@1.0.0`,
|
||||
wires `{bucket_name → s3.inputs.bucket_name, region → s3.inputs.region}`
|
||||
(passthrough).
|
||||
|
||||
## IR → Terraform mapping (D-P10-1)
|
||||
|
||||
The Terraform adapter consumes the *resolved IR instance* (which has
|
||||
`kind=l2` + the L1 resource `s3` in its `resources` array). For a
|
||||
depth-1 thin-composition, the L2 root module **IS** the L1's resource —
|
||||
no separate `module "l1_s3" { source = "..." }` block. The existing
|
||||
adapter `TYPE_MAP` + resource emission handle both l1 and l2 instances
|
||||
(the resources array is the same shape). The `relationships` array is
|
||||
ignored at the Terraform level for the spike (composition ordering is
|
||||
implicit in the single resource).
|
||||
|
||||
v1.2 may emit a real `module "l1_s3" { source = "..." }` block when L1s
|
||||
become published Terraform modules rather than inline resources.
|
||||
|
||||
## Versioning (W3.D)
|
||||
|
||||
`1.0.0` — interface MAJOR, behavior MINOR, lifecycle PATCH. MAJOR bumps
|
||||
require a new registry entry (immutable publication); old entries enter
|
||||
a 12-month deprecation window.
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "l2-static-asset",
|
||||
"version": "1.0.0",
|
||||
"kind": "l2",
|
||||
"depth": 1,
|
||||
"description": "Thin-composition: a single S3 bucket for static asset hosting. References l1-s3 only (depth 1).",
|
||||
"children": [
|
||||
{
|
||||
"id": "s3",
|
||||
"module": "l1-s3@1.0.0"
|
||||
}
|
||||
],
|
||||
"wires": {
|
||||
"bucket_name": {"target": "s3", "input": "bucket_name"},
|
||||
"region": {"target": "s3", "input": "region"}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"l1-s3": {
|
||||
"1.0.0": {
|
||||
"interface": "modules-ir/l1/l1-s3/interface.json",
|
||||
"published_at": "2026-07-21T19:00:00Z",
|
||||
"deprecated": false
|
||||
}
|
||||
},
|
||||
"l2-static-asset": {
|
||||
"1.0.0": {
|
||||
"composition": "modules-ir/l2/l2-static-asset/composition.json",
|
||||
"published_at": "2026-07-21T19:30:00Z",
|
||||
"deprecated": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://acdl.cloudinit.dev/schemas/contract.schema.json",
|
||||
"title": "ACDL Contract",
|
||||
"description": "Consumer-declared intent. The central pipeline resolves a contract to a Target Stack IR (schemas/ir.schema.json), the Terraform adapter compiles the IR to a plan. Strict fail-fast at schema stage with reason codes from a published vocabulary.",
|
||||
"$comment": "Per-env mandatory inputs per W3.E (PROJECT.md). dev requires stack+environment; qa adds validation.e2eSuite + validation.loadTest; prod adds runbook+dashboard+oncall; dr adds drDrillRef. inputs always optional. profile: agentic fields optional everywhere (naturalLanguageIntent required when profile is agentic). W2.A (tag for dev/qa, SHA for prod) is a workflow-reference concern, not a schema field; the platform CLI resolves tag->SHA for prod-bound workflows.",
|
||||
"type": "object",
|
||||
"required": ["stack", "environment"],
|
||||
"properties": {
|
||||
"stack": {
|
||||
"type": "string",
|
||||
"pattern": "^l2-[a-z][a-z0-9-]*$",
|
||||
"description": "L2 thin-composition reference (resolved by the pipeline to a Target Stack IR)."
|
||||
},
|
||||
"environment": {
|
||||
"type": "string",
|
||||
"enum": ["dev", "qa", "prod", "dr"],
|
||||
"description": "Target environment. Staging does not exist (Path A locked, ARCHITECTURE.md §5)."
|
||||
},
|
||||
"inputs": {
|
||||
"type": "object",
|
||||
"description": "L2-level parameter map. Free-form in v1, typed per-L1 in v1.2 (W3.E).",
|
||||
"additionalProperties": {"type": ["string", "number", "boolean"]}
|
||||
},
|
||||
"validation": {
|
||||
"type": "object",
|
||||
"description": "Validation evidence required in qa (W3.E).",
|
||||
"properties": {
|
||||
"e2eSuite": {"type": "string", "description": "Reference to the contract-declared e2e suite (last 24h, pass rate >= 99%)."},
|
||||
"loadTest": {"type": "string", "description": "Reference to the load test report (last 7d, p99 < declared NFR)."}
|
||||
}
|
||||
},
|
||||
"runbook": {"type": "string", "description": "Runbook reference, mandatory in prod (W3.E)."},
|
||||
"dashboard": {"type": "string", "description": "Dashboard reference, mandatory in prod (W3.E)."},
|
||||
"oncall": {"type": "string", "description": "On-call rotation reference, mandatory in prod (W3.E)."},
|
||||
"drDrillRef": {"type": "string", "description": "DR drill report reference (last 180d), mandatory in dr (W3.E)."},
|
||||
"profile": {
|
||||
"type": "string",
|
||||
"enum": ["developer", "agentic"],
|
||||
"default": "developer",
|
||||
"description": "Consumer surface. 'agentic' unlocks L3B fields (ARCHITECTURE.md §5)."
|
||||
},
|
||||
"naturalLanguageIntent": {
|
||||
"type": "string",
|
||||
"description": "L3B: the original natural-language prompt. Required when profile is agentic (W3.E)."
|
||||
},
|
||||
"confidenceAtSubmission": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1,
|
||||
"description": "L3B: the agent's self-reported confidence at submission time."
|
||||
},
|
||||
"agentTrace": {
|
||||
"type": "string",
|
||||
"description": "L3B: reference to the agent's execution trace."
|
||||
},
|
||||
"supersedes": {
|
||||
"type": "string",
|
||||
"format": "uuid",
|
||||
"description": "Prior contractId this re-submission replaces (after rejection — ARCHITECTURE.md §10.6)."
|
||||
}
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": {"properties": {"environment": {"const": "qa"}}},
|
||||
"then": {"required": ["validation"],
|
||||
"properties": {"validation": {"required": ["e2eSuite", "loadTest"]}}}
|
||||
},
|
||||
{
|
||||
"if": {"properties": {"environment": {"const": "prod"}}},
|
||||
"then": {"required": ["runbook", "dashboard", "oncall"]}
|
||||
},
|
||||
{
|
||||
"if": {"properties": {"environment": {"const": "dr"}}},
|
||||
"then": {"required": ["drDrillRef"]}
|
||||
},
|
||||
{
|
||||
"if": {"required": ["profile"], "properties": {"profile": {"const": "agentic"}}},
|
||||
"then": {"required": ["naturalLanguageIntent"]}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://acdl.cloudinit.dev/schemas/ir.schema.json",
|
||||
"title": "ACDL Target Stack IR",
|
||||
"description": "Substrate-neutral description of a target stack: resources with typed inputs/outputs/NFRs, relationships (single parent per child), composition tree (max depth 5), and policy hooks. The L1 registry, L2 thin-composition tree, contract YML, and PolicyCheckResult schema are all defined against this IR. Substrate adapters (the Terraform adapter in v1) are the only substrate-specific code.",
|
||||
"$comment": "v1 ships one adapter (Terraform). The IR is nearly isomorphic to Terraform in v1 (ARCHITECTURE.md §12.1); the adapter compiles resource.module -> module block, resource.inputs -> variable + arg, resource.outputs -> output, relationship.kind=uses_output -> interpolation, relationship.kind=parent -> composition ordering hint. As more adapters appear (v2+), the IR gains expressiveness; the L1 content + contract YML + thin-composition tree do not change. The schema body is substrate-agnostic: no Terraform block keywords (variable/output/resource as blocks) and no aws_ provider prefixes in the schema keywords; type values are IR types (aws:s3:bucket), not Terraform resource types (aws_s3_bucket).",
|
||||
"type": "object",
|
||||
"required": ["version", "stack", "resources"],
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "string",
|
||||
"description": "IR schema version (semver).",
|
||||
"pattern": "^\\d+\\.\\d+\\.\\d+$"
|
||||
},
|
||||
"stack": {
|
||||
"type": "object",
|
||||
"description": "The L1/L2 stack identity this IR represents.",
|
||||
"required": ["name", "kind", "depth"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"pattern": "^l[12]-[a-z][a-z0-9-]*$",
|
||||
"description": "Stack name matching the L1/L2 folder name."
|
||||
},
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"enum": ["l1", "l2"],
|
||||
"description": "l1 = primitive; l2 = thin-composition."
|
||||
},
|
||||
"depth": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 5,
|
||||
"description": "Composition depth (ARCHITECTURE.md §3: max depth 5). L2->L1 is depth 1."
|
||||
}
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {"$ref": "#/$defs/resource"}
|
||||
},
|
||||
"relationships": {
|
||||
"type": "array",
|
||||
"description": "Optional in v1; present when the adapter needs explicit ordering/output wiring hints beyond parent composition.",
|
||||
"items": {"$ref": "#/$defs/relationship"}
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"resource": {
|
||||
"type": "object",
|
||||
"required": ["id", "type", "module", "inputs"],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-z][a-z0-9-]*$",
|
||||
"description": "Local IR resource id (unique within the stack)."
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "IR-typed resource identifier (substrate-agnostic), e.g. 'aws:s3:bucket'. NOT a Terraform resource type ('aws_s3_bucket'); the adapter translates IR type -> substrate type."
|
||||
},
|
||||
"module": {
|
||||
"type": "string",
|
||||
"pattern": "^l1-[a-z][a-z0-9-]*@\\d+\\.\\d+\\.\\d+$",
|
||||
"description": "L1 registry reference: name@semver (W3.D). MAJOR bumps require a new registry entry (immutable publication); old entry enters a 12-month deprecation window."
|
||||
},
|
||||
"parent": {
|
||||
"type": "string",
|
||||
"description": "Parent resource id. Absent for the root. Single parent per child (ARCHITECTURE.md §12.1)."
|
||||
},
|
||||
"inputs": {
|
||||
"type": "object",
|
||||
"description": "Input values keyed by the L1 module's declared inputs. Free-form in v1 (validated at contract->IR resolution against the L1 registry); typed per-L1 in v1.2.",
|
||||
"additionalProperties": {"type": ["string", "number", "boolean"]}
|
||||
},
|
||||
"outputs": {
|
||||
"type": "object",
|
||||
"description": "Typed output contract. The adapter translates this to a substrate output block (e.g. Terraform output).",
|
||||
"additionalProperties": {"$ref": "#/$defs/outputSpec"}
|
||||
},
|
||||
"nfrs": {
|
||||
"type": "object",
|
||||
"description": "Declared non-functional requirements (latency, throughput, error rate). Opaque to the adapter; consumed by the confidence signal's NFR input.",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"outputSpec": {
|
||||
"type": "object",
|
||||
"required": ["type"],
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "IR-typed output type: a primitive ('string', 'arn') or a reference ('ref:<resourceId>.<outputName>')."
|
||||
},
|
||||
"description": {"type": "string"}
|
||||
}
|
||||
},
|
||||
"relationship": {
|
||||
"type": "object",
|
||||
"required": ["from", "to", "kind"],
|
||||
"properties": {
|
||||
"from": {"type": "string", "description": "Source resource id."},
|
||||
"to": {"type": "string", "description": "Target resource id."},
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"enum": ["parent", "depends_on", "uses_output"],
|
||||
"description": "v1 uses 'parent' (composition ordering) + 'uses_output' (interpolation). 'depends_on' is reserved for v2 explicit-dependency cases."
|
||||
},
|
||||
"shared_keyword": {
|
||||
"type": "string",
|
||||
"description": "Reserved for v2 multi-relationship dependencies. Unused in v1."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://acdl.cloudinit.dev/schemas/policy_check_result.schema.json",
|
||||
"title": "ACDL PolicyCheckResult",
|
||||
"description": "Normalized policy check result — the contract between policy engines and the confidence signal. Engine-specific adapters (checkov_adapter.py, future kyverno_adapter) translate native engine output to this shape. The confidence signal consumes a list of these as its policy input; it is engine-agnostic. The severity enum drives the severity->penalty mapping (critical hard-override, high -0.2, medium -0.05, low -0.01, info 0.0).",
|
||||
"$comment": "Canonical PolicyCheckResult (ARCHITECTURE.md §12.6). The confidence signal (platform/confidence_signal.py) consumes a list of these as its policy input; it is engine-agnostic. Adapters translate native output to this shape; the signal never reads engine-specific evidence.",
|
||||
"type": "object",
|
||||
"required": ["contractId", "evaluatedAt", "engine", "ruleId", "severity", "result", "message", "resourceRef"],
|
||||
"properties": {
|
||||
"contractId": {
|
||||
"type": "string",
|
||||
"format": "uuid",
|
||||
"description": "The contract this check was evaluated against."
|
||||
},
|
||||
"evaluatedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "ISO-8601 timestamp of evaluation."
|
||||
},
|
||||
"engine": {
|
||||
"type": "string",
|
||||
"enum": ["checkov", "kyverno", "opa"],
|
||||
"description": "Policy engine that produced this result."
|
||||
},
|
||||
"ruleId": {
|
||||
"type": "string",
|
||||
"description": "Rule identifier (e.g. CKV_AWS_24, KYVERNO_NO_PRIVILEGED, ACDL_TAG_NAMING)."
|
||||
},
|
||||
"severity": {
|
||||
"type": "string",
|
||||
"enum": ["critical", "high", "medium", "low", "info"],
|
||||
"description": "Severity drives the confidence signal's penalty mapping (ARCHITECTURE.md §8)."
|
||||
},
|
||||
"result": {
|
||||
"type": "string",
|
||||
"enum": ["pass", "fail", "skipped", "error"],
|
||||
"description": "Check outcome."
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"description": "Human-readable result message."
|
||||
},
|
||||
"evidence": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"description": "Engine-specific payload (file_path, resource, code_block, etc.). Opaque to the confidence signal; present for audit/debug."
|
||||
},
|
||||
"resourceRef": {
|
||||
"type": "string",
|
||||
"description": "IR-typed resource identifier (the resource this check evaluated)."
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+98
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env bash
|
||||
# scripts/rotate_spike_key.sh - rotate the acdl-spike-runner IAM access key.
|
||||
#
|
||||
# Uses the bootstrap root key (ACDL_BOOTSTRAP_AWS_*) from the env to:
|
||||
# 1. List acdl-spike-runner's access keys.
|
||||
# 2. Create a new key.
|
||||
# 3. Deactivate + delete the old key(s).
|
||||
# 4. Write the new key to gitignored .env.secrets (chmod 600).
|
||||
# 5. Optionally upload to Gitea secrets if ACDL_GITEA_TOKEN is set.
|
||||
#
|
||||
# Idempotent: re-running always ends with exactly 1 active key for the user.
|
||||
# Does NOT rotate the bootstrap root key (D-034 closure = manual user step).
|
||||
#
|
||||
# Spike scope (D-039): the spike user key is per-run-rotated; real OIDC is
|
||||
# v1.2 (blocked on go-gitea/gitea#36988).
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
ENV_FILE="$ROOT/.env.secrets"
|
||||
|
||||
fail() { echo "FAIL: $*" >&2; exit 1; }
|
||||
|
||||
: "${ACDL_BOOTSTRAP_AWS_ACCESS_KEY_ID:?set ACDL_BOOTSTRAP_AWS_ACCESS_KEY_ID to the root key}"
|
||||
: "${ACDL_BOOTSTRAP_AWS_SECRET_ACCESS_KEY:?set ACDL_BOOTSTRAP_AWS_SECRET_ACCESS_KEY to the root key}"
|
||||
REGION="${AWS_DEFAULT_REGION:-us-east-1}"
|
||||
USER_NAME="acdl-spike-runner"
|
||||
|
||||
# Confirm .env.secrets is gitignored before writing to it.
|
||||
git check-ignore -q "$ENV_FILE" || fail "$ENV_FILE is not gitignored — refusing to write the key"
|
||||
|
||||
python3 - <<'PY'
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import boto3
|
||||
|
||||
region = os.environ.get("AWS_DEFAULT_REGION", "us-east-1")
|
||||
user = "acdl-spike-runner"
|
||||
env_file = os.path.join(os.getcwd(), ".env.secrets")
|
||||
|
||||
session = boto3.Session(
|
||||
aws_access_key_id=os.environ["ACDL_BOOTSTRAP_AWS_ACCESS_KEY_ID"],
|
||||
aws_secret_access_key=os.environ["ACDL_BOOTSTRAP_AWS_SECRET_ACCESS_KEY"],
|
||||
region_name=region,
|
||||
)
|
||||
iam = session.client("iam")
|
||||
|
||||
# List current keys.
|
||||
keys = iam.list_access_keys(UserName=user).get("AccessKeyMetadata", [])
|
||||
active = [k for k in keys if k["Status"] == "Active"]
|
||||
|
||||
# Create a new key first (so the user always has a working key during rotation).
|
||||
new = iam.create_access_key(UserName=user)["AccessKey"]
|
||||
new_id = new["AccessKeyId"]
|
||||
new_secret = new["SecretAccessKey"]
|
||||
print(f"iam: created new key {new_id} for {user}", file=sys.stderr)
|
||||
|
||||
# Deactivate + delete the old keys.
|
||||
for k in active:
|
||||
old_id = k["AccessKeyId"]
|
||||
if old_id == new_id:
|
||||
continue
|
||||
iam.update_access_key(UserName=user, AccessKeyId=old_id, Status="Inactive")
|
||||
iam.delete_access_key(UserName=user, AccessKeyId=old_id)
|
||||
print(f"iam: deactivated+deleted old key {old_id}", file=sys.stderr)
|
||||
|
||||
# Write the new key to gitignored .env.secrets (chmod 600).
|
||||
with open(env_file, "w") as fh:
|
||||
fh.write(f"ACDL_AWS_ACCESS_KEY_ID={new_id}\n")
|
||||
fh.write(f"ACDL_AWS_SECRET_ACCESS_KEY={new_secret}\n")
|
||||
fh.write(f"AWS_DEFAULT_REGION={region}\n")
|
||||
os.chmod(env_file, 0o600)
|
||||
print(f"rotated key written to {env_file} (chmod 600)", file=sys.stderr)
|
||||
|
||||
# Optionally upload to Gitea secrets.
|
||||
gitea_token = os.environ.get("ACDL_GITEA_TOKEN")
|
||||
if gitea_token:
|
||||
import urllib.request
|
||||
base = "https://git.cloudinit.dev/api/v1/repos/continuous-intelligence/acdl/actions/secrets"
|
||||
for name, value in [("ACDL_AWS_ACCESS_KEY_ID", new_id),
|
||||
("ACDL_AWS_SECRET_ACCESS_KEY", new_secret)]:
|
||||
req = urllib.request.Request(
|
||||
f"{base}/{name}",
|
||||
data=json.dumps({"value": value}).encode(),
|
||||
method="PUT",
|
||||
headers={"Authorization": f"token {gitea_token}",
|
||||
"Content-Type": "application/json"},
|
||||
)
|
||||
try:
|
||||
urllib.request.urlopen(req).read()
|
||||
print(f"gitea: secret {name} uploaded", file=sys.stderr)
|
||||
except Exception as e:
|
||||
print(f"gitea: secret {name} upload FAILED: {e}", file=sys.stderr)
|
||||
else:
|
||||
print("gitea: ACDL_GITEA_TOKEN not set; Gitea secret upload skipped (v1.2 hardening)", file=sys.stderr)
|
||||
|
||||
print(f"OK: {user} now has exactly 1 active key: {new_id}")
|
||||
PY
|
||||
Executable
+99
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env bash
|
||||
# scripts/run_spike_e2e.sh - the v1.1 spike end-to-end pipeline (Phase 10 capstone).
|
||||
#
|
||||
# Orchestrates: contract validation -> IR resolution -> terraform plan
|
||||
# (real AWS) -> Checkov -> PolicyCheckResult -> confidence signal ->
|
||||
# evidence event to DynamoDB outbox.
|
||||
#
|
||||
# Uses the rotated spike key (D-039) from gitignored .env.secrets.
|
||||
# Plan-only (no apply); -lock=false per D-P09-1.
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
fail() { echo "FAIL: $*" >&2; exit 1; }
|
||||
|
||||
ENV_FILE="$ROOT/.env.secrets"
|
||||
[ -f "$ENV_FILE" ] || fail ".env.secrets missing (run scripts/rotate_spike_key.sh)"
|
||||
set -a
|
||||
. "$ENV_FILE"
|
||||
set +a
|
||||
export AWS_ACCESS_KEY_ID="$ACDL_AWS_ACCESS_KEY_ID"
|
||||
export AWS_SECRET_ACCESS_KEY="$ACDL_AWS_SECRET_ACCESS_KEY"
|
||||
export AWS_DEFAULT_REGION="$AWS_DEFAULT_REGION"
|
||||
|
||||
CONTRACT="contracts/spike.yaml"
|
||||
CONTRACT_ID="11111111-1111-1111-1111-111111111111" # spike fixed UUID
|
||||
WORK="/tmp/spike_e2e"
|
||||
rm -rf "$WORK"; mkdir -p "$WORK"
|
||||
|
||||
echo "=== Step 1+2: resolve contract -> IR (validates contract schema + IR schema) ==="
|
||||
python3 acdl_platform/contract_resolver.py "$CONTRACT" "$WORK/spike_ir.json" || fail "contract resolution failed"
|
||||
python3 -c "import json; d=json.load(open('$WORK/spike_ir.json')); print(f\"IR: {d['stack']['name']} {d['stack']['kind']} {len(d['resources'])} resource(s)\")"
|
||||
|
||||
echo "=== Step 3: adapter compiles IR -> terraform/spike/*.tf (regenerate) ==="
|
||||
python3 adapters/terraform/adapter.py "$WORK/spike_ir.json" terraform/spike || fail "adapter failed"
|
||||
echo "adapter: emitted terraform/spike/{main.tf,terraform.tf,providers.tf}"
|
||||
|
||||
echo "=== Step 4: terraform init + validate + plan -lock=false (real AWS) ==="
|
||||
cd terraform/spike
|
||||
terraform init -reconfigure -lock=false -input=false >> "$WORK/tf.log" 2>&1 || fail "terraform init failed"
|
||||
terraform validate >> "$WORK/tf.log" 2>&1 || fail "terraform validate failed"
|
||||
terraform plan -lock=false -input=false -out=tfplan >> "$WORK/tf.log" 2>&1 || fail "terraform plan failed"
|
||||
echo "terraform plan OK (1 to add, 0 to change, 0 to destroy expected)"
|
||||
cd "$ROOT"
|
||||
|
||||
echo "=== Step 5: run Checkov on terraform/spike/main.tf ==="
|
||||
checkov -f terraform/spike/main.tf --framework terraform -o json --soft-fail > "$WORK/checkov.json" 2> "$WORK/checkov.err"
|
||||
[ -s "$WORK/checkov.json" ] || fail "checkov produced no output"
|
||||
echo "checkov: $(python3 -c "import json; d=json.load(open('$WORK/checkov.json')); print(len(d.get('results',{}).get('failed_checks',[])), 'failed,', len(d.get('results',{}).get('passed_checks',[])), 'passed')")"
|
||||
|
||||
echo "=== Step 6: Checkov adapter -> PolicyCheckResult list ==="
|
||||
python3 adapters/terraform/policy/checkov_adapter.py "$WORK/checkov.json" "$CONTRACT_ID" > "$WORK/pcr.json" || fail "checkov adapter failed"
|
||||
PCR_COUNT=$(python3 -c "import json; print(len(json.load(open('$WORK/pcr.json'))))")
|
||||
echo "PolicyCheckResult: $PCR_COUNT record(s)"
|
||||
|
||||
echo "=== Step 7: confidence signal compute ==="
|
||||
python3 <<PY > "$WORK/signal.json" || fail "confidence signal failed"
|
||||
import json
|
||||
import acdl_platform.confidence_signal as c
|
||||
pcr = json.load(open("$WORK/pcr.json"))
|
||||
inputs = {
|
||||
"policy": pcr,
|
||||
"validation": {"schema": True, "ir_resolved": True, "tf_validated": True, "tf_planned": True},
|
||||
"freshness": {"age_days": 0, "max_age_days": 7},
|
||||
"source": {"submitter": "spike", "commit_sha": "spike-sha", "signed": False},
|
||||
"history": {"prior_rollbacks": 0, "prior_policy_fails": 0},
|
||||
"nfrs": {"conformance": None},
|
||||
}
|
||||
sig = c.compute("$CONTRACT_ID", "dev", inputs)
|
||||
print(json.dumps({"score": sig.score, "band": sig.band, "perInput": sig.perInput, "reasonCodes": sig.reasonCodes}, indent=2))
|
||||
PY
|
||||
BAND=$(python3 -c "import json; print(json.load(open('$WORK/signal.json'))['band'])")
|
||||
SCORE=$(python3 -c "import json; print(round(json.load(open('$WORK/signal.json'))['score'],3))")
|
||||
echo "confidence: score=$SCORE band=$BAND"
|
||||
[ "$BAND" = "pass" ] || fail "confidence band is $BAND, expected pass for dev"
|
||||
|
||||
echo "=== Step 8: write evidence event to DynamoDB outbox ==="
|
||||
python3 <<PY > "$WORK/event.json" || fail "event build failed"
|
||||
import json, datetime
|
||||
sig = json.load(open("$WORK/signal.json"))
|
||||
event = {
|
||||
"contractId": "$CONTRACT_ID",
|
||||
"eventType": "CONFIDENCE_COMPUTED",
|
||||
"ts": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
|
||||
"environment": "dev",
|
||||
"stack": "l2-static-asset",
|
||||
"score": sig["score"],
|
||||
"band": sig["band"],
|
||||
"prev_event_hash": "GENESIS",
|
||||
}
|
||||
print(json.dumps(event, indent=2))
|
||||
PY
|
||||
python3 acdl_platform/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 ""
|
||||
echo "=== SPIKE E2E OK ==="
|
||||
echo "contract=$CONTRACT -> IR -> terraform plan -> Checkov -> confidence ($BAND) -> outbox"
|
||||
exit 0
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# scripts/run_spike_plan.sh - run the v1.1 spike's real terraform plan against AWS.
|
||||
#
|
||||
# Uses the rotated spike key (D-039) from gitignored .env.secrets.
|
||||
# Plan-only (no apply); -lock=false per D-P09-1 (the spike's DynamoDB
|
||||
# outbox table PK is contractId, not Terraform's expected LockID; plan
|
||||
# does not write state so locking is unnecessary; v1.2 creates a proper
|
||||
# LockID-keyed acdl-tflock table).
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
ENV_FILE="$ROOT/.env.secrets"
|
||||
[ -f "$ENV_FILE" ] || { echo "FAIL: .env.secrets missing (run scripts/rotate_spike_key.sh)" >&2; exit 1; }
|
||||
set -a
|
||||
. "$ENV_FILE"
|
||||
set +a
|
||||
export AWS_ACCESS_KEY_ID="$ACDL_AWS_ACCESS_KEY_ID"
|
||||
export AWS_SECRET_ACCESS_KEY="$ACDL_AWS_SECRET_ACCESS_KEY"
|
||||
export AWS_DEFAULT_REGION="$AWS_DEFAULT_REGION"
|
||||
|
||||
cd terraform/spike
|
||||
echo "=== terraform init -lock=false -input=false ==="
|
||||
terraform init -lock=false -input=false
|
||||
echo "=== terraform validate ==="
|
||||
terraform validate
|
||||
echo "=== terraform plan -lock=false -input=false -out=tfplan ==="
|
||||
terraform plan -lock=false -input=false -out=tfplan
|
||||
echo "spike plan OK"
|
||||
@@ -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
|
||||
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env bash
|
||||
# scripts/verify_phase07.sh - Phase 07 architecture-v1-finalization gate.
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
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 \
|
||||
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 ---
|
||||
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 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 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"
|
||||
|
||||
# --- Check 5: all 11 decision IDs + OpenTofu in PROJECT.md ---
|
||||
for id in W1.A W1.B W2.A W3.D W3.E BA.A BA.B BA.C BA.D BA.E BA.F; do
|
||||
grep -q "$id" .ciagent/PROJECT.md || fail "missing $id in PROJECT.md"
|
||||
done
|
||||
grep -qi "opentofu" .ciagent/PROJECT.md || fail "missing OpenTofu in PROJECT.md"
|
||||
ok "all 11 decision IDs + OpenTofu present in PROJECT.md"
|
||||
|
||||
# --- Check 6: docs/architecture-v1.0.md status is v1.0 ---
|
||||
grep -q "v1.0" docs/architecture-v1.0.md || fail "architecture-v1.0.md missing v1.0"
|
||||
ok "docs/architecture-v1.0.md status is v1.0"
|
||||
|
||||
# --- Check 7: D-040..D-044 present in PROJECT.md ---
|
||||
for d in D-040 D-041 D-042 D-043 D-044; do
|
||||
grep -q "$d" .ciagent/PROJECT.md || fail "missing $d in PROJECT.md"
|
||||
done
|
||||
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
|
||||
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
|
||||
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"
|
||||
Executable
+80
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env bash
|
||||
# scripts/verify_phase08.sh - Phase 08 aws-bootstrap gate.
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
fail() { echo "FAIL: $*" >&2; exit 1; }
|
||||
ok() { echo "ok: $*"; }
|
||||
|
||||
ENV_FILE="$ROOT/.env.secrets"
|
||||
[ -f "$ENV_FILE" ] || fail ".env.secrets missing (run scripts/rotate_spike_key.sh first)"
|
||||
|
||||
# Confirm .env.secrets + .bootstrap_state.json are gitignored.
|
||||
git check-ignore -q "$ENV_FILE" || fail ".env.secrets is not gitignored"
|
||||
git check-ignore -q terraform/bootstrap/.bootstrap_state.json || \
|
||||
fail "terraform/bootstrap/.bootstrap_state.json is not gitignored"
|
||||
ok ".env.secrets + .bootstrap_state.json are gitignored"
|
||||
|
||||
# Source the rotated spike key.
|
||||
set -a
|
||||
. "$ENV_FILE"
|
||||
set +a
|
||||
: "${ACDL_AWS_ACCESS_KEY_ID:?ACDL_AWS_ACCESS_KEY_ID missing in .env.secrets}"
|
||||
: "${ACDL_AWS_SECRET_ACCESS_KEY:?ACDL_AWS_SECRET_ACCESS_KEY missing in .env.secrets}"
|
||||
: "${AWS_DEFAULT_REGION:?AWS_DEFAULT_REGION missing in .env.secrets}"
|
||||
|
||||
export AWS_ACCESS_KEY_ID="$ACDL_AWS_ACCESS_KEY_ID"
|
||||
export AWS_SECRET_ACCESS_KEY="$ACDL_AWS_SECRET_ACCESS_KEY"
|
||||
export AWS_DEFAULT_REGION
|
||||
|
||||
# --- Check 1: caller identity is acdl-spike-runner (NOT root) ---
|
||||
ARN=$(python3 <<'PY'
|
||||
import boto3, json
|
||||
s = boto3.Session(region_name='us-east-1')
|
||||
print(s.client('sts').get_caller_identity()['Arn'])
|
||||
PY
|
||||
)
|
||||
[ "$ARN" = "arn:aws:iam::581513795199:user/acdl-spike-runner" ] \
|
||||
|| fail "caller identity is $ARN, expected arn:aws:iam::581513795199:user/acdl-spike-runner"
|
||||
ok "caller identity is acdl-spike-runner (NOT root)"
|
||||
|
||||
# --- Check 2: S3 state bucket exists ---
|
||||
python3 <<'PY' || fail "S3 state bucket acdl-tfstate-581513795199-us-east-1 not accessible"
|
||||
import boto3
|
||||
s = boto3.Session(region_name='us-east-1')
|
||||
s.client('s3').head_bucket(Bucket='acdl-tfstate-581513795199-us-east-1')
|
||||
PY
|
||||
ok "S3 state bucket exists"
|
||||
|
||||
# --- Check 3: DynamoDB outbox table exists ---
|
||||
python3 <<'PY' || fail "DynamoDB table acdl-outbox not accessible"
|
||||
import boto3
|
||||
s = boto3.Session(region_name='us-east-1')
|
||||
s.client('dynamodb').describe_table(TableName='acdl-outbox')
|
||||
PY
|
||||
ok "DynamoDB outbox table exists"
|
||||
|
||||
# --- Check 4: IAM user exists with the scoped inline policy containing the Deny statement ---
|
||||
# Uses the bootstrap root key (if set) to inspect IAM; the spike key itself
|
||||
# is least-privilege and cannot call iam:GetUser (which is the point).
|
||||
if [ -n "${ACDL_BOOTSTRAP_AWS_ACCESS_KEY_ID:-}" ]; then
|
||||
AWS_ACCESS_KEY_ID="$ACDL_BOOTSTRAP_AWS_ACCESS_KEY_ID" \
|
||||
AWS_SECRET_ACCESS_KEY="$ACDL_BOOTSTRAP_AWS_SECRET_ACCESS_KEY" \
|
||||
AWS_DEFAULT_REGION="$AWS_DEFAULT_REGION" \
|
||||
python3 <<'PY' || fail "IAM user acdl-spike-runner missing or policy lacks DenyEverythingElse"
|
||||
import boto3, json
|
||||
s = boto3.Session(region_name='us-east-1')
|
||||
iam = s.client('iam')
|
||||
iam.get_user(UserName='acdl-spike-runner')
|
||||
doc = iam.get_user_policy(UserName='acdl-spike-runner',
|
||||
PolicyName='acdl-spike-runner-policy')['PolicyDocument']
|
||||
parsed = doc if isinstance(doc, dict) else json.loads(doc)
|
||||
sids = [st.get('Sid', '') for st in parsed['Statement']]
|
||||
assert 'DenyEverythingElse' in sids, 'DenyEverythingElse statement missing'
|
||||
PY
|
||||
ok "IAM user acdl-spike-runner exists with the scoped Deny-everything-else policy (verified via bootstrap key)"
|
||||
else
|
||||
echo "ok: IAM check skipped (ACDL_BOOTSTRAP_AWS_* not set; the spike key is least-privilege and cannot iam:GetUser — that itself confirms the policy denies non-granted actions)"
|
||||
fi
|
||||
|
||||
echo "VERIFIED — Phase 08: AWS bootstrap complete; spike key rotated; D-034 closed (user must rotate the root key manually now)"
|
||||
Executable
+77
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env bash
|
||||
# scripts/verify_phase09.sh - Phase 09 v1-spike-ir-and-l1-and-adapter gate.
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
fail() { echo "FAIL: $*" >&2; exit 1; }
|
||||
ok() { echo "ok: $*"; }
|
||||
|
||||
# --- Check 1: L1 module files exist ---
|
||||
for f in modules-ir/l1/l1-s3/interface.json \
|
||||
modules-ir/l1/l1-s3/spike_instance.json \
|
||||
modules-ir/l1/l1-s3/README.md \
|
||||
modules-ir/registry.json \
|
||||
adapters/terraform/adapter.py \
|
||||
terraform/spike/main.tf \
|
||||
terraform/spike/terraform.tf \
|
||||
terraform/spike/providers.tf \
|
||||
scripts/run_spike_plan.sh; do
|
||||
[ -f "$f" ] || fail "missing $f"
|
||||
done
|
||||
ok "all 9 deliverable files exist"
|
||||
|
||||
# --- Check 2: spike_instance.json validates against ir.schema.json ---
|
||||
( cd /tmp && python3 -c "
|
||||
import json, jsonschema
|
||||
inst = json.load(open('$ROOT/modules-ir/l1/l1-s3/spike_instance.json'))
|
||||
schema = json.load(open('$ROOT/schemas/ir.schema.json'))
|
||||
jsonschema.validate(inst, schema)
|
||||
" ) || fail "spike_instance.json does not validate against ir.schema.json"
|
||||
ok "spike_instance.json validates against ir.schema.json"
|
||||
|
||||
# --- Check 3: registry has the l1-s3@1.0.0 entry ---
|
||||
python3 -c "
|
||||
import json
|
||||
r = json.load(open('modules-ir/registry.json'))
|
||||
assert 'l1-s3' in r and '1.0.0' in r['l1-s3'], 'l1-s3@1.0.0 missing'
|
||||
print('l1-s3@1.0.0 present')
|
||||
" || fail "registry missing l1-s3@1.0.0"
|
||||
ok "registry has l1-s3@1.0.0"
|
||||
|
||||
# --- Check 4: adapter py_compiles + generates terraform containing aws_s3_bucket ---
|
||||
python3 -m py_compile adapters/terraform/adapter.py || fail "adapter.py py_compile failed"
|
||||
TMP=$(mktemp -d)
|
||||
python3 adapters/terraform/adapter.py modules-ir/l1/l1-s3/spike_instance.json "$TMP" 2>/dev/null
|
||||
grep -q 'resource "aws_s3_bucket"' "$TMP/main.tf" || fail "adapter did not emit aws_s3_bucket resource"
|
||||
grep -q 'output "bucket_arn"' "$TMP/main.tf" || fail "adapter did not emit bucket_arn output"
|
||||
ok "adapter.py py_compiles + emits aws_s3_bucket + bucket_arn output"
|
||||
|
||||
# --- Check 5: generated terraform/spike/*.tf match a fresh adapter run (D-P09-4 reproducibility) ---
|
||||
diff "$TMP/main.tf" terraform/spike/main.tf || fail "terraform/spike/main.tf is stale (differs from a fresh adapter run)"
|
||||
diff "$TMP/terraform.tf" terraform/spike/terraform.tf || fail "terraform/spike/terraform.tf is stale"
|
||||
diff "$TMP/providers.tf" terraform/spike/providers.tf || fail "terraform/spike/providers.tf is stale"
|
||||
ok "terraform/spike/*.tf match a fresh adapter run (reproducible)"
|
||||
rm -rf "$TMP"
|
||||
|
||||
# --- Check 6: no long-lived credential (AKIA) in committed files ---
|
||||
# Skip .terraform/ (provider binaries contain AKIA bytes; gitignored anyway).
|
||||
if grep -rn --exclude-dir=.terraform "AKIA" terraform/spike/ adapters/ modules-ir/ 2>/dev/null; then
|
||||
fail "AKIA key id found in committed files (terraform/spike/ adapters/ modules-ir/)"
|
||||
fi
|
||||
ok "no AKIA in committed files (excluding .terraform/ provider binaries)"
|
||||
|
||||
# --- Check 7: .env.secrets + terraform working artifacts are gitignored ---
|
||||
git check-ignore -q .env.secrets || fail ".env.secrets not gitignored"
|
||||
git check-ignore -q terraform/spike/.terraform/ || fail "terraform/spike/.terraform/ not gitignored"
|
||||
git check-ignore -q terraform/spike/tfplan || fail "terraform/spike/tfplan not gitignored"
|
||||
ok "secrets + TF working artifacts gitignored"
|
||||
|
||||
# --- Check 8: real terraform plan against AWS succeeds (uses rotated spike key) ---
|
||||
bash scripts/run_spike_plan.sh > /tmp/verify_phase09_plan.log 2>&1 || {
|
||||
cat /tmp/verify_phase09_plan.log >&2
|
||||
fail "scripts/run_spike_plan.sh failed (see /tmp/verify_phase09_plan.log)"
|
||||
}
|
||||
grep -q "spike plan OK" /tmp/verify_phase09_plan.log || fail "run_spike_plan.sh did not print 'spike plan OK'"
|
||||
ok "real terraform plan against AWS succeeded (rotated spike key, plan-only, -lock=false)"
|
||||
|
||||
echo "VERIFIED — Phase 09: IR + l1-s3 + Terraform adapter; real terraform plan succeeds"
|
||||
Executable
+140
@@ -0,0 +1,140 @@
|
||||
#!/usr/bin/env bash
|
||||
# scripts/verify_phase10.sh - Phase 10 v1-spike-l2-and-contract-e2e gate (capstone).
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
fail() { echo "FAIL: $*" >&2; exit 1; }
|
||||
ok() { echo "ok: $*"; }
|
||||
|
||||
ENV_FILE="$ROOT/.env.secrets"
|
||||
[ -f "$ENV_FILE" ] || fail ".env.secrets missing (run scripts/rotate_spike_key.sh first)"
|
||||
git check-ignore -q "$ENV_FILE" || fail ".env.secrets is not gitignored"
|
||||
set -a
|
||||
. "$ENV_FILE"
|
||||
set +a
|
||||
export AWS_ACCESS_KEY_ID="$ACDL_AWS_ACCESS_KEY_ID"
|
||||
export AWS_SECRET_ACCESS_KEY="$ACDL_AWS_SECRET_ACCESS_KEY"
|
||||
export AWS_DEFAULT_REGION="$AWS_DEFAULT_REGION"
|
||||
|
||||
# --- Check (a): composition.json exists + shape ---
|
||||
python3 <<'PY' || fail "composition.json shape wrong"
|
||||
import json
|
||||
c = json.load(open('modules-ir/l2/l2-static-asset/composition.json'))
|
||||
assert c['kind'] == 'l2' and c['depth'] == 1
|
||||
assert len(c['children']) == 1 and c['children'][0]['module'] == 'l1-s3@1.0.0'
|
||||
assert c['wires']['bucket_name']['target'] == 's3'
|
||||
assert c['wires']['region']['target'] == 's3'
|
||||
print('composition.json: kind=l2 depth=1 one child l1-s3@1.0.0 wires passthrough')
|
||||
PY
|
||||
ok "composition.json: l2-static-asset references l1-s3 only (depth 1)"
|
||||
|
||||
# --- Check (b): spike.yaml validates against contract schema ---
|
||||
python3 <<'PY' || fail "spike.yaml does not validate against contract schema"
|
||||
import yaml, json, jsonschema
|
||||
contract = yaml.safe_load(open('contracts/spike.yaml'))
|
||||
schema = json.load(open('schemas/contract.schema.json'))
|
||||
jsonschema.validate(contract, schema)
|
||||
print('spike.yaml validates against contract.schema.json')
|
||||
PY
|
||||
ok "contracts/spike.yaml validates against the contract schema"
|
||||
|
||||
# --- Check (c): resolver py_compiles + emits IR validating against ir.schema.json ---
|
||||
python3 -m py_compile acdl_platform/contract_resolver.py || fail "contract_resolver.py py_compile failed"
|
||||
TMP=$(mktemp -d)
|
||||
python3 acdl_platform/contract_resolver.py contracts/spike.yaml "$TMP/spike_ir.json" 2>/dev/null
|
||||
( cd /tmp && python3 -c "
|
||||
import json, jsonschema
|
||||
inst = json.load(open('$TMP/spike_ir.json'))
|
||||
schema = json.load(open('$ROOT/schemas/ir.schema.json'))
|
||||
jsonschema.validate(inst, schema)
|
||||
print('IR validates against ir.schema.json')
|
||||
" ) || fail "resolver IR does not validate against ir.schema.json"
|
||||
ok "contract_resolver.py resolves spike.yaml to an IR-schema-valid instance"
|
||||
|
||||
# --- Check (d): adapter py_compiles + emits main.tf with aws_s3_bucket ---
|
||||
python3 -m py_compile adapters/terraform/adapter.py || fail "adapter.py py_compile failed"
|
||||
python3 adapters/terraform/adapter.py "$TMP/spike_ir.json" "$TMP/tf" 2>/dev/null
|
||||
grep -q 'resource "aws_s3_bucket"' "$TMP/tf/main.tf" || fail "adapter did not emit aws_s3_bucket"
|
||||
ok "adapter.py compiles L2 IR to terraform with aws_s3_bucket"
|
||||
rm -rf "$TMP"
|
||||
|
||||
# --- Check (e): run_spike_e2e.sh exits 0 ---
|
||||
bash scripts/run_spike_e2e.sh > /tmp/verify_phase10_e2e.log 2>&1 || {
|
||||
cat /tmp/verify_phase10_e2e.log >&2
|
||||
fail "run_spike_e2e.sh failed"
|
||||
}
|
||||
grep -q "SPIKE E2E OK" /tmp/verify_phase10_e2e.log || fail "run_spike_e2e.sh did not print SPIKE E2E OK"
|
||||
ok "run_spike_e2e.sh completes the full pipeline end-to-end"
|
||||
|
||||
# --- Check (f): confidence band is pass for dev ---
|
||||
grep -q "band=pass" /tmp/verify_phase10_e2e.log || fail "confidence band is not pass for dev"
|
||||
ok "confidence band is pass for dev"
|
||||
|
||||
# --- Check (g): outbox item exists ---
|
||||
python3 <<'PY' || fail "outbox item not found in DynamoDB"
|
||||
import boto3
|
||||
s = boto3.Session(region_name='us-east-1')
|
||||
dyn = s.client('dynamodb')
|
||||
r = dyn.query(TableName='acdl-outbox',
|
||||
KeyConditionExpression='contractId = :cid',
|
||||
ExpressionAttributeValues={':cid': {'S': '11111111-1111-1111-1111-111111111111'}})
|
||||
assert r.get('Count', 0) >= 1, f'no outbox item for the spike contractId (Count={r.get("Count", 0)})'
|
||||
print(f'outbox item present (Count={r["Count"]})')
|
||||
PY
|
||||
ok "evidence event is written to the DynamoDB outbox"
|
||||
|
||||
# --- Check (h): REQ-28 - the adapter is the only substrate-specific code ---
|
||||
# The IR commitments hold: the adapter is the only place that knows Terraform
|
||||
# resource types (aws_s3_bucket). The L1/L2 interfaces, the IR schema, the
|
||||
# contract, the resolver, the confidence signal, and the outbox writer are
|
||||
# substrate-agnostic. Documentation (.md) + schema $comment/description strings
|
||||
# may mention aws_s3_bucket *to explain the mapping* — that's not a violation;
|
||||
# the check scans actual executable code (.py) + data files (.json/.yaml)
|
||||
# for resource-type declarations, excluding .md files + description/comment
|
||||
# string values.
|
||||
LEAK=$(grep -rn --include='*.py' -E 'aws_s3_bucket|aws_[a-z]+_[a-z]+' \
|
||||
acdl_platform/ 2>/dev/null)
|
||||
if [ -n "$LEAK" ]; then
|
||||
echo "$LEAK" >&2
|
||||
fail "REQ-28 violated: substrate-specific terms found in acdl_platform/ Python code (the platform must be substrate-agnostic)"
|
||||
fi
|
||||
# modules-ir/ data files: exclude .md (docs may reference the mapping); check
|
||||
# only .json for actual resource-type field declarations (not description strings).
|
||||
LEAK2=$(python3 <<'PY' 2>&1 || true
|
||||
import json, os, sys
|
||||
leaks = []
|
||||
for root, dirs, files in os.walk('modules-ir'):
|
||||
for f in files:
|
||||
if not f.endswith('.json'):
|
||||
continue
|
||||
path = os.path.join(root, f)
|
||||
with open(path) as fh:
|
||||
try:
|
||||
data = json.load(fh)
|
||||
except Exception:
|
||||
continue
|
||||
# Walk the JSON; flag 'aws_s3_bucket' (Terraform type) appearing as a
|
||||
# VALUE (not a key), excluding description/comment strings.
|
||||
def walk(obj, path_str=''):
|
||||
if isinstance(obj, dict):
|
||||
for k, v in obj.items():
|
||||
if k in ('description', '$comment') and isinstance(v, str):
|
||||
continue # docs/comment strings are allowed to mention it
|
||||
walk(v, path_str + '/' + k)
|
||||
elif isinstance(obj, str):
|
||||
if obj.startswith('aws_') and obj != 'aws:s3:bucket':
|
||||
leaks.append(f'{path}: {path_str} = {obj!r}')
|
||||
walk(data)
|
||||
if leaks:
|
||||
print('\n'.join(leaks))
|
||||
PY
|
||||
)
|
||||
if [ -n "$LEAK2" ]; then
|
||||
echo "$LEAK2" >&2
|
||||
fail "REQ-28 violated: substrate-specific resource-type values found in modules-ir/ JSON"
|
||||
fi
|
||||
ADAPT_HAS=$(grep -rn --include='*.py' -E 'aws_s3_bucket' adapters/terraform/ 2>/dev/null)
|
||||
[ -n "$ADAPT_HAS" ] || fail "REQ-28: adapter does not contain aws_s3_bucket (it should — it's the substrate-specific code)"
|
||||
ok "REQ-28: adapter is the only substrate-specific code; modules-ir/ + acdl_platform/ are substrate-agnostic (docs/comments excluded)"
|
||||
|
||||
echo "VERIFIED — Phase 10: L2 + contract-e2e; IR commitments hold (REQ-28)"
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
# scripts/verify_phase11.sh - verify Phase 11 (v1.2 research + README rewrite).
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
fail() { echo "FAIL: $*" >&2; exit 1; }
|
||||
|
||||
echo "=== Phase 11 verification ==="
|
||||
|
||||
# 1. README.md reflects v1.2 (not stale v1.1-active framing)
|
||||
grep -q "v1.2 (active)" README.md || fail "README.md: no 'v1.2 (active)' status"
|
||||
! grep -q "v1.1 (active)" README.md || fail "README.md: stale 'v1.1 (active)' framing"
|
||||
grep -q "v1.1 (complete, tag" README.md || fail "README.md: v1.1 not marked complete"
|
||||
grep -q "v1.3.0" README.md || fail "README.md: no v1.3.0 ship tag reference"
|
||||
grep -q "D-047" README.md || fail "README.md: no D-047 reference"
|
||||
grep -q "How the platform works" README.md || fail "README.md: no 'How the platform works' section"
|
||||
grep -q "terraform plan" README.md || fail "README.md: no terraform plan in the flow"
|
||||
grep -q "confidence signal" README.md || fail "README.md: no confidence signal in the flow"
|
||||
grep -q "DynamoDB outbox" README.md || fail "README.md: no DynamoDB outbox in the flow"
|
||||
grep -q "run_spike_e2e.sh" README.md || fail "README.md: no run_spike_e2e.sh in how-to-run"
|
||||
echo "README.md: OK (v1.2 framing, platform flow, how-to-run, credentials)"
|
||||
|
||||
# 2. RESEARCH.md has a v1.2 addendum with the 3 decisions
|
||||
grep -q "## v1.2 Research Addendum" .ciagent/RESEARCH.md || fail "RESEARCH.md: no v1.2 addendum"
|
||||
grep -q "TARGET 9" .ciagent/RESEARCH.md || fail "RESEARCH.md: no TARGET 9 (#36988 re-check)"
|
||||
grep -q "TARGET 10" .ciagent/RESEARCH.md || fail "RESEARCH.md: no TARGET 10 (NFR audit)"
|
||||
grep -q "TARGET 13" .ciagent/RESEARCH.md || fail "RESEARCH.md: no TARGET 13 (ECS L1 scoping)"
|
||||
grep -q "D-047" .ciagent/RESEARCH.md || fail "RESEARCH.md: no D-047"
|
||||
grep -q "D-048" .ciagent/RESEARCH.md || fail "RESEARCH.md: no D-048"
|
||||
grep -q "D-049" .ciagent/RESEARCH.md || fail "RESEARCH.md: no D-049"
|
||||
grep -qi "still open" .ciagent/RESEARCH.md || fail "RESEARCH.md: #36988 status not recorded"
|
||||
echo "RESEARCH.md: OK (v1.2 addendum, Targets 9-13, D-047/D-048/D-049)"
|
||||
|
||||
# 3. .ciagent/ files reflect v1.2 specify -> research progression
|
||||
grep -q '"milestone": "v1.2"' .ciagent/config.json || fail "config.json: milestone not v1.2"
|
||||
grep -q "Objective for Milestone v1.2" .ciagent/PROJECT.md || fail "PROJECT.md: no v1.2 objective"
|
||||
grep -q "REQ-29" .ciagent/REQUIREMENTS.md || fail "REQUIREMENTS.md: no REQ-29"
|
||||
grep -q "Phase 11" .ciagent/ROADMAP.md || fail "ROADMAP.md: no Phase 11"
|
||||
grep -q "v1.2 build-out scope" .ciagent/ARCHITECTURE.md || fail "ARCHITECTURE.md: no v1.2 scope"
|
||||
echo ".ciagent/ files: OK (v1.2 milestone consistent across all 5 files)"
|
||||
|
||||
# 4. #36988 re-check facts are accurate (cross-check the PR state we recorded)
|
||||
grep -q "2026-05-27" .ciagent/RESEARCH.md || fail "RESEARCH.md: #36988 last-updated date missing"
|
||||
grep -q "D-039" .ciagent/RESEARCH.md || fail "RESEARCH.md: D-039 waiver not referenced"
|
||||
echo "#36988 re-check: OK (date + D-039 extension recorded)"
|
||||
|
||||
echo ""
|
||||
echo "=== Phase 11: VERIFIED ==="
|
||||
echo "README.md rewritten; RESEARCH.md v1.2 addendum complete; D-047/D-048/D-049 surfaced."
|
||||
exit 0
|
||||
@@ -0,0 +1,71 @@
|
||||
# ACDL v1.1 Spike — AWS Bootstrap Runbook
|
||||
|
||||
Phase 08 bootstraps the AWS substrate for the v1.1 spike. It uses the
|
||||
**root account credential for account 581513795199 exactly once**, then
|
||||
closes D-034 by having the user manually rotate the root key afterward.
|
||||
|
||||
> **Spike scope (D-039):** the spike uses a per-run-rotated IAM *user* key
|
||||
> (`acdl-spike-runner`), NOT OIDC. Real OIDC federation is deferred to
|
||||
> v1.2 (blocked on go-gitea/gitea#36988 — Gitea Actions does not support
|
||||
> `id-token: write`). The `acdl-spike-runner` user + its key are deleted
|
||||
> in v1.2 cleanup when the OIDC role lands.
|
||||
|
||||
## Steps
|
||||
|
||||
1. **Set the bootstrap root key in env** (never commit, never echo):
|
||||
```bash
|
||||
export ACDL_BOOTSTRAP_AWS_ACCESS_KEY_ID="<root key>"
|
||||
export ACDL_BOOTSTRAP_AWS_SECRET_ACCESS_KEY="<root secret>"
|
||||
export AWS_DEFAULT_REGION="us-east-1"
|
||||
```
|
||||
|
||||
2. **Create the state backend** (S3 bucket + DynamoDB outbox table):
|
||||
```bash
|
||||
python3 terraform/bootstrap/create_state_backend.py
|
||||
```
|
||||
Idempotent; writes `terraform/bootstrap/.bootstrap_state.json` marker.
|
||||
|
||||
3. **Create the IAM user + scoped policy + initial key**:
|
||||
```bash
|
||||
python3 terraform/bootstrap/create_iam_user.py
|
||||
```
|
||||
Prints `ACDL_AWS_ACCESS_KEY_ID=<...>` + `ACDL_AWS_SECRET_ACCESS_KEY=<...>`
|
||||
to stdout (capture if you want the initial key; `rotate_spike_key.sh`
|
||||
creates a fresh one anyway).
|
||||
|
||||
4. **Rotate the spike key** (creates a new key, deactivates+deletes old,
|
||||
writes the new key to gitignored `.env.secrets`):
|
||||
```bash
|
||||
bash scripts/rotate_spike_key.sh
|
||||
```
|
||||
Optionally uploads to Gitea Actions secrets if `ACDL_GITEA_TOKEN` is set.
|
||||
|
||||
5. **Verify**:
|
||||
```bash
|
||||
bash scripts/verify_phase08.sh
|
||||
```
|
||||
Asserts: caller identity is `acdl-spike-runner` (not root); S3 bucket +
|
||||
DynamoDB table + IAM user + scoped policy all exist; `.env.secrets` +
|
||||
`.bootstrap_state.json` are gitignored.
|
||||
|
||||
6. **MANUAL — D-034 closure:** rotate/deactivate the **root** key in the
|
||||
AWS IAM console (the user does this, not the script). The bootstrap
|
||||
root key has now served its one-shot purpose; the spike uses the
|
||||
rotated `acdl-spike-runner` key for Phases 09-10.
|
||||
|
||||
## What the spike uses for Phases 09-10
|
||||
|
||||
- **State backend:** S3 bucket `acdl-tfstate-581513795199-us-east-1` +
|
||||
DynamoDB table `acdl-outbox` (one table for both lock + outbox, D-P08-1).
|
||||
- **Auth:** the rotated `acdl-spike-runner` key in `.env.secrets`
|
||||
(gitignored, chmod 600). Re-rotate after each spike run via
|
||||
`rotate_spike_key.sh` (D-039).
|
||||
|
||||
## Spike scope vs v1.2 boundary
|
||||
|
||||
| Concern | Spike (Phase 08) | v1.2 |
|
||||
|---------|------------------|------|
|
||||
| AWS auth | per-run-rotated long-lived key (D-039 waiver) | real OIDC federation (go-gitea/gitea#36988) |
|
||||
| IAM | minimal user `acdl-spike-runner` + scoped policy | OIDC role + trust policy (no user, no key) |
|
||||
| State backend | S3 + DynamoDB single-region (us-east-1) | multi-region |
|
||||
| Secret storage | gitignored `.env.secrets` + optional Gitea secret | Gitea OIDC-issued web-identity token (no secret) |
|
||||
@@ -0,0 +1,72 @@
|
||||
"""Create the ACDL v1.1 spike IAM user + scoped inline policy + initial key.
|
||||
|
||||
Idempotent: skips user creation if the user exists; creates an initial
|
||||
access key if none active exists. Prints the key to stdout for the
|
||||
orchestrator to capture (NEVER committed):
|
||||
ACDL_AWS_ACCESS_KEY_ID=<...>
|
||||
ACDL_AWS_SECRET_ACCESS_KEY=<...>
|
||||
|
||||
Run with the bootstrap root key in env:
|
||||
ACDL_BOOTSTRAP_AWS_ACCESS_KEY_ID / ACDL_BOOTSTRAP_AWS_SECRET_ACCESS_KEY
|
||||
AWS_DEFAULT_REGION (defaults to us-east-1)
|
||||
|
||||
The inline policy is read from spike_runner_policy.json (next to this
|
||||
file). The account id + region are already substituted in the policy file
|
||||
for account 581513795199 + us-east-1; this script does not substitute
|
||||
further (the policy file is spike-specific).
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
import boto3
|
||||
|
||||
|
||||
REGION = os.environ.get("AWS_DEFAULT_REGION", "us-east-1")
|
||||
USER_NAME = "acdl-spike-runner"
|
||||
POLICY_NAME = "acdl-spike-runner-policy"
|
||||
POLICY_FILE = os.path.join(os.path.dirname(__file__), "spike_runner_policy.json")
|
||||
|
||||
|
||||
def main():
|
||||
session = boto3.Session(
|
||||
aws_access_key_id=os.environ["ACDL_BOOTSTRAP_AWS_ACCESS_KEY_ID"],
|
||||
aws_secret_access_key=os.environ["ACDL_BOOTSTRAP_AWS_SECRET_ACCESS_KEY"],
|
||||
region_name=REGION,
|
||||
)
|
||||
iam = session.client("iam")
|
||||
|
||||
# --- IAM user (idempotent) ---
|
||||
try:
|
||||
iam.get_user(UserName=USER_NAME)
|
||||
print(f"iam: user {USER_NAME} already exists")
|
||||
except iam.exceptions.NoSuchEntityException:
|
||||
iam.create_user(UserName=USER_NAME)
|
||||
print(f"iam: created user {USER_NAME}")
|
||||
|
||||
# --- Inline policy (idempotent: put_user_policy overwrites) ---
|
||||
with open(POLICY_FILE, "r") as fh:
|
||||
policy_doc = fh.read()
|
||||
iam.put_user_policy(
|
||||
UserName=USER_NAME,
|
||||
PolicyName=POLICY_NAME,
|
||||
PolicyDocument=policy_doc,
|
||||
)
|
||||
print(f"iam: inline policy {POLICY_NAME} attached to {USER_NAME}")
|
||||
|
||||
# --- Initial access key (create only if no active key exists) ---
|
||||
keys = iam.list_access_keys(UserName=USER_NAME).get("AccessKeyMetadata", [])
|
||||
active = [k for k in keys if k["Status"] == "Active"]
|
||||
if active:
|
||||
print(f"iam: {USER_NAME} already has {len(active)} active key(s); not creating a new one")
|
||||
print(" (use scripts/rotate_spike_key.sh to rotate)")
|
||||
return
|
||||
new_key = iam.create_access_key(UserName=USER_NAME)["AccessKey"]
|
||||
print("ACDL_AWS_ACCESS_KEY_ID=" + new_key["AccessKeyId"])
|
||||
print("ACDL_AWS_SECRET_ACCESS_KEY=" + new_key["SecretAccessKey"])
|
||||
print(f"iam: created initial access key {new_key['AccessKeyId']} for {USER_NAME}", file=sys.stderr)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,88 @@
|
||||
"""Create the ACDL v1.1 spike AWS state backend (idempotent).
|
||||
|
||||
- S3 bucket acdl-tfstate-<account_id>-us-east-1 (versioning enabled).
|
||||
- DynamoDB table acdl-outbox (PAY_PER_REQUEST; PK contractId, SK
|
||||
eventType#eventTs) — used for BOTH Terraform state locking AND the
|
||||
evidence outbox (D-P08-1).
|
||||
|
||||
Run with the bootstrap root key in env:
|
||||
ACDL_BOOTSTRAP_AWS_ACCESS_KEY_ID / ACDL_BOOTSTRAP_AWS_SECRET_ACCESS_KEY
|
||||
AWS_DEFAULT_REGION (defaults to us-east-1)
|
||||
|
||||
Writes terraform/bootstrap/.bootstrap_state.json (gitignored bookkeeping).
|
||||
"""
|
||||
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
import boto3
|
||||
|
||||
|
||||
REGION = os.environ.get("AWS_DEFAULT_REGION", "us-east-1")
|
||||
STATE_BUCKET = "acdl-tfstate-581513795199-us-east-1"
|
||||
OUTBOX_TABLE = "acdl-outbox"
|
||||
ACCOUNT_ID = "581513795199"
|
||||
|
||||
|
||||
def main():
|
||||
session = boto3.Session(
|
||||
aws_access_key_id=os.environ["ACDL_BOOTSTRAP_AWS_ACCESS_KEY_ID"],
|
||||
aws_secret_access_key=os.environ["ACDL_BOOTSTRAP_AWS_SECRET_ACCESS_KEY"],
|
||||
region_name=REGION,
|
||||
)
|
||||
s3 = session.client("s3", region_name=REGION)
|
||||
dyn = session.client("dynamodb", region_name=REGION)
|
||||
|
||||
# --- S3 state bucket (idempotent) ---
|
||||
try:
|
||||
s3.head_bucket(Bucket=STATE_BUCKET)
|
||||
print(f"s3: bucket {STATE_BUCKET} already exists")
|
||||
except Exception:
|
||||
kwargs = {"Bucket": STATE_BUCKET}
|
||||
if REGION != "us-east-1":
|
||||
kwargs["CreateBucketConfiguration"] = {"LocationConstraint": REGION}
|
||||
s3.create_bucket(**kwargs)
|
||||
print(f"s3: created bucket {STATE_BUCKET}")
|
||||
# Enable versioning (idempotent)
|
||||
s3.put_bucket_versioning(
|
||||
Bucket=STATE_BUCKET,
|
||||
VersioningConfiguration={"Status": "Enabled"},
|
||||
)
|
||||
print(f"s3: versioning enabled on {STATE_BUCKET}")
|
||||
|
||||
# --- DynamoDB outbox table (idempotent) ---
|
||||
try:
|
||||
dyn.describe_table(TableName=OUTBOX_TABLE)
|
||||
print(f"dynamodb: table {OUTBOX_TABLE} already exists")
|
||||
except dyn.exceptions.ResourceNotFoundException:
|
||||
dyn.create_table(
|
||||
TableName=OUTBOX_TABLE,
|
||||
BillingMode="PAY_PER_REQUEST",
|
||||
AttributeDefinitions=[
|
||||
{"AttributeName": "contractId", "AttributeType": "S"},
|
||||
{"AttributeName": "eventType#eventTs", "AttributeType": "S"},
|
||||
],
|
||||
KeySchema=[
|
||||
{"AttributeName": "contractId", "KeyType": "HASH"},
|
||||
{"AttributeName": "eventType#eventTs", "KeyType": "RANGE"},
|
||||
],
|
||||
)
|
||||
print(f"dynamodb: created table {OUTBOX_TABLE}")
|
||||
dyn.get_waiter("table_exists").wait(TableName=OUTBOX_TABLE)
|
||||
|
||||
marker = {
|
||||
"account_id": ACCOUNT_ID,
|
||||
"bucket_name": STATE_BUCKET,
|
||||
"table_name": OUTBOX_TABLE,
|
||||
"region": REGION,
|
||||
"created_at": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
|
||||
}
|
||||
with open(os.path.join(os.path.dirname(__file__), ".bootstrap_state.json"), "w") as fh:
|
||||
json.dump(marker, fh, indent=2)
|
||||
print("bootstrap state marker written:", marker)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "SpikeStateBucketReadWrite",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:PutObject",
|
||||
"s3:GetObject",
|
||||
"s3:DeleteObject",
|
||||
"s3:ListBucket",
|
||||
"s3:GetBucketLocation",
|
||||
"s3:GetBucketVersioning"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::acdl-tfstate-581513795199-us-east-1",
|
||||
"arn:aws:s3:::acdl-tfstate-581513795199-us-east-1/*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Sid": "SpikeOutboxTableReadWrite",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"dynamodb:GetItem",
|
||||
"dynamodb:PutItem",
|
||||
"dynamodb:DeleteItem",
|
||||
"dynamodb:UpdateItem",
|
||||
"dynamodb:Query",
|
||||
"dynamodb:Scan",
|
||||
"dynamodb:DescribeTable"
|
||||
],
|
||||
"Resource": "arn:aws:dynamodb:us-east-1:581513795199:table/acdl-outbox"
|
||||
},
|
||||
{
|
||||
"Sid": "SpikeStsSelfIdentify",
|
||||
"Effect": "Allow",
|
||||
"Action": "sts:GetCallerIdentity",
|
||||
"Resource": "*"
|
||||
},
|
||||
{
|
||||
"Sid": "DenyEverythingElse",
|
||||
"Effect": "Deny",
|
||||
"Action": "*",
|
||||
"NotResource": [
|
||||
"arn:aws:s3:::acdl-tfstate-581513795199-us-east-1",
|
||||
"arn:aws:s3:::acdl-tfstate-581513795199-us-east-1/*",
|
||||
"arn:aws:dynamodb:us-east-1:581513795199:table/acdl-outbox"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
resource "aws_s3_bucket" "s3" {
|
||||
bucket = "acdl-spike-bucket"
|
||||
versioning {
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
output "bucket_arn" {
|
||||
value = aws_s3_bucket.s3.arn
|
||||
}
|
||||
|
||||
output "bucket_name" {
|
||||
value = aws_s3_bucket.s3.id
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
provider "aws" {
|
||||
region = "us-east-1"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
terraform {
|
||||
required_version = ">= 1.9, < 1.10"
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "~> 5.0"
|
||||
}
|
||||
}
|
||||
backend "s3" {
|
||||
bucket = "acdl-tfstate-581513795199-us-east-1"
|
||||
key = "spike/l2-static-asset/terraform.tfstate"
|
||||
region = "us-east-1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user