plans: Task 34 dev drill rev 2, Astra round 1
Every finding of Astra's round 1, with the coordinator's rulings R1 to R10: teardown at once after any safe stop but a guard failure, through teardown blocks; fallbacks only on ordinary exit codes; a step settle and controller-table scans per hosted scenario; units polled with unit status on the kit's measured bounds; images deleted after unfence and resumably; drill strikes only inside the checks-started window; Paul's key file and Mac check; findings for skips; the scratch hosted project as a prerequisite; tagged images; HOSTED-RESULT expectations.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+746
−486
docs/superpowers/plans/2026-12-01-hosted-2-dev-live-plan.md+727 −486docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md+19 −0
CI failed — run details
CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/hosted-runners-2: Type Size Avail | ext4 96G 84G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type Size Avail | ext4 96G 84G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 2.0s
ci-box: codex: fetched and verified in 3.5s
ci-box: codex-code-mode-host: fetched and verified in 1.4s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
ci-box: tofu: fetched and verified in 1.6s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.8s
ci-box: pi: installed and verified in 7.7s
ci-box: opencode: installed and verified in 2.2s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.9s
ci-box: clone deepened in 5.9s
ci-box: file times set from content: 4061 files, 303 directories
ci-box: ready in 19.8s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
--- FAIL: TestReleaseCopyReviewed (0.09s)
task_pages_test.go:236: COPY REVIEW REQUIRED: copy-status.py verify found copy pending review or stale bookkeeping
FAIL
rastrillo-budget/v1 ran 88ms
FAIL amadan.net/oficina/equipo/internal/equipotest 0.238s
FAIL
make: *** [Makefile:324: copy-release-check] Error 1
amadan: step copy failed: exit status 2
amadan: job failed at step copy — its output is above, not at the tail of this log
diff --git a/docs/superpowers/plans/2026-12-01-hosted-2-dev-live-plan.md b/docs/superpowers/plans/2026-12-01-hosted-2-dev-live-plan.md| index 89c94857..d4d72a19 100644 |
| --- a/docs/superpowers/plans/2026-12-01-hosted-2-dev-live-plan.md |
| +++ b/docs/superpowers/plans/2026-12-01-hosted-2-dev-live-plan.md |
| @@ -1,141 +1,166 @@ |
| # Hosted runners slice 2, Task 34: the dev drill in `kass` (for Paul's GO) |
| -**Revision:** 1.1 (2026-12-01; revision 1 plus the coordinator's rulings on `plan-check.py` and |
| -`cert bundle`'s `-empty`, below), in Fable's shape (`.superpowers/sdd/2026-11-30-hosted-runners-slice-2/fable-34.md`) |
| -with the coordinator's rulings; next Astra (three rounds at most), then Paul's one GO. **No AWS |
| -command or SDK call of any kind was made while writing it, not even a read.** It keeps Task 17b's |
| -shape (`2026-11-30-hosted-1a-task17b-live-plan.md`): hard stops only for safety, `FINDING:` lines |
| -for everything else, a ledger, systemd user units, teardown verified by direct reads. Every AWS step |
| -goes through `equipo-hosted-ops` (slice 2 Task 33), so this drill is that tool's first real run, |
| -ahead of the production bring-up (`2026-11-30-hosted-prod-account-plan.md`, "the account plan"). |
| - |
| -## Revision 1: what changed and why |
| - |
| -- **Main first, then the drill** (coordinator). Slice 2 merges to main, inert behind |
| - `EQUIPO_HOSTED_RUNNERS`. `<PIN>` is the main commit carrying it. Staging (`equipo-staging`, `bds`) |
| - runs main's release the normal Equipo way before the drill; the drill builds nothing for staging |
| - (0.3 only checks it). The dev hosted release is `hosted-dev-0.0.1` (`release-hosted.sh` now takes |
| - `dev-MAJOR.MINOR.PATCH`). |
| -- **Protocol 40, migrations 0126 to 0131** (the renumber, `renumber-report.md`). |
| -- **The headless suite's person starts the five staging tasks** (coordinator), through hosted |
| - scenarios that must exist at `<PIN>` (prerequisite 4). |
| -- **The alert email is proved** (coordinator): `envs/dev/config` now has the topic's email |
| - subscription to `<ALERT_EMAIL>` (tofu test and plan-check fixture regenerated); Paul confirms the |
| - subscription (2.4) and the receipt of a test alert (7.4). |
| -- **Paul signs on his Mac** from a build at `<PIN>` (5.4). |
| -- **Kit fixes now in the code** (`renumber-report.md`): `cert bundle` writes the controller's |
| - certificate set (5.4b); `ops controller reboot` waits for the host to go away and refuses only |
| - while `deny_launches` is attached (so a safe stop that attached nothing no longer ends the run); |
| - the estimate retries an incomplete VM scan; S.1 passes `--console` and `--no-prompt`, the console |
| - from an `instance-console` note (2.2 records staging's). |
| -- **Fable 1, stops:** before 4.1 nothing can launch, so a safe stop protects nothing there: the |
| - connector, release-file, digest and pin failures are FINDING plus skip to teardown, with |
| - `if skipped` guards from 3.2 on. Reboot timeouts before launches are on (5.1), carlos failures |
| - (6.1), hand-over failures (5.4a), the evidence parse (5.3) and reservation refusals (6.2, 7) skip |
| - too. A probe that reached marks the run NOT PASSED and goes to teardown. Every `tf` destroy gets |
| - one `tf reconcile` and one re-destroy. |
| -- **Fable 1 and 7, status:** 4.3 and 7.1 poll `ops status` for up to 15 minutes before |
| - `ops assert status`; not live by then is skip to teardown (4.3) or a hard stop (7.1, a VM runs). |
| -- **Fable 2, envelope:** the read list and fallbacks are in "Rules"; buckets are emptied by their |
| - fixed names; one repeat of 8.2 inside 8.4 if unfence refuses. |
| -- **Fable 3, first runs:** a linger check in 0.1; the rehearsal (1.2) runs outside `ops block`, in |
| - its own run directory, with the instance notes, so S.1's `carlos` really runs from the unit. |
| -- **Fable 4, background:** every `ops block` and `ops unit wait` runs in the background with a |
| - timeout of its bound plus 40 minutes; no safe stop in the foreground; 8.2's bound is 100 minutes. |
| -- **Fable 5, spend:** self-stop **$40**, ceiling **$50** (not "reserve 4 in 6.2": that would leave |
| - the retries of two of the three checks unadmitted, and a refused reservation mid-drill skips the |
| - rest). |
| -- **Fable 6, cheap discovery:** the rehearsal; `inventory` and `quota`; after 2.3, |
| - `ops tf reconcile network` (a refresh-only plan, $0), kept over Fable's no-op re-apply (see 1.1). |
| -- **5.4b reads the journal for `WAIT-EXPIRED` first** (Fable 4). |
| - |
| -**Revision 1.1** (the coordinator's rulings on revision 1's open questions 2 and 3): |
| -- **A failed apply is re-run once** (2.3, 2.4, 4.1), as Fable suggested, before the fallback of |
| - `ops tf reconcile` and skip to teardown. `plan-check.py` now lets a create phase plan `no-op` for |
| - what the prior state holds (commit `d0650708`; tested on a genuine partly applied network plan; |
| - update, replace and delete stay refused), so the re-run plans creates for what is missing and |
| - no-ops for the rest. |
| -- **The discovery step after 2.3 stays the refresh-only reconcile.** A no-op re-apply now passes |
| - `plan-check.py`, but it is not cheaper: it runs the same refresh, then `show`, `plan-check.py`, an |
| - apply of an empty plan and the outputs, and a provider-computed value that drifts shows as an |
| - `update`, which `plan-check.py` refuses with exit 99. The reconcile reads the same state with |
| - neither cost. The no-op rule gets its first real run in the failed-apply branch, if one fails. |
| -- **7.2 withdraws the certificate with `cert bundle`'s new `-empty`** (commit `9fa794e8`) instead of a |
| - hand-written file. |
| -- **Drills the kit cannot run** (coordinator): proxy kill, VM stop mid-step, orphan, launch refused |
| - while fenced are NOT RUN, each a FINDING, listed for slice 3 or the production rehearsal (7.3). |
| -- **Resolver and metadata** (coordinator): a standing FINDING "unconfirmed" (5.3, section 11). |
| +**Revision:** 2 (2026-12-02), after Astra's round 1 (`.superpowers/sdd/2026-11-30-hosted-runners-slice-2/p34-r1.md`), |
| +with the coordinator's rulings R1 to R10 (`task-34-rev2-brief.md`), the run-kit changes of |
| +`f384ee23` and `f0056f0a` (`kit-p34-report.md`) and the headless contract of `2a884860` and |
| +`cad3e171` (`headless-report.md`). Next: Astra (rounds 2 and 3 at most), then Paul's one GO. **No |
| +AWS command or SDK call of any kind was made while writing it, not even a read.** It keeps Task 17b's |
| +shape (`2026-11-30-hosted-1a-task17b-live-plan.md`): hard stops only for safety, `FINDING:` lines for |
| +everything else, a ledger, systemd user units, teardown verified by direct reads. Every AWS step goes |
| +through `equipo-hosted-ops` (slice 2 Task 33), so this drill is that tool's first real run, ahead of |
| +the production bring-up (`2026-11-30-hosted-prod-account-plan.md`, "the account plan"). |
| + |
| +## Revision 2: each Astra finding and its fix |
| + |
| +1. **Safe stop left spend unbounded** (R1). After any safe stop, section 8 runs at once, |
| + pre-approved, except after a guard failure (account, caller, region), where nothing runs and the |
| + run reports. The signing and alert watchdogs' expiries are safe stops, so teardown follows them |
| + too. Section 8's short blocks are `ops block <id> --teardown -- bash "$P/blocks/<id>.sh"` (`f0056f0a`: the guard and the |
| + ledger's ownership run, the spend gate does not, and any create refuses inside). The bound this |
| + gives is in section 9: at most about 6 more host-hours (about $0.33) after the stop. A teardown |
| + step that itself stops is the one case left unbounded: the run reports what exists and its daily |
| + cost, and asks Paul (section S). |
| +2. **Fallbacks swallowed safety refusals** (R2). `ops` now exits 99 only for a safety refusal and 1 |
| + for an ordinary failure (the table in `infra/hosted/README.md`, "Exit codes the plans branch on"). |
| + Every fallback branch acts only on 1 (and on `img`'s ordinary 1, 2, 5, 6); 99, and `img`'s 4, |
| + always go to recovery (`ordinary`, `img_ordinary` in `run.env`). Each branch says which codes it |
| + handles. |
| +3. **Unknown tagged resources could pass verification** (kit K3). `verify-gone` now reads every |
| + tagged ARN of the run the ledger does not hold and stops (99) unless it is proved absent. 8.7 says |
| + what happens then (R9). |
| +4. **No stop for a VM outside its step** (R3, kit K4). Each hosted scenario runs as its own suite |
| + call, and its checks step ends with `ops vms settle --step <scenario>` before the next starts (99 |
| + if a VM of the image is live 10 minutes after the step ended). While a suite runs, the agent runs |
| + `ops vms scan` every 5 minutes, which compares the provider's list with the controller's table and |
| + stops (99) on a live VM that is neither the controller's nor a recorded launch for 2 minutes. |
| +5. **A restarted unit waiter killed the unit** (R4, kit K5). Long units are polled with |
| + `ops unit status` in short calls (`upoll`, at most 8 minutes each, never a stop); `ops unit wait` |
| + runs only once the unit is done, past its bound, or unreadable three times. Bounds use the kit's |
| + measured numbers: status loops on a deadline (16.5 minutes worst, not a count), the rehearsal's |
| + recovery 40 minutes, the image deletes 45 minutes. |
| +6. **Advertised skips still exited** (R2, and "every prose fallback reachable"). Every expected |
| + failure is captured between `set +e` and `set -e`, classed, and then skips or stops: 4.2's pin |
| + wait, 3.1's build and Litestream, 3.3's reservations, 5.4b's bundle, and the rest. Section 10 |
| + lists each with its codes. |
| +7. **The images carried no tags.** Both publishes pass `-tag purpose=equipo-hosted-dev -tag "run=$RUN"`. |
| + No kit command reads an image's tags back; 8.7's strict tag cross-check sees them only if the |
| + tag index lists them (open question 1). |
| +8. **Deleting images before unfence** (R5, kit K6). Images are deleted after unfence and the services |
| + destroy (8.4), with `img delete`'s `-ledger`, which accepts a recorded image already gone, so a re-run |
| + is safe. |
| +9. **No rerun for unit blocks** (kit K7). Units that may be replayed have the predefined retry IDs |
| + `<id>.retry1` (rules, "Retries"); units that create (2.5, 3.3, 5.2) and the strikes (7.1, 7.2) are |
| + never replayed, and handle their ordinary failures inside the script. |
| +10. **Drills could strike outside the check** (R6, headless `cad3e171`). Each drill runs |
| + `hosted-slow` in its own mode (`mode=controller-reboot`, `mode=withdraw-cert`), waits for the |
| + scenario's `HOSTED-BARRIER` line, and strikes only between its `strike_after` and |
| + `strike_before`. With the barrier's IDs `unknown`, it strikes only if exactly one live VM of the |
| + image is the controller's; otherwise the drill is a FINDING "missed window" and the run goes on. |
| + The withdrawal counts only when `cert reload` answers `"certificates": 0`. Every suite end |
| + (`HOSTED-END`, `HOSTED-SUITE`) is bounded and read; each run's report is kept separately. |
| +11. **Paul's key file** (R7). The sign command uses `~/equipo-cert/paul-cert-1.key`; the GO checklist |
| + (prerequisite 5) checks it exists and that `equipo-hosted-certify` builds at `<PIN>` on his Mac. |
| +12. **Skip reasons and the STS text** (R8). `skip_to_teardown` writes `ops finding`, so every skip is a |
| + `FINDING` line. "What Paul approves" now states the real guarantee: credentials checked through |
| + STS and frozen once per `ops` invocation, pinned endpoints, and a fresh check before each apply. |
| + |
| +Also: the expected results are the `HOSTED-RESULT` line format (6.2, 7), with 7.1 accepting `jobs=1` |
| +or `jobs=2`; the scratch hosted project is a prerequisite the coordinator arranges (R10), named in |
| +`EQUIPO_STAGING_HOSTED_PROJECT` on every suite command. |
| + |
| +## Revision 1.1 and revision 1, in short |
| + |
| +- 1.1: a failed apply is re-run once (`plan-check.py` accepts `no-op` for what state holds, |
| + `d0650708`); 7.2 withdraws with `cert bundle`'s `-empty` (`9fa794e8`); the discovery step after 2.3 |
| + stays a refresh-only reconcile (a no-op re-apply is not cheaper, and a drifting computed value |
| + would plan as an update, which is refused). |
| +- 1: main first, staging on main's release, the dev release `hosted-dev-0.0.1`, protocol 40 and |
| + migrations 0126 to 0131, the suite's person runs the tasks, the dev alert subscription and a real |
| + alert email, Paul signs on his Mac, Fable's shape (`fable-34.md`): skip to teardown before |
| + launches, background blocks, status polls, destroy fallbacks, a $40 self-stop. |
| ## What Paul approves |
| One drill in account `640012953448` (profile `kass`), region `eu-west-1`. Nothing touches |
| -`149757027610` in any form: `ops` refuses any other account and verifies every AWS call through STS |
| -first, the OpenTofu providers carry `allowed_account_ids = ["640012953448"]`, and `ledger rec` |
| -refuses any other account's ARN. Every AWS call goes through `ops`, `img` (`equipo-hosted-image`) or |
| -`cert`'s controller calls, each behind the guard. `kass` names no `role_arn`, so every `ops` call |
| -passes `-role user/remote-agent`, the caller Task 17b recorded for `kass` (`HOSTED-SLICE1-PROGRESS.md`); |
| -the first guard binds it, and `img` must name the same caller (`-expect-role`). |
| - |
| -The drill: builds and publishes `hosted-dev-0.0.1` from `<PIN>` (a forge tag, no AWS); checks |
| -staging runs main's release with slice 2; applies `envs/dev/network`, `config` and `services`; |
| -creates the connector; builds and publishes the image (one Large version); runs one certification |
| -launch, which is the egress matrix and the containment suite inside a real MicroVM; **Paul signs the |
| +`149757027610` in any form. Each `ops` invocation resolves its credentials once, checks them through |
| +STS (the account, the caller `user/remote-agent`, the region), freezes them for that process, pins the |
| +regional endpoints, and checks them again before every OpenTofu apply; `img` checks the same caller |
| +(`-expect-role`). The OpenTofu providers carry `allowed_account_ids = ["640012953448"]`, and |
| +`ledger rec` refuses any other account's ARN. `kass` names no `role_arn`, so every `ops` call passes |
| +`-role user/remote-agent`, the caller Task 17b recorded (`HOSTED-SLICE1-PROGRESS.md`); the first |
| +guard binds it. |
| + |
| +The drill: builds and publishes `hosted-dev-0.0.1` from `<PIN>` (a forge tag, no AWS); checks staging |
| +runs main's release with slice 2; applies `envs/dev/network`, `config` and `services`; creates the |
| +connector; builds and publishes the image (one Large version, tagged); runs one certification launch, |
| +which is the egress matrix and the containment suite inside a real MicroVM; **Paul signs the |
| certificate on his Mac**; wires staging to the controller; the suite's person runs three hosted |
| -checks (pass, fail, new module) and two Task 30 drills on real VMs (the controller away mid-step, |
| -the certificate withdrawn mid-step); a test alert reaches Paul's inbox; then teardown, fence and |
| -unfence included, the connector's first real interface cleanup, and every resource verified gone by |
| -a direct read. |
| - |
| -**Hard stops** (exit 99, then section S), the whole list: the guard (account, caller, region); a |
| -name collision at inventory; a `plan-check.py` refusal; the estimate reaching **$40**; a VM of the |
| -run's image live 10 minutes after its step ended, or live and in neither the ledger nor the |
| -controller's table (settle); `ops assert network`; the audit, `provider_bound` and pin parts of |
| -`ops assert status`; a controller reboot that fails once launches are on (7.1); fence, controller |
| -terminate, unfence and `verify-gone`; anything outside the ledger. **Everything else** is a |
| -`FINDING:` line; one that blocks the rest of the drill is a FINDING plus **skip to teardown** |
| -(section 8), pre-approved: teardown is the safe direction, and waiting costs money. |
| - |
| -**Pre-approved fallbacks:** one base image version down, once (3.3); `ops ledger reconcile` before |
| -any skip in 3.3; after a failed apply, one re-run of the apply (creates plus no-ops for what state |
| -holds), then one `ops tf reconcile` (adoption runs there if it is needed) and a skip to teardown; per root in section 8, one `ops tf reconcile` and one re-destroy; inside |
| -`ops connector delete`, its retry with the managed-operator condition dropped; one repeat of 8.2 |
| -inside 8.4 if unfence refuses; buckets emptied by their fixed names; one re-run of a block that |
| -failed on a read; `ops safe-stop` again after its bound. Guarded, read-only calls on this run's own |
| -resources are pre-approved (the list is under "Rules"). Any other change to a command, or any other |
| -AWS call, comes back to Paul. |
| +checks (pass, fail, new module), each settled before the next, and two Task 30 drills on real VMs |
| +(the controller away, the certificate withdrawn), each struck inside its checks-started window; a |
| +test alert reaches Paul's inbox; then teardown and every resource verified gone by a direct read, |
| +untagged leftovers and unknown tagged resources included. |
| + |
| +**Hard stops** (exit 99, then section S, then section 8 at once): the guard (then nothing more runs); |
| +a name collision at inventory; a `plan-check.py` refusal; the estimate reaching **$40**; a VM of the |
| +run's image live 10 minutes after its step ended, or live, unexplained by the controller or the |
| +ledger, for 2 minutes; `ops assert network`; the audit, `provider_bound` and pin parts of |
| +`ops assert status`; a failed controller reboot or status once a VM runs (7.1); fence, controller |
| +terminate, unfence and `verify-gone`; anything outside the ledger; `img`'s guard (4). **Everything |
| +else** is a `FINDING:` line; one that blocks the rest of the drill is a FINDING plus **skip to |
| +teardown**, pre-approved. |
| + |
| +**Pre-approved fallbacks** (each on exit 1, or `img`'s ordinary codes, only): one base image version |
| +down (3.3); `ops ledger reconcile` before any skip in 2.5 and 3.3; a failed apply re-run once, then |
| +`ops tf reconcile` and a skip; per root in section 8, one `ops tf reconcile` and one re-destroy; one |
| +`<id>.retry1` of a replayable unit; one repeat of the fence and settle inside 8.3 if unfence refuses; |
| +buckets emptied by their fixed names; `ops safe-stop` run again after its bound; section 8 after any |
| +safe stop but a guard failure (R1). Guarded, read-only calls on this run's own resources are |
| +pre-approved (the list is under "Rules"). Any other change to a command, or any other AWS call, comes |
| +back to Paul. |
| **Spend** (section 9): the bill is expected at about **$1.80**, at most about $5. The run's own |
| estimate, which charges every admitted VM at four times the Large rate for 90 minutes, ends near |
| -**$26.68** to plan, with a proven worst case of **$32.28**. Self-stop **$40**; ceiling **$50**. |
| +**$26.68** to plan, with a proven worst case of **$32.33**. Self-stop **$40**; ceiling **$50**. |
| +After a safe stop, teardown runs at once and adds at most about **$0.33** of host time. |
| **Paul's own steps:** confirm the dev alert subscription (2.4, any time before 7.4); sign the |
| certificate (5.4, bounded 12 hours); confirm the test alert arrived (7.4, bounded 2 hours). Past the |
| -signing or alert bound, the watchdog runs section S; the run then waits for Paul (about $1.15 a day) |
| -and section 8 runs on his word. |
| +signing or alert bound, the watchdog runs section S, and section 8 follows at once. |
| ## Prerequisites (before the GO; no AWS) |
| -1. Slice 2 is merged to main at `<PIN>` and CI is green there; Paul's three copy titles are accepted |
| - (the runner kit's `copy-release-check`). |
| -2. Staging serves main's release at `<PIN>` or a later main commit, released the normal way |
| - (`scripts/staging-thin.py release`); `EQUIPO_HOSTED_RUNNERS` is not set there. |
| -3. `loginctl show-user "$USER" -p Linger` says `Linger=yes` on docs-t1, so the watchdog units outlive |
| - a logout (0.1 checks it). |
| -4. The headless suite has hosted scenarios at `<PIN>` (`internal/headless`, run by |
| - `scripts/staging-thin.py suite`): `hosted-pass`, `hosted-fail`, `hosted-new-module` and |
| - `hosted-slow` (a candidate whose test sleeps 240 seconds). Each: the suite's person owns a scratch |
| - Go project whose checks pass, turns on "Run checks in a hosted VM" (`POST /settings/hosted`), |
| - posts its task, waits for the checks step to end, and writes the step's checks result, sandbox, |
| - base checks SHA, reason and job count into the suite's `report.json`. These do not exist today |
| - (draft-notes, open question 1). |
| +1. Slice 2 is merged to main at `<PIN>` and CI is green there; Paul's three copy titles are accepted. |
| +2. Staging serves main's release at `<PIN>` or a later main commit, released the normal way; |
| + `EQUIPO_HOSTED_RUNNERS` is not set there. |
| +3. `loginctl show-user "$USER" -p Linger` says `Linger=yes` on docs-t1 (0.1 checks it). |
| +4. **The scratch hosted project** (R10; the coordinator arranges it before GO): a repository on the |
| + forge whose default branch holds exactly the headless fixture |
| + (`EQUIPO_HOSTED_FIXTURE_OUT=<dir> go test ./internal/headless -run '^TestHostedFixtureWrite$' -count=1`, |
| + committed with `.amadan/ci` executable, mode 100755), reachable through the production runner's |
| + forge credential (the suite runner advertises only those repositories). Its `owner/repo` is |
| + `<HOSTED_PROJECT>`, passed as `EQUIPO_STAGING_HOSTED_PROJECT` on every suite command. |
| +5. **Paul's Mac** (R7), the day of the GO: |
| + |
| + ```sh |
| + cd ~/src/equipo |
| + git fetch origin |
| + git checkout --detach '<PIN>' |
| + go build -o ~/equipo-cert/equipo-hosted-certify ./cmd/equipo-hosted-certify |
| + test -f ~/equipo-cert/paul-cert-1.key |
| + test -f ~/equipo-cert/paul-cert-1.pub |
| + ``` |
| + |
| + (`~/src/equipo` stands for his clone of `oficina/equipo`.) `<CERT_PUB>` is the content of |
| + `~/equipo-cert/paul-cert-1.pub`. |
| ## Inputs filled at GO |
| | Input | What | Used in | |
| | --- | --- | --- | |
| -| `<PIN>` | the full SHA of the main commit carrying slice 2 | 0.1 only (and Paul's build, 5.4) | |
| -| `<CERT_PUB>` | the contents of Paul's `paul-cert-1.pub` (ed25519, standard base64); key ID `paul-cert-1` | 2.2 only | |
| -| `<ALERT_EMAIL>` | where the dev topic's alerts go | 2.2 only | |
| +| `<PIN>` | the full SHA of the main commit carrying slice 2 | 0.1, and Paul's build | |
| +| `<CERT_PUB>` | the content of `paul-cert-1.pub` (ed25519, standard base64); key ID `paul-cert-1` | 2.2 | |
| +| `<ALERT_EMAIL>` | where the dev topic's alerts go | 2.2 | |
| +| `<HOSTED_PROJECT>` | the scratch hosted project's `owner/repo` (prerequisite 4) | 0.1 (written once into `run.env`) | |
| Staging is fixed: app `equipo-staging`, account `bds`, console `https://console.carloku.com`, host |
| `equipo-staging.bds.oncarlos.com` (`scripts/staging-thin.py`). |
| @@ -145,57 +170,68 @@ Staging is fixed: app `equipo-staging`, account `bds`, console `https://console. |
| | Order | Section | Roughly | |
| | --- | --- | --- | |
| | 1 | 0. Pin, scratch, dev release, staging check (no AWS) | 60 to 90 min | |
| -| 2 | 1. Guard, inventory, quota, recovery rehearsal | 15 min | |
| +| 2 | 1. Guard, inventory, quota, recovery rehearsal | 15 to 45 min | |
| | 3 | 2. State bucket, keys, network, config, connector | 45 min | |
| -| 4 | 3. Image | 20 to 50 min | |
| +| 4 | 3. Image | 20 to 105 min | |
| | 5 | 4. Controller and proxies | 30 to 45 min | |
| | 6 | 5. Certification, then Paul signs | 45 min, plus the signature | |
| -| 7 | 6. Staging wired, three hosted checks | 60 to 100 min | |
| -| 8 | 7. Two drills, the alert email | 2 to 4 h | |
| -| 9 | 8. Teardown and verification | 1.5 to 5 h | |
| +| 7 | 6. Staging wired, three hosted checks | 75 to 160 min | |
| +| 8 | 7. Two drills, the alert email | 1.5 to 4 h | |
| +| 9 | 8. Teardown and verification | 1.5 to 6 h | |
| ## Rules for every block |
| - **Shape.** Every block is a script file, `$P/blocks/<id>.sh`, written exactly as printed (only |
| - `<P printed by 0.1>`, and in 6.2 and 7 the `<result ...>` values, filled in), starting |
| - `set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env"`. Every block that calls AWS runs |
| - with the agent sandbox **off** (Task 17 attempt 1). One block at a time. |
| -- **Everything in the background.** Short blocks run as `ops block <id> --stop 40 -- bash "$P/blocks/<id>.sh"` |
| - (the guard and the estimate, then the script; any non-zero exit runs section S, which can take |
| - 35 minutes, and exits 99). Long blocks run as `ops unit start <id> -- bash "$P/blocks/<id>.sh"`, |
| - then `ops unit wait <id> --max <bound>`. The agent runs every `ops block` and every `ops unit wait` |
| - with the Bash tool's `run_in_background`, with a timeout of the block's bound plus 40 minutes |
| - (short blocks: a 10-minute bound, so 50 minutes). The tool's maximum is 120 minutes; when a |
| - background call ends without an exit status, run the same `ops unit wait` again (it measures from |
| - the unit's start). Unit bounds: 2.3 20m, 2.4 15m, 2.5 25m, 3.3 105m, 4.1 30m, 4.2 25m, 5.1 15m, |
| - 5.2 40m, 7.1 35m, 8.2 100m, 8.3 20m, 8.4 150m, 8.5 130m, 8.6 60m. Short blocks with longer bounds: |
| - 4.3 and 1.2, 20m. |
| -- **Admission.** A long block's script checks spend itself first (`ops estimate --stop 40`); section |
| - 8's blocks pass `--stop 50` and its units make no check, so spend never blocks a teardown short |
| - of the ceiling. |
| + `<P printed by 0.1>` filled in), starting `set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env"`. |
| + Every block that calls AWS runs with the agent sandbox **off** (Task 17 attempt 1). One block or |
| + unit at a time; the read-only scans of 6 and 7 may run beside a unit. |
| +- **Short blocks** run as `ops block <id> --stop 40 -- bash "$P/blocks/<id>.sh"` (section 8: |
| + `ops block <id> --teardown -- bash "$P/blocks/<id>.sh"`), with the Bash tool's `run_in_background` |
| + and a timeout of the block's bound plus 40 minutes (a 10-minute bound unless stated, so 50 |
| + minutes): on any non-zero exit `ops block` asks for recovery and waits for it, up to 35 minutes 45 |
| + seconds (`kit-p34-report.md`, "Bounds"). |
| +- **Long blocks** run as units: `ops unit start <id> -- bash "$P/blocks/<id>.sh"`. The agent then |
| + polls in short foreground calls, sandbox off, each at most 8 minutes and never a stop: |
| + `bash -c '. "<P>/run.env"; upoll <id> <bound minutes>'`. `upoll` reads `ops unit status <id>` every |
| + 30 seconds and prints one word: `running` (call again), `done <result> <status>`, `over` (past the |
| + bound) or `unreadable` (three failed reads in a row). On anything but `running`, the agent runs |
| + `ops unit wait <id> --max <bound>` in the background with a 45-minute timeout: it returns at once |
| + for a unit done with status 0, and otherwise stops the unit if it is still running and asks for |
| + recovery (exit 99). Unit bounds: 2.3 30m, 2.4 25m, 2.5 25m, 3.3 105m, 4.1 45m, 4.2 25m, 5.1 20m, |
| + 5.2 40m, 7.1 75m, 7.2 40m, 8.2 100m, 8.3 200m, 8.4 45m, 8.5 130m, 8.6 70m. Short blocks with longer |
| + bounds: 4.3 25m; 1.2 runs outside `ops block` with a 50-minute timeout. |
| +- **Retries.** A replayable unit that ended `done failed 1` (an ordinary failure) is started again |
| + once as `ops unit start <id>.retry1 -- bash "$P/blocks/<id>.sh"` and polled the same way; its own |
| + failure goes to `ops unit wait <id>.retry1 --max <bound>`. Replayable: 2.3, 2.4, 4.1 (an apply plans creates and |
| + no-ops), 4.2, 5.1, 8.2, 8.3, 8.4, 8.5, 8.6 (every teardown step reads what is gone and acts only on |
| + what is left). Not replayable, because they create or strike: 2.5, 3.3, 5.2, 7.1, 7.2; their |
| + expected failures are handled inside the script, and an unexpected one goes to `ops unit wait`. A |
| + unit that ended with status 99 always goes to `ops unit wait`. |
| +- **Exit classes** (R2). `ops`: 0 done, 1 ordinary, 99 safety. `img`: 4 safety; 1, 2, 5, 6 |
| + ordinary; 3 usage. A script captures an expected failure between `set +e` and `set -e` and calls |
| + `ordinary "$rc"` (or `img_ordinary "$rc"`), which exits 99 on any other code; only then may it |
| + retry or skip. An `ops` line carries no pipe, redirection or `||`. |
| - **Section S** is only ever `ops safe-stop` in the background (40-minute timeout). Before running it |
| - again, read `$P/journal.tsv`: a recovery that already ended has `SAFE-STOP end` there, and a second |
| - call starts a second full stop rather than joining. After a step-down (two images), expect "finished |
| - with problems": two settles with repeats can outrun its 30-minute bound; run it once more. |
| -- **Fatal checks are `ops assert`, observations `ops fact`.** An `ops` line in a script carries no |
| - pipe, redirection or `||`; a step whose failure is a FINDING runs between `set +e` and `set -e`, |
| - and its exit status goes to `ops fact`. |
| -- **Skip to teardown.** `skip_to_teardown "<why>"` writes the reason and a FINDING; every block from |
| - 3.2 to 7.4 starts `if skipped; then exit 0; fi`. **Not passed.** `ops ledger note not-passed "<why>"` |
| - marks a failed safety property that is not a stop (a probe that reached, an uncertified result |
| - kept); 8.8 then cannot write PASSED. |
| + again, read `$P/journal.tsv`: a recovery that already ended has `SAFE-STOP end` there. After a |
| + step-down (two images) expect "finished with problems" (two settles can outrun its 30 minutes); |
| + run it once more. Then section 8 runs at once (R1), unless the stop was the guard. |
| +- **Fatal checks are `ops assert`, observations `ops fact`, findings `ops finding`.** |
| +- **Skip to teardown.** `skip_to_teardown "<why>"` writes the reason and an `ops finding`; every block |
| + from 2.4 to 7.4 starts `if skipped; then exit 0; fi`, but for 7.2b (it restores the certificate |
| + whatever happened) and 7.3. **Not passed.** |
| + `ops ledger note not-passed "<why>"` marks a failed safety property that is not a stop; 8.8 then |
| + cannot write PASSED. |
| - **The read envelope** (pre-approved, guarded, this run's own resources): `ops guard`, |
| `ops estimate` (no `--stop`), `ops status`, `ops vms scan --image "$IMAGE_ARN" --max 2m`, |
| - `ops vms adopt`, `ops ledger show`, `ops quota`, `ops wait object`, `ops report`, `ops bundle`; |
| - `ops fact network|status|enabled|cert-listed`; files under `$P`; |
| - `systemctl --user show|list-units 'hdev-*'`; `loginctl show-user`; `carlos logs`; |
| - `curl https://equipo-staging.bds.oncarlos.com/api/version`. No raw `aws`. A failed read that only |
| - observes is a FINDING; one block that failed on a read may be re-run once. |
| -- **Ledger.** Every create has a durable intent before it (`ops tf` per planned address, `img publish` |
| - and `cert launch` through `-ledger "$P"`, every other `ops` create itself). Teardown acts only on |
| - confirmed records and OpenTofu state. Every VM ID seen is recorded and keeps its charge. |
| -- **Tags.** `purpose=equipo-hosted-dev` and `run=<RUN>` on every taggable resource. MicroVMs carry |
| - none; `ops vms` finds them by the run's image ARN. |
| + `ops vms adopt`, `ops ledger show`, `ops unit status`, `ops quota`, `ops wait object`, `ops report`, |
| + `ops bundle`; `ops fact network|status|enabled|cert-listed`; files under `$P`; the suite's progress |
| + and report files; `systemctl --user show|list-units 'hdev-*'`; `loginctl show-user`; `carlos logs`, |
| + `carlos env list`; `curl https://equipo-staging.bds.oncarlos.com/api/version`. No raw `aws`. A |
| + failed read that only observes is a FINDING. |
| +- **Ledger.** Every create has a durable intent before it. Teardown acts only on confirmed records |
| + and OpenTofu state. Every VM ID seen is recorded and keeps its charge. |
| +- **Tags.** `purpose=equipo-hosted-dev` and `run=<RUN>` on every taggable resource, the images |
| + included. MicroVMs carry none; `ops vms` finds them by the run's image ARN. |
| - **docs-t1.** Scratch is `$P` (`mktemp -d` under `$TMPDIR`), removed in 8.8. Default Go caches, |
| `CGO_ENABLED=0`, Go at `nice -n 19`. No sudo. Nothing listens on docs-t1. |
| - **Records.** Results go to `docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md` under |
| @@ -214,14 +250,17 @@ Runs in the agent's shell, sandbox off, in the background (50 minutes). |
| set -euo pipefail |
| PIN='<PIN>' |
| REL='hosted-dev-0.0.1' |
| +HOSTED_PROJECT='<HOSTED_PROJECT>' |
| W=/home/paulca/amadan.net/oficina/equipo-hosted-2 |
| : "${TMPDIR:?TMPDIR is unset}" |
| [[ "$PIN" =~ ^[0-9a-f]{40}$ ]] || { echo "ABORT: PIN is not a full commit SHA"; exit 1; } |
| +[[ "$HOSTED_PROJECT" =~ ^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$ ]] || { echo "ABORT: HOSTED_PROJECT is not owner/repo"; exit 1; } |
| git -C "$W" fetch -q origin |
| git -C "$W" merge-base --is-ancestor "$PIN" origin/main || { echo "ABORT: $PIN is not on main"; exit 1; } |
| git -C "$W" grep -q 'ProtocolHostedRunners *= *Protocol40' "$PIN" -- internal/wire || { echo "ABORT: $PIN does not carry slice 2 at protocol 40"; exit 1; } |
| git -C "$W" cat-file -e "$PIN:docs/superpowers/plans/2026-12-01-hosted-2-dev-live-plan.md" || { echo "ABORT: $PIN has no drill plan"; exit 1; } |
| -git -C "$W" grep -q '"bundle"' "$PIN" -- cmd/equipo-hosted-certify/main.go || { echo "ABORT: $PIN has no cert bundle"; exit 1; } |
| +git -C "$W" grep -q '"unit status"' "$PIN" -- internal/hostedops/ops.go || { echo "ABORT: $PIN has no unit status (kit f0056f0a)"; exit 1; } |
| +git -C "$W" grep -q 'HOSTED-BARRIER' "$PIN" -- internal/headless || { echo "ABORT: $PIN has no hosted barrier (headless cad3e171)"; exit 1; } |
| [ "$(loginctl show-user "$USER" -p Linger --value)" = yes ] || { echo "ABORT: no linger for $USER; watchdog units would die at logout"; exit 1; } |
| tofu version | head -1 | grep -q '^OpenTofu v1\.12\.' || { echo "ABORT: tofu 1.12 needed"; exit 1; } |
| for t in aws jq podman curl systemd-run systemctl loginctl python3 carlos amadan sha256sum; do command -v "$t" >/dev/null || { echo "ABORT: missing $t"; exit 1; }; done |
| @@ -242,25 +281,42 @@ RUN=$RUN |
| PIN=$PIN |
| REPO=$P/repo |
| REL=$REL |
| +HOSTED_PROJECT=$HOSTED_PROJECT |
| export TF_PLUGIN_CACHE_DIR=\$HOME/.cache/tofu-plugins CGO_ENABLED=0 AWS_PAGER= |
| IMAGE_DIGEST=\$(jq -r '.IMAGE_DIGEST // empty' "$P/repo/release/$REL.json" 2>/dev/null || true) |
| +OPSB=("$P/bin/equipo-hosted-ops" -dir "$P" -run "$RUN" -profile kass -account 640012953448 -region eu-west-1 -role user/remote-agent) |
| ops() { "$P/bin/equipo-hosted-ops" -dir "$P" -run "$RUN" -profile kass -account 640012953448 -region eu-west-1 -role user/remote-agent "\$@"; } |
| img() ( r=\$(ops guard -print-role) || exit 99; eval "\$(aws configure export-credentials --profile kass --format env)"; unset AWS_PROFILE; exec "$P/bin/equipo-hosted-image" -account 640012953448 -region eu-west-1 -prefix "equipo-hosted-dev-$RUN" -expect-role "\$r" "\$@" ) |
| cert() { "$P/bin/equipo-hosted-certify" "\$@"; } |
| -tfo() { jq -er ".\$2.value" "$P/tf/\$1.outputs.json"; } |
| -skipped() { [ -e "$P/skip-to-teardown" ] && echo "skipped: \$(cat "$P/skip-to-teardown")"; } |
| -skip_to_teardown() { printf '%s\n' "\$1" > "$P/skip-to-teardown"; ops fact "skip to teardown" "\$1"; } |
| +EOF |
| +cat >> "$P/run.env" <<'EOF' |
| +SROOT=$HOME/.local/share/equipo-runner-staging |
| +PROG=$SROOT/hosted-progress.log |
| +tfo() { jq -er ".$2.value" "$P/tf/$1.outputs.json"; } |
| +ordinary() { case "$1" in 0|1) ;; *) echo "exit $1 is a safety refusal: recovery"; exit 99;; esac; } |
| +img_ordinary() { case "$1" in 0|1|2|5|6) ;; *) echo "img exit $1: recovery"; exit 99;; esac; } |
| +skipped() { [ -e "$P/skip-to-teardown" ] && echo "skipped: $(cat "$P/skip-to-teardown")"; } |
| +skip_to_teardown() { printf '%s\n' "$1" > "$P/skip-to-teardown"; ops finding "skip to teardown: $1"; } |
| live() { jq -e '(.proxies | length) == 2 and all(.proxies[]; .fed and .last_feed_age_ms < 90000) and .last_clean_reap.ran and .last_clean_reap.age_ms < 120000' "$P/status.json" > /dev/null; } |
| -images() { awk -F'\t' '{print \$2}' "$P/journal.tsv" | awk '\$1 == "REC" && \$2 == "microvm-image" {print \$3}' | sort -u; } |
| +status_live() { local end=$(( $(date +%s) + 900 )); while [ "$(date +%s)" -lt "$end" ]; do rm -f "$P/status.json"; "${OPSB[@]}" status > /dev/null 2>&1 || true; if [ -s "$P/status.json" ] && live; then return 0; fi; sleep 30; done; return 1; } |
| +images() { awk -F'\t' '{print $2}' "$P/journal.tsv" | awk '$1 == "REC" && $2 == "microvm-image" {print $3}' | sort -u; } |
| +upoll() { local b=$1 max=$2 end=$(( $(date +%s) + 480 )) fails=0 s; while [ "$(date +%s)" -lt "$end" ]; do if s=$("${OPSB[@]}" unit status "$b" 2>/dev/null); then fails=0; if [ "$(jq -r .state <<<"$s")" = done ]; then echo "done $(jq -r '.result' <<<"$s") $(jq -r '.status' <<<"$s")"; return 0; fi; if [ "$(jq -r .elapsed_seconds <<<"$s")" -ge $(( max * 60 )) ]; then echo over; return 0; fi; else fails=$(( fails + 1 )); if [ "$fails" -ge 3 ]; then echo unreadable; return 0; fi; fi; sleep 30; done; echo running; } |
| +suite() { (cd "$P/repo" && EQUIPO_STAGING_HOSTED_PROJECT="$HOSTED_PROJECT" python3 scripts/staging-thin.py suite "$@"); } |
| +suite_line() { grep "^HOSTED-SUITE " "$PROG" 2>/dev/null | tail -n 1; } |
| +suite_report() { suite_line | sed -n 's/.* report=\([^ ]*\) at=.*/\1/p'; } |
| +hosted_end() { grep "^HOSTED-END name=$1 " "$PROG" 2>/dev/null | tail -n 1; } |
| +result_of() { jq -r --arg k "witness/TestStaging/$1" '.[$k].result // "-"' "$2" 2>/dev/null || echo "-"; } |
| +barrier_field() { sed -n "s/.* $1=\([^ ]*\).*/\1/p" <<<"$2"; } |
| +scenario_end() { local end report; end=$(hosted_end "$1"); report=$(suite_report); ops ledger note suite "$(suite_line)"; if [ -z "$report" ] || [ "$report" = - ] || ! grep -q ' status=ok ' <<<"$end "; then ops finding "$1: the scenario did not end ok: ${end:-no HOSTED-END line}"; return 0; fi; ops fact "$1" "$(result_of "$1" "$report")" "$2"; } |
| EOF |
| "$P/bin/equipo-hosted-ops" -dir "$P" -run "$RUN" ledger init |
| "$P/bin/equipo-hosted-ops" -dir "$P" -run "$RUN" unit probe |
| echo "P=$P RUN=$RUN" |
| ``` |
| -- Expected: the pin is on main and carries slice 2; linger on; `carlos` answers under `env -i`; |
| - the tests `ok`; `copy-release-check` passes; the probe unit starts, shows only allowlisted names |
| - and stops; `P=... RUN=...` printed. |
| +- Expected: the pin is on main and carries slice 2, the kit and the headless contract; linger on; |
| + `carlos` answers under `env -i`; the tests `ok`; `copy-release-check` passes; the probe unit starts, |
| + shows only allowlisted names and stops; `P=... RUN=...` printed. |
| - Abort if any check fails. Nothing exists yet. |
| ### 0.2 The dev release (no AWS call; publishes on the forge) |
| @@ -318,18 +374,18 @@ ops estimate --stop 40 |
| Run through `ops block`, the guard runs first and binds the run to |
| `arn:aws:iam::640012953448:user/remote-agent`. `ops inventory` runs before the first intent, so it |
| -journals every VPC and internet gateway as `PRE-RUN` facts (the default VPC's gateway never holds up |
| -a network reconcile). A name starting `equipo-hosted` is a hard stop; any other count is a FINDING. |
| -`inventory` and `quota` between them exercise most of the kit's clients at no cost. |
| +journals every VPC and internet gateway as `PRE-RUN` facts. A name starting `equipo-hosted` is a hard |
| +stop (99); a failed read (1) fails the block, which asks for recovery, and the run ends here at $0. |
| +A guard failure ends the run with nothing torn down (nothing exists). |
| -### 1.2 Recovery rehearsal at $0 (outside `ops block`, background, 20m) |
| +### 1.2 Recovery rehearsal at $0 (outside `ops block`, background, 50 minutes) |
| -The systemd recovery unit (one unit, an exclusive lock, `INVOCATION_ID` membership) has only run |
| -against fakes. This rehearses `ops safe-stop` for real in its own run directory and run name |
| -(`r<RUN>`), with the staging notes, so S.1 runs `carlos env unset ... EQUIPO_HOSTED_RUNNERS` from |
| -the unit's `env -i` environment (it is not set on staging, so this also shows what unsetting an |
| -unset variable does). Nothing else exists in it, so its cloud steps are reads. It runs as |
| -`bash "$P/blocks/1.2.sh"`, not under `ops block`: a failure here must not reach the main run. |
| +The systemd recovery unit has only run against fakes. This rehearses `ops safe-stop` for real in its |
| +own run directory and run name (`r<RUN>`), with the staging notes, so S.1 runs |
| +`carlos env unset ... EQUIPO_HOSTED_RUNNERS` from the unit's `env -i` environment (not set on |
| +staging, so this also shows what unsetting an unset variable does). Its cloud steps are reads. It |
| +runs as `bash "$P/blocks/1.2.sh"`: a failure here must not reach the main run. The recovery request |
| +can take 35 minutes 45 seconds (`kit-p34-report.md`); the 50-minute timeout covers it. |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| @@ -347,15 +403,14 @@ set -e |
| grep -q 'UNIT hdev-r.*-recovery.service' "$R/journal.tsv" || { echo "ABORT: the recovery unit never started"; exit 1; } |
| grep -q 'SAFE-STOP end' "$R/journal.tsv" || { echo "ABORT: the recovery did not finish"; exit 1; } |
| grep 'SAFE-STOP S.1' "$R/journal.tsv" |
| -[ "$rc" = 0 ] || ops fact "recovery rehearsal" "exit $rc; S.1: $(grep 'SAFE-STOP S.1' "$R/journal.tsv" | tail -n 1 | cut -f2)" "exit 0" |
| +if [ "$rc" != 0 ]; then ops finding "recovery rehearsal: exit $rc; $(grep 'SAFE-STOP S.1' "$R/journal.tsv" | tail -n 1 | cut -f2)"; fi |
| rops unit stop --all |
| ``` |
| -- Expected: the recovery unit `hdev-r<RUN>-recovery.service` starts, runs S.0 to S.5, and ends; |
| - S.1's line says whether the unset succeeded. |
| -- Abort (nothing exists, the main run untouched) if the unit never starts or never ends. A finished |
| - rehearsal with problems is a FINDING (for example, unsetting an unset variable fails): it shows |
| - what a real safe stop will report. |
| +- Expected: the recovery unit `hdev-r<RUN>-recovery.service` starts, runs S.0 to S.5 and ends; S.1's |
| + line says whether the unset succeeded. |
| +- Abort (nothing exists; the main run is untouched) if the unit never starts or never ends. A |
| + finished rehearsal with problems is a FINDING. |
| ## 2. State bucket, keys, network, config, connector |
| @@ -366,6 +421,9 @@ set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| ops bucket create --name equipo-hosted-tfstate-640012953448 --versioning --sse AES256 --block-public --expected-owner 640012953448 |
| ``` |
| +A refused create (1) fails the block: recovery, then section 8 (nothing to tear down but what the |
| +ledger shows). A collision or wrong owner (99): the same. |
| + |
| ### 2.2 Keys, variables, instance notes (block) |
| ```sh |
| @@ -382,10 +440,10 @@ ops ledger note instance-account bds |
| ops ledger note instance-console https://console.carloku.com |
| ``` |
| -The instance notes go in before any controller exists, so S.1 always knows where to turn the |
| -staging flag off, through staging's console. |
| +The instance notes go in before any controller exists, so S.1 always knows where to turn the staging |
| +flag off, through staging's console. |
| -### 2.3 Network (unit, bound 20m) |
| +### 2.3 Network (unit, bound 30m) |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| @@ -393,13 +451,17 @@ ops estimate --stop 40 |
| set +e |
| ops tf network dev-network |
| rc=$? |
| -if [ "$rc" != 0 ]; then |
| - ops fact "network apply" "exit $rc" "exit 0" |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then |
| + ops finding "network apply failed (exit 1); applying once more" |
| + set +e |
| ops tf network dev-network |
| rc=$? |
| + set -e |
| + ordinary "$rc" |
| fi |
| -set -e |
| -if [ "$rc" != 0 ]; then |
| +if [ "$rc" = 1 ]; then |
| ops tf reconcile network |
| skip_to_teardown "the network apply failed twice" |
| exit 0 |
| @@ -409,22 +471,16 @@ set +e |
| ops tf reconcile network |
| rc=$? |
| set -e |
| -[ "$rc" = 0 ] || ops fact "network refresh-only reconcile" "exit $rc" "exit 0" |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then ops finding "network refresh-only reconcile: exit 1"; fi |
| ``` |
| -The checked plan creates the VM VPC with DNS off, the services VPC, the peering, the routes, the VM |
| -security group (egress only to the proxies on 8443 and 8444, no ingress), the NACLs and the |
| -connector's operator role. `ops assert network` is fatal. A failed apply is re-run once: its plan |
| -is creates for what is missing and no-ops for what the state holds, which `plan-check.py` accepts |
| -(nothing updated, replaced or deleted; a known reference must equal its target in state). A second |
| -failure is reconciled (a resource created outside state is adopted there, through a run-local |
| -import block) and skipped to teardown, which destroys from state. The last step is the $0 |
| -discovery Fable asked for, a refresh-only reconcile of the applied root: init, the refresh plan and |
| -the ledger lookups on real state. A no-op re-apply would now pass `plan-check.py` too, but it is |
| -not cheaper (the same refresh, then `show`, `plan-check.py`, an empty apply and the outputs) and a |
| -provider-computed value that drifts would show as an `update`, which is refused with exit 99. |
| +Codes: 0 goes on; **1** (the apply failed after `plan-check.py` accepted it) is re-run once (its plan |
| +is creates plus no-ops for what state holds), then reconciled (adoption happens there) and skipped; |
| +**99** (a plan-check refusal, the re-check before apply, an unresolved intent) goes to recovery. The |
| +last step is the $0 discovery: a refresh-only reconcile of the applied root. |
| -### 2.4 Config, and the alert subscription (unit, bound 15m) |
| +### 2.4 Config, and the alert subscription (unit, bound 25m) |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| @@ -433,13 +489,17 @@ ops estimate --stop 40 |
| set +e |
| ops tf config dev-config |
| rc=$? |
| -if [ "$rc" != 0 ]; then |
| - ops fact "config apply" "exit $rc" "exit 0" |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then |
| + ops finding "config apply failed (exit 1); applying once more" |
| + set +e |
| ops tf config dev-config |
| rc=$? |
| + set -e |
| + ordinary "$rc" |
| fi |
| -set -e |
| -if [ "$rc" != 0 ]; then |
| +if [ "$rc" = 1 ]; then |
| ops tf reconcile config |
| skip_to_teardown "the config apply failed twice" |
| exit 0 |
| @@ -447,11 +507,10 @@ fi |
| ops wait-human sns-confirmed --max 24h --background |
| ``` |
| -Creates the config, Litestream and image-input buckets, the controller, proxy and image-build roles, |
| -the build policy and log group, the dev alert topic, its email subscription and the dev budget. AWS |
| -sends `<ALERT_EMAIL>` a confirmation; the agent asks Paul to confirm it, and runs |
| -`ops wait-human sns-confirmed --done` when he has. The 24-hour clock outlasts any path to 7.4, and |
| -8.1 stops its watchdog. |
| +Codes as 2.3. Creates the buckets, the roles, the build policy and log group, the dev alert topic, |
| +its email subscription and the dev budget. AWS sends `<ALERT_EMAIL>` a confirmation; the agent asks |
| +Paul to confirm it and runs `ops wait-human sns-confirmed --done` when he has. The 24-hour clock |
| +outlasts any path to 7.4; 8.1 stops its watchdog. |
| ### 2.5 The connector (unit, bound 25m) |
| @@ -464,22 +523,28 @@ set +e |
| ops connector create --subnet "$VM_SUBNET" --security-group "$VM_SG" --role "$CONN_ROLE" |
| rc=$? |
| set -e |
| -if [ "$rc" != 0 ]; then |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then |
| ops ledger reconcile |
| - skip_to_teardown "the connector was not created (ops exit $rc)" |
| + skip_to_teardown "the connector was not created (refused, FAILED or not ACTIVE in time)" |
| fi |
| ``` |
| -Records the intent, creates the `VPC_EGRESS` connector `equipo-hosted-dev-<RUN>-egress`, waits for |
| -`ACTIVE` and records the `:1` qualified ARN. A refusal or a timeout is a FINDING and a skip: nothing |
| -can launch yet. |
| +Codes: **1** (refused, `FAILED`, not `ACTIVE` in time, the version read failing) reconciles and |
| +skips; **99** (the role in another account, an unresolved intent, a version read that is not this |
| +run's connector) goes to recovery. Not replayable. |
| ### 2.6 Private keys into the config bucket (block) |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| if skipped; then exit 0; fi |
| +set +e |
| ops keys upload --bucket equipo-hosted-dev-config-640012953448 --expected-owner 640012953448 --keys "$P/keys" --cert-key-id paul-cert-1 |
| +rc=$? |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then skip_to_teardown "the keys were not uploaded (put refused)"; fi |
| ``` |
| ## 3. Image |
| @@ -497,22 +562,42 @@ b=$? |
| ops assert release-file "$P/release/litestream-0.5.18-linux-x86_64.tar.gz" |
| c=$? |
| set -e |
| -if [ "$a$b$c" != 000 ]; then skip_to_teardown "a release file is not the one the release manifest records"; exit 0; fi |
| +if [ "$a$b$c" != 000 ]; then skip_to_teardown "a release file is not the one the release manifest records (assert exits $a $b $c)"; exit 0; fi |
| +set +e |
| img build -bundle "$P/release/image-source.tar" -gitleaks-config "$REPO/.gitleaks.toml" -out "$P/image.zip" > "$P/build.json" |
| +rc=$? |
| +set -e |
| +img_ordinary "$rc" |
| +if [ "$rc" != 0 ]; then skip_to_teardown "the image did not build locally (img exit $rc)"; exit 0; fi |
| set +e |
| ops assert image-digest "$(jq -er .Digest "$P/build.json")" |
| rc=$? |
| set -e |
| -if [ "$rc" != 0 ]; then skip_to_teardown "the rebuilt image is not the release's IMAGE_DIGEST"; exit 0; fi |
| +if [ "$rc" != 0 ]; then skip_to_teardown "the rebuilt image is not the release's IMAGE_DIGEST (exit $rc)"; exit 0; fi |
| +set +e |
| ops litestream-install --file "$P/release/litestream-0.5.18-linux-x86_64.tar.gz" |
| +rc=$? |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then skip_to_teardown "Litestream was not installed (no pin for the platform)"; fi |
| ``` |
| +Codes: the asserts before anything launches are skips whatever their code (a release file or |
| +digest that differs means this release cannot be drilled; nothing runs yet); `img build` 4 goes to |
| +recovery, its ordinary codes skip; `litestream-install` 1 skips, 99 (a binary that is not the |
| +release's) goes to recovery. |
| + |
| ### 3.2 Upload (block) |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| if skipped; then exit 0; fi |
| +set +e |
| ops object put --bucket equipo-hosted-dev-image-inputs-640012953448 --key "images/$IMAGE_DIGEST.zip" --file "$P/image.zip" --expected-owner 640012953448 |
| +rc=$? |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then skip_to_teardown "the image zip was not uploaded (put refused)"; fi |
| ``` |
| ### 3.3 Create the image and its Large version (unit, bound 105m) |
| @@ -523,18 +608,31 @@ if skipped; then exit 0; fi |
| ops estimate --stop 40 |
| BUILD_ROLE=$(tfo config image_build_role_arn); LOG_GROUP=$(tfo config image_build_log_group); INPUTS_BUCKET=$(tfo config image_inputs_bucket) |
| BASE=$(jq -er .BaseImageVersion "$REPO/release/$REL.json") |
| +set +e |
| ops reserve build 1 |
| +rc=$? |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then skip_to_teardown "the image build was not admitted"; exit 0; fi |
| set +e |
| -img publish -ledger "$P" -base-version "$BASE" -name "equipo-hosted-dev-$RUN" -bucket "$INPUTS_BUCKET" -key "images/$IMAGE_DIGEST.zip" -build-role-arn "$BUILD_ROLE" -log-group "$LOG_GROUP" -size large -capabilities ALL -timeout 45m -out "$P/image.json" |
| +img publish -ledger "$P" -base-version "$BASE" -name "equipo-hosted-dev-$RUN" -bucket "$INPUTS_BUCKET" -key "images/$IMAGE_DIGEST.zip" -build-role-arn "$BUILD_ROLE" -log-group "$LOG_GROUP" -size large -capabilities ALL -tag purpose=equipo-hosted-dev -tag "run=$RUN" -timeout 45m -out "$P/image.json" |
| rc=$? |
| set -e |
| +img_ordinary "$rc" |
| if [ "$rc" = 6 ]; then |
| - ops fact "image build on base $BASE" "failed state" "built" |
| - ops reserve build 1 |
| + ops finding "image build on base $BASE: failed state; stepping down one base version" |
| set +e |
| - img publish -ledger "$P" -base-version "$BASE" -allow-step-down -name "equipo-hosted-dev-$RUN-b" -bucket "$INPUTS_BUCKET" -key "images/$IMAGE_DIGEST.zip" -build-role-arn "$BUILD_ROLE" -log-group "$LOG_GROUP" -size large -capabilities ALL -timeout 45m -out "$P/image.json" |
| - rc=$? |
| + ops reserve build 1 |
| + r2=$? |
| set -e |
| + ordinary "$r2" |
| + if [ "$r2" = 0 ]; then |
| + set +e |
| + img publish -ledger "$P" -base-version "$BASE" -allow-step-down -name "equipo-hosted-dev-$RUN-b" -bucket "$INPUTS_BUCKET" -key "images/$IMAGE_DIGEST.zip" -build-role-arn "$BUILD_ROLE" -log-group "$LOG_GROUP" -size large -capabilities ALL -tag purpose=equipo-hosted-dev -tag "run=$RUN" -timeout 45m -out "$P/image.json" |
| + rc=$? |
| + set -e |
| + img_ordinary "$rc" |
| + fi |
| fi |
| if [ "$rc" != 0 ]; then |
| ops ledger reconcile |
| @@ -546,17 +644,16 @@ ops ledger rec microvm-image-version "$(jq -er .VersionArn "$P/image.json")" |
| ops fact "image base version" "$(jq -r .BaseImageVersion "$P/image.json")" "$BASE" |
| ``` |
| -The first build of the hosted image on AWS's real base (version 4): the 23 pinned AL2023 packages |
| -plus python3 and its 4 dependencies, and the hosted bubblewrap checked against its pin by the |
| -Dockerfile. `img publish` journals the image and version as soon as they exist, so a failed build is |
| -still torn down. Exit 6 (a failed build) takes the pre-approved step down once, under a new name. |
| -Before any skip, `ops ledger reconcile` resolves an open image intent, which would otherwise stop |
| -every later estimate (8.1's included). A reservation refused here is a FINDING and a skip too (the |
| -same `set +e` pattern as 6.2a). |
| +Codes: `reserve` 1 (the reservation would reach the stop) skips, 99 goes to recovery; `img publish` |
| +6 (a failed build) steps down once under a new name, 1, 2 and 5 skip, **4** (the guard) goes to |
| +recovery. Before any skip, `ops ledger reconcile` resolves an open image intent (it would stop every |
| +later estimate). Not replayable. The first build of the hosted image on AWS's real base (version 4): |
| +the 23 pinned AL2023 packages plus python3 and its 4 dependencies, and the hosted bubblewrap checked |
| +against its pin. Both images carry the run's tags (finding 7; open question 1 on reading them back). |
| ## 4. Controller and proxies (`envs/dev/services`) |
| -### 4.1 Plan and apply (unit, bound 30m) |
| +### 4.1 Plan and apply (unit, bound 45m) |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| @@ -566,22 +663,25 @@ ops tfvars --add-image "$P/image.json" --add-connector |
| set +e |
| ops tf services dev-services |
| rc=$? |
| -if [ "$rc" != 0 ]; then |
| - ops fact "services apply" "exit $rc" "exit 0" |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then |
| + ops finding "services apply failed (exit 1); applying once more" |
| + set +e |
| ops tf services dev-services |
| rc=$? |
| + set -e |
| + ordinary "$rc" |
| fi |
| -set -e |
| -if [ "$rc" != 0 ]; then |
| +if [ "$rc" = 1 ]; then |
| ops tf reconcile services |
| skip_to_teardown "the services apply failed twice" |
| fi |
| ``` |
| -Creates the controller (`t4g.small`), proxies A and B (`t4g.micro`) with their Elastic IPs, the |
| -roles' policies, profiles and groups, the alarms, the deny-launches policy and the budget action. |
| -The hosts' AMI is the release's `HostAMI`. Launches stay off (`controller/env` is absent, so |
| -`EQUIPO_HOSTED_ENABLED=0`) until 5.1, so a failure here skips too. |
| +Codes as 2.3. Creates the controller (`t4g.small`), proxies A and B (`t4g.micro`) with their Elastic |
| +IPs, the roles' policies, profiles and groups, the alarms, the deny-launches policy and the budget |
| +action. Launches stay off until 5.1. |
| ### 4.2 Hosts up (unit, bound 25m) |
| @@ -590,50 +690,53 @@ set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| if skipped; then exit 0; fi |
| ops estimate --stop 40 |
| CONFIG_BUCKET=equipo-hosted-dev-config-640012953448 |
| +set +e |
| PIN_HEX=$(ops wait object --bucket "$CONFIG_BUCKET" --key pins/controller.spki --max 15m | tail -n 1) |
| -if ! [[ "$PIN_HEX" =~ ^[0-9a-f]{64}$ ]]; then skip_to_teardown "the controller wrote no pin"; exit 0; fi |
| +rc=$? |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ] || ! [[ "$PIN_HEX" =~ ^[0-9a-f]{64}$ ]]; then skip_to_teardown "the controller wrote no pin within 15 minutes"; exit 0; fi |
| printf '%s\n' "$PIN_HEX" > "$P/controller.pin" |
| ops ledger rec controller-pin "$PIN_HEX" |
| jq -n --arg url "https://$(tfo services controller_public_ip)" --arg pin "$PIN_HEX" --arg key "$(cat "$P/keys/controller.pub")" '{url: $url, pin: $pin, key: $key}' > "$P/proxy-controller.json" |
| +set +e |
| ops object put --bucket "$CONFIG_BUCKET" --key proxy/a/controller.json --file "$P/proxy-controller.json" |
| +a=$? |
| ops object put --bucket "$CONFIG_BUCKET" --key proxy/b/controller.json --file "$P/proxy-controller.json" |
| +b=$? |
| +set -e |
| +ordinary "$a"; ordinary "$b" |
| +if [ "$a$b" != 00 ]; then skip_to_teardown "the proxies' controller.json was not placed"; fi |
| ``` |
| -The wait is `ops wait object --bucket equipo-hosted-dev-config-640012953448 --key pins/controller.spki --max 15m`. |
| -Each proxy's boot waits up to 15 minutes for its `controller.json`, counted from its own boot. |
| +The wait is `ops wait object --bucket equipo-hosted-dev-config-640012953448 --key pins/controller.spki --max 15m`: |
| +**1** (past `--max`) skips; **99** (a body that is not a small public value) goes to recovery. |
| -### 4.3 Status through the pin, and the restore check (block, bound 20m) |
| +### 4.3 Status through the pin, and the restore check (block, bound 25m) |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| if skipped; then exit 0; fi |
| -for i in $(seq 1 30); do |
| - rm -f "$P/status.json" |
| - set +e |
| - ops status |
| - set -e |
| - if [ -s "$P/status.json" ] && live; then break; fi |
| - sleep 30 |
| -done |
| -if ! { [ -s "$P/status.json" ] && live; }; then skip_to_teardown "the controller and proxies were not live within 15 minutes"; exit 0; fi |
| +if ! status_live; then skip_to_teardown "the controller and proxies were not live within 15 minutes"; exit 0; fi |
| ops assert status |
| set +e |
| ops litestream-check --bucket equipo-hosted-dev-litestream-640012953448 |
| rc=$? |
| set -e |
| -[ "$rc" = 0 ] || ops fact "litestream restore check" "exit $rc" "exit 0" |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then ops finding "litestream restore check: exit 1"; fi |
| ``` |
| -The poll waits, for up to 15 minutes, until both proxies are fed within 90 seconds and a clean |
| -reaper pass is under 2 minutes old: liveness, which a slow proxy boot can delay and which is not a |
| -safety property. Not live by then is a skip. Then `ops assert status` is fatal: the network audit |
| -passing, exactly one `provider_bound` row for `aws:640012953448:eu-west-1`, liveness again, and the |
| -pin unchanged on a second read 60 seconds later. `ops litestream-check` is a FINDING in dev |
| -(production keeps it fatal). |
| +`status_live` reads `ops status` until a 15-minute deadline (each read up to 60 seconds, then 30 |
| +seconds' sleep: at most about 16.5 minutes), until both proxies are fed within 90 seconds and a clean |
| +reaper pass is under 2 minutes old. Liveness is not a safety property, so not live is a skip. Then |
| +`ops assert status` (about 6 minutes worst) is fatal: the audit passing, one `provider_bound` row for |
| +`aws:640012953448:eu-west-1`, liveness again, the pin unchanged on a second read. Litestream: 1 is a |
| +FINDING in dev (production keeps it fatal), 99 (a binding of another account) goes to recovery. |
| ## 5. Certification: the egress matrix inside a real VM |
| -### 5.1 The candidate image, and launches on (unit, bound 15m) |
| +### 5.1 The candidate image, and launches on (unit, bound 20m) |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| @@ -649,16 +752,17 @@ set +e |
| ops controller reboot --enabled 1 --max 10m |
| rc=$? |
| set -e |
| -if [ "$rc" != 0 ]; then skip_to_teardown "the controller did not come back with launches on (exit $rc)"; exit 0; fi |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then skip_to_teardown "the controller did not come back with launches on"; exit 0; fi |
| ops ledger note reboot-seconds "$(( $(date +%s) - start ))" |
| ops assert enabled |
| ``` |
| -`ops controller reboot` reboots the host, waits until a status read fails or shows the other |
| -switch (the host went away), then until `GET /v1/status` through the unchanged pin answers with |
| -launches on, within 10 minutes. Launches were off until it answers, so a timeout is a skip. The |
| -outage's length is recorded for 7.1. If the host comes back between two 15-second reads, the |
| -reboot never sees it go and times out: a skip, never a false success. |
| +`ops controller reboot` waits until the host is seen to go away, then for `GET /v1/status` through |
| +the unchanged pin to answer with launches on, within 10 minutes (bound with its reads and the guard: |
| +about 14 minutes). Codes: **1** (the reboot refused, not seen down and back) skips: launches were off |
| +until it answers; **99** (the deny policy attached or unreadable, not exactly one host) goes to |
| +recovery. The outage's length is recorded for 7.1. |
| ### 5.2 Certification launch (unit, bound 40m) |
| @@ -671,21 +775,24 @@ set +e |
| ops reserve vm 2 |
| rc=$? |
| set -e |
| -if [ "$rc" != 0 ]; then skip_to_teardown "the certification VMs were not admitted (reserve exit $rc)"; exit 0; fi |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then skip_to_teardown "the certification VMs were not admitted"; exit 0; fi |
| set +e |
| cert launch -ledger "$P" -controller "$CTL" -controller-tls-pin "$PIN_HEX" -controller-pub "$P/keys/controller.pub" -operator-id operator -operator-key "$P/keys/operator.key" -image "$IMAGE_DIGEST" -size large -timeout 20m -out "$P/evidence.json" > "$P/cert-launch.json" |
| rc=$? |
| ops vms adopt |
| +a=$? |
| set -e |
| -ops vms settle --image "$IMAGE_ARN" --max 10m |
| +ordinary "$a" |
| +ops vms settle --step cert --image "$IMAGE_ARN" --max 10m |
| if [ "$rc" != 0 ]; then skip_to_teardown "the certification launch failed (cert exit $rc)"; exit 0; fi |
| ops ledger rec cert-launch "$(jq -er .launch_id "$P/cert-launch.json")" |
| ``` |
| The VM's one egress service is the staging host (its positive control); it reports through a |
| -proxy's bootstrap listener, signed by its own key; the controller signs the evidence and stops the |
| -VM with proof. The settle runs whatever the launch did; a live VM after 10 minutes is a hard stop. A |
| -launch refused for a missing permission (`lambda:PassNetworkConnector`, untested) is a skip. |
| +proxy's bootstrap listener; the controller signs the evidence and stops the VM with proof. The step |
| +settle runs whatever the launch did: 99 if a VM of the image is live 10 minutes after this step |
| +ended. `cert launch` has no safety class; any failure skips. Not replayable. |
| ### 5.3 Judge, and the probe facts (block) |
| @@ -707,7 +814,7 @@ if [ -n "$leaks" ]; then |
| skip_to_teardown "the egress matrix shows reachability: $leaks" |
| exit 0 |
| fi |
| -ops fact "resolver and metadata probes" "unconfirmed: a timeout passes them" "confirmed" |
| +ops finding "resolver and metadata probes: unconfirmed (a timeout passes them)" |
| set +e |
| cert judge -evidence "$P/evidence.json" -release "$P/release/image-manifest.json" -controller-pub "$P/keys/controller.pub" -out "$P/snapshot.json" > "$P/judge.json" 2> "$P/judge.err" |
| rc=$? |
| @@ -715,15 +822,11 @@ set -e |
| if [ "$rc" != 0 ]; then skip_to_teardown "the evidence does not certify: $(head -c 400 "$P/judge.err")"; exit 0; fi |
| ``` |
| -Every probe row goes into the ledger as a note: what the metadata and resolver probes saw |
| -(`root_vpc_dns_silent`, `root_metadata_no_credential`, `sandbox_managed_resolvers`, |
| -`sandbox_metadata`), and how the hosted bubblewrap and the containment suite did on the real MicroVM. |
| -The two rows the matrix expects reached are its positive controls (`hostedcert/matrix.go`). Any |
| -other row that reached marks the run NOT PASSED and goes to teardown; the VM is already settled, so |
| -section S would only leave the proxies up. The resolver (`169.254.169.253`) and metadata probes pass |
| -on a timeout, so they stay a standing FINDING "unconfirmed" (the coordinator's ruling: a positive |
| -control only if it is one read-only command inside the VM's existing probe; it is not, see |
| -section 11). Any other judge failure is a skip. |
| +Every probe row goes into the ledger as a note. The two rows the matrix expects reached are its |
| +positive controls (`hostedcert/matrix.go`). Any other row that reached marks the run NOT PASSED and |
| +goes to teardown (the VM is already settled). The resolver (`169.254.169.253`) and metadata probes |
| +pass on a timeout: a standing FINDING "unconfirmed" (the coordinator's ruling). Any other judge |
| +failure is a skip. |
| ### 5.4 Paul signs (HUMAN, bounded 12 hours) |
| @@ -746,38 +849,35 @@ echo "for Paul: $H"; cat "$H/SHA256SUMS"; echo "commit: $PIN" |
| ``` |
| The agent tells Paul: the directory `$H` on docs-t1 (its absolute path), the three files and their |
| -SHA-256s, that `image-manifest.json`'s SHA-256 is the one the release `hosted-dev-0.0.1` lists on |
| -the forge, the controller public key, and the commit `<PIN>`. |
| +SHA-256s, that `image-manifest.json`'s SHA-256 is the one `hosted-dev-0.0.1` lists on the forge, the |
| +controller public key, and the commit `<PIN>` (prerequisite 5 built `equipo-hosted-certify` there). |
| -**What Paul does, on his Mac** (the certification key never touches docs-t1). He receives three |
| -files, `evidence.json`, `image-manifest.json` and `controller.pub`, with `SHA256SUMS`; he returns |
| -one, `certificate.json`: |
| +**What Paul does, on his Mac.** He receives `evidence.json`, `image-manifest.json` and |
| +`controller.pub`, with `SHA256SUMS`; he returns one file, `certificate.json`: |
| ```sh |
| -cd ~/src/equipo |
| -git fetch origin |
| -git checkout --detach '<PIN>' |
| -go build -o ~/equipo-cert/equipo-hosted-certify ./cmd/equipo-hosted-certify |
| cert() { ~/equipo-cert/equipo-hosted-certify "$@"; } |
| mkdir -p ~/equipo-cert/drill && cd ~/equipo-cert/drill |
| scp 'docs-t1:<H>/evidence.json' 'docs-t1:<H>/image-manifest.json' 'docs-t1:<H>/controller.pub' 'docs-t1:<H>/SHA256SUMS' . |
| shasum -a 256 -c SHA256SUMS |
| -cert sign -evidence evidence.json -release image-manifest.json -controller-pub controller.pub -key ~/equipo-cert/paul-cert-1 -key-id paul-cert-1 -out certificate.json |
| +cert sign -evidence evidence.json -release image-manifest.json -controller-pub controller.pub -key ~/equipo-cert/paul-cert-1.key -key-id paul-cert-1 -out certificate.json |
| scp certificate.json 'docs-t1:<H>/certificate.json' |
| ``` |
| -(`~/src/equipo` stands for his clone of `oficina/equipo`.) `cert sign` judges the evidence again and |
| -signs only the snapshot it derives from it. **Meanwhile** the three hosts, their addresses and |
| -volumes, the image, the connector and the buckets stay up: about $0.055 an hour, $0.66 for the full |
| -12 hours. No VM runs (5.2 settled it), and nothing can launch checks: there is no certificate and |
| -staging holds no instance key. Past 12 hours the watchdog unit runs section S itself. |
| +`cert sign` judges the evidence again and signs only the snapshot it derives from it. **Meanwhile** |
| +the three hosts, their addresses and volumes, the image, the connector and the buckets stay up: |
| +about $0.055 an hour, $0.66 for the full 12 hours. No VM runs (5.2 settled its step); nothing can |
| +launch checks (no certificate, no instance key on staging). If the agent is attending, it runs |
| +`ops vms scan --image "$IMAGE_ARN" --max 2m` every 30 minutes; the controller's own reaper stops any |
| +VM it does not own after 10 minutes in any case. Past 12 hours the watchdog runs section S, and |
| +section 8 follows at once (R1). |
| **5.4b, the certificate in place (block), when Paul says it is signed.** |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| if skipped; then exit 0; fi |
| -if grep -q 'WAIT-EXPIRED cert-signed' "$P/journal.tsv"; then echo "the signing wait expired; section S ran; ask Paul"; exit 0; fi |
| +if grep -q 'WAIT-EXPIRED cert-signed' "$P/journal.tsv"; then echo "the signing wait expired; section S ran; section 8 runs now"; exit 0; fi |
| H="$P/handoff"; CTL="https://$(tfo services controller_public_ip)"; PIN_HEX=$(cat "$P/controller.pin") |
| CERT_PUB=$(ops ledger show | jq -er '.notes["cert-pub"]') |
| jq -n --arg pub "$CERT_PUB" '{keys: [{id: "paul-cert-1", public_key: $pub}]}' > "$P/cert-keys.json" |
| @@ -787,8 +887,17 @@ rc=$? |
| set -e |
| if [ "$rc" != 0 ]; then echo "the certificate does not verify (exit $rc); ask Paul to sign again; the clock still runs"; exit 0; fi |
| ops wait-human cert-signed --done |
| +set +e |
| cert bundle -cert-keys "$P/cert-keys.json" -cert "$H/certificate.json" -out "$P/certificates.json" |
| +rc=$? |
| +set -e |
| +if [ "$rc" != 0 ]; then skip_to_teardown "the certificate set was not written (cert bundle exit $rc)"; exit 0; fi |
| +set +e |
| ops object put --bucket equipo-hosted-dev-config-640012953448 --key controller/certificates.json --file "$P/certificates.json" |
| +rc=$? |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then skip_to_teardown "the certificate set was not uploaded"; exit 0; fi |
| set +e |
| cert reload -controller "$CTL" -controller-tls-pin "$PIN_HEX" -controller-pub "$P/keys/controller.pub" -operator-id operator -operator-key "$P/keys/operator.key" |
| rc=$? |
| @@ -797,8 +906,8 @@ if [ "$rc" != 0 ]; then skip_to_teardown "the controller did not take the certif |
| ops assert cert-listed "$IMAGE_DIGEST" |
| ``` |
| -`cert bundle` writes the controller's set, `{"certificates": [...]}`, verifying the certificate |
| -under the same key file first. |
| +`cert bundle` writes the controller's set, `{"certificates": [...]}`, verifying the certificate under |
| +the same key file first. `cert` has no safety class: its failures skip. |
| ## 6. Staging wired, and three hosted checks |
| @@ -825,10 +934,10 @@ set -e |
| if ! grep -q 'hosted_controller_reachable' "$P/staging-hosted.log"; then skip_to_teardown "staging does not reach the controller"; exit 0; fi |
| ``` |
| -The secret is read from standard input, so it never appears in an argument list. The last `env set` |
| -turns hosted work on and restarts staging. 8.1 and S.1 turn it off. |
| +The secret is read from standard input. The last `env set` turns hosted work on and restarts staging. |
| +8.1 and S.1 turn it off. |
| -### 6.2 Three hosted checks, run by the suite's person |
| +### 6.2 Three hosted checks, one at a time (R3) |
| **6.2a (block): admit the VMs.** |
| @@ -839,130 +948,217 @@ set +e |
| ops reserve vm 6 |
| rc=$? |
| set -e |
| -if [ "$rc" != 0 ]; then skip_to_teardown "the checks VMs were not admitted (reserve exit $rc)"; exit 0; fi |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then skip_to_teardown "the checks VMs were not admitted"; exit 0; fi |
| ``` |
| -Six: three steps, each with one retry. |
| +Six: three steps, each with one retry. Codes: 1 skips, 99 goes to recovery. |
| -**6.2b, the suite (agent's shell, sandbox off, background, 100 minutes):** |
| -`cd "$P/repo" && python3 scripts/staging-thin.py suite hosted-pass,hosted-fail,hosted-new-module`. |
| -While it runs, block 6.2c every 5 minutes; when it ends, its report is |
| -`~/.local/share/equipo-runner-staging/report.json`. |
| +**For each scenario in turn, `hosted-pass`, then `hosted-fail`, then `hosted-new-module`:** |
| -**6.2c (block), every 5 minutes, and once when the suite has ended:** |
| +1. **The suite (agent's shell, sandbox off, background, 60 minutes):** |
| + `bash -c '. "<P>/run.env"; suite hosted-pass'` (then `hosted-fail`, `hosted-new-module`). One |
| + scenario per suite call, so each settles before the next. |
| +2. **While it runs, every 5 minutes (a plain command, the read envelope):** |
| + `ops vms scan --image "$IMAGE_ARN" --max 2m`. Exit 99 is a hard stop: a VM live for 2 minutes that |
| + is neither the controller's nor a recorded launch. Exit 1 (the scan or the controller unreadable) |
| + is a FINDING; the next scan tries again. |
| +3. **When the suite has ended (its `HOSTED-SUITE` line), the scenario's end block** settles its |
| + step, then reads its result (`scenario_end` in `run.env`). For `hosted-pass` (6.2-end-pass): |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| if skipped; then exit 0; fi |
| IMAGE_ARN=$(jq -er .ImageArn "$P/image.json") |
| -set +e |
| -ops vms adopt |
| -set -e |
| -ops vms scan --image "$IMAGE_ARN" --max 2m |
| +ops vms settle --step hosted-pass --image "$IMAGE_ARN" --max 10m |
| +scenario_end hosted-pass 'state=done checks=passed reason=- shown=- sandbox=bubblewrap certified=yes base_checks=trusted jobs=1' |
| +``` |
| + |
| +For `hosted-fail` (6.2-end-fail): |
| + |
| +```sh |
| +set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| +if skipped; then exit 0; fi |
| +IMAGE_ARN=$(jq -er .ImageArn "$P/image.json") |
| +ops vms settle --step hosted-fail --image "$IMAGE_ARN" --max 10m |
| +scenario_end hosted-fail 'state=done checks=failed reason=- shown=- sandbox=bubblewrap certified=yes base_checks=none jobs=1' |
| ``` |
| -**6.2d (block), when the suite has ended;** the agent fills each `<result ...>` from the suite's |
| -report, the only text it fills in: |
| +For `hosted-new-module` (6.2-end-new-module): |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| if skipped; then exit 0; fi |
| IMAGE_ARN=$(jq -er .ImageArn "$P/image.json") |
| -ops vms settle --image "$IMAGE_ARN" --max 10m |
| -ops fact "hosted check pass" '<result hosted-pass>' 'passed, sandboxed bubblewrap, certified' |
| -ops fact "hosted check fail" '<result hosted-fail>' 'failed, sandboxed bubblewrap, certified' |
| -ops fact "hosted check new module" '<result hosted-new-module>' 'cannot_run needs_network deps_new_module' |
| +ops vms settle --step hosted-new-module --image "$IMAGE_ARN" --max 10m |
| +scenario_end hosted-new-module 'state=done checks=cannot_run reason=deps_new_module shown=needs_network sandbox=none certified=no base_checks=none jobs=1' |
| ``` |
| -Expected (Task 30's `TestChainHostedCheckPasses`, `TestChainFailingCheck`, `TestChainNewModule`): |
| -`waiting_hosted` within seconds, enrolment within 2 minutes, the three results above, each VM stopped |
| -with proof, usage settled. A live VM 10 minutes after the suite ended is a hard stop. A check that |
| -counts as sandboxed without a certified VM is NOT PASSED |
| -(`ops ledger note not-passed "hosted check: sandboxed without a certified VM"`). |
| +The step settle comes first: a VM of the image live 10 minutes after the step ended is a hard stop |
| +(99). A scenario that did not end `ok` (`no_checks`, `no_vm`, `timed_out`, `suite_failed`, or a run |
| +`report_missing`) is a FINDING, and the next scenario runs. The report is the run's kept copy (the |
| +`HOSTED-SUITE` line names it). A result that differs is a FINDING (a real model makes the |
| +candidates); the safety property is that `certified=yes` appears only with `sandbox=bubblewrap`. |
| ## 7. Drills on real VMs, and the alert email |
| -Each drill runs the suite's `hosted-slow` scenario (its candidate's test sleeps 240 seconds) in the |
| -background (`cd "$P/repo" && python3 scripts/staging-thin.py suite hosted-slow`, 60 minutes), after |
| -`ops reserve vm 2` (the 6.2a pattern: a refusal is a skip). The agent strikes once |
| -`ops vms scan --image "$IMAGE_ARN" --max 2m` lists a live VM and 90 more seconds have passed |
| -(enrolment is within 2 minutes). |
| +Each drill runs `hosted-slow` in its own mode and strikes only inside the scenario's |
| +checks-started window (R6). Before each: block 6.2a's pattern with `ops reserve vm 2` (1 skips the |
| +rest of section 7 to 7.4; 99 goes to recovery). Then: |
| + |
| +1. start the suite in the agent's shell (background, 60 minutes): |
| + `bash -c '. "<P>/run.env"; suite hosted-slow mode=controller-reboot'` (7.1) or |
| + `... suite hosted-slow mode=withdraw-cert` (7.2); |
| +2. at once start the strike unit (`ops unit start 7.1 -- bash "$P/blocks/7.1.sh"`) and poll it with |
| + `upoll`; run the 5-minute scans as in 6.2; |
| +3. when both have ended, run the drill's end block (7.1b, 7.2b). |
| + |
| +The strike unit waits for `HOSTED-BARRIER name=hosted-slow mode=<mode>` in the progress file (up to |
| +32 minutes; the scenario's own bound is 30 from its ask), sleeps until `strike_after`, checks the VM, |
| +and strikes only if the time is still before `strike_before`. With the barrier's `vm=` known, that VM |
| +must be live in a fresh scan; with it `unknown`, exactly one VM of the image may be live and the |
| +controller must own it (its `VM ... source=controller ... attempt=` line). Otherwise the drill is a |
| +FINDING "missed window", nothing is struck, and the run goes on. |
| -### 7.1 The controller away mid-step (unit, bound 35m) |
| +### 7.1 The controller away mid-step (unit, bound 75m; not replayable) |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| if skipped; then exit 0; fi |
| ops estimate --stop 40 |
| -ops controller reboot --enabled 1 --max 10m |
| -for i in $(seq 1 30); do |
| - rm -f "$P/status.json" |
| - set +e |
| - ops status |
| - set -e |
| - if [ -s "$P/status.json" ] && live; then break; fi |
| - sleep 30 |
| +IMAGE_ARN=$(jq -er .ImageArn "$P/image.json"); MODE=controller-reboot |
| +end=$(( $(date +%s) + 1920 )) |
| +until grep -q "^HOSTED-BARRIER name=hosted-slow mode=$MODE " "$PROG" 2>/dev/null; do |
| + if grep -q '^HOSTED-END name=hosted-slow ' "$PROG" 2>/dev/null || [ "$(date +%s)" -ge "$end" ]; then ops finding "drill controller away: missed window (no barrier)"; exit 0; fi |
| + sleep 10 |
| done |
| +B=$(grep "^HOSTED-BARRIER name=hosted-slow mode=$MODE " "$PROG" | tail -n 1) |
| +after=$(date -d "$(barrier_field strike_after "$B")" +%s); before=$(date -d "$(barrier_field strike_before "$B")" +%s); VM=$(barrier_field vm "$B") |
| +now=$(date +%s); if [ "$now" -lt "$after" ]; then sleep $(( after - now )); fi |
| +set +e |
| +ops vms adopt |
| +a=$? |
| +SCAN=$(ops vms scan --image "$IMAGE_ARN" --max 2m | tail -n 1) |
| +rc=$? |
| +set -e |
| +ordinary "$a"; ordinary "$rc" |
| +LIVE=$(jq -r '[.[] | select(.State != "TERMINATED") | .ID] | join(" ")' <<<"$SCAN" 2>/dev/null || true) |
| +ok=no |
| +if [ "$rc" = 0 ] && [ "$VM" != unknown ] && grep -qw -- "$VM" <<<"$LIVE"; then ok=yes; fi |
| +if [ "$rc" = 0 ] && [ "$VM" = unknown ] && [ "$(wc -w <<<"$LIVE")" = 1 ] && grep -q " VM $LIVE source=controller .*attempt=" "$P/journal.tsv"; then ok=yes; fi |
| +if [ "$ok" != yes ] || [ "$(date +%s)" -gt "$before" ]; then ops finding "drill controller away: missed window (vm=$VM live=$LIVE)"; exit 0; fi |
| +ops ledger note strike "controller-reboot at $(date -u +%FT%TZ) vm=$LIVE" |
| +ops controller reboot --enabled 1 --max 10m |
| +if ! status_live; then echo "the controller and proxies were not live within 15 minutes of the reboot, with a VM running"; exit 99; fi |
| ops assert status |
| ``` |
| -A VM runs, so a failed reboot is a hard stop (section S fences and settles). The poll waits up to |
| -15 minutes for the proxies to be fed again before the fatal assert. Expected, as |
| -`TestChainKillControllerMidStep` allows: the step passes, certified, either on its first VM |
| -(admission refreshed within its 2-minute freshness) or, if the outage outlasted it, after the first |
| -job fails `hosted_unavailable` and one retry on a new VM. A reboot is shorter than the feed's |
| -5-minute life, so the proxies' close-at-expiry path is not exercised (section 11). When the suite |
| -ends: `ops vms settle --image "$IMAGE_ARN" --max 10m`, then |
| -`ops fact "drill controller away" '<result>' 'passed, certified, at most 2 jobs'`. |
| +A VM runs, so the reboot's failure (1 or 99), or a stack not live 15 minutes after it, is a hard stop |
| +(section S fences and settles). **7.1b (block), when the suite has ended:** |
| + |
| +```sh |
| +set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| +if skipped; then exit 0; fi |
| +NAME=hosted-slow |
| +IMAGE_ARN=$(jq -er .ImageArn "$P/image.json") |
| +ops vms settle --step drill-reboot --image "$IMAGE_ARN" --max 10m |
| +END=$(hosted_end "$NAME"); REPORT=$(suite_report) |
| +ops ledger note suite "$(suite_line)" |
| +if ! grep -q 'NOTE strike controller-reboot' "$P/journal.tsv"; then exit 0; fi |
| +if [ -z "$REPORT" ] || [ "$REPORT" = - ] || ! grep -q ' status=ok ' <<<"$END "; then ops finding "drill controller away: the scenario did not end ok: ${END:-none}"; exit 0; fi |
| +GOT=$(result_of "$NAME" "$REPORT") |
| +WANT='state=done checks=passed reason=- shown=- sandbox=bubblewrap certified=yes base_checks=trusted jobs=1' |
| +if [ "${GOT##*jobs=}" = 2 ]; then WANT='state=done checks=passed reason=- shown=- sandbox=bubblewrap certified=yes base_checks=trusted jobs=2'; fi |
| +ops fact "drill controller away" "$GOT" "$WANT" |
| +``` |
| + |
| +Expected, as `TestChainKillControllerMidStep` allows: passed and certified, `jobs=1` (the admission |
| +stayed fresh) or `jobs=2` (the first job failed `hosted_unavailable` and one retry passed). A reboot |
| +is shorter than the feed's 5-minute life, so the proxies' close-at-expiry path is not exercised. |
| -### 7.2 The certificate withdrawn mid-step (block) |
| +### 7.2 The certificate withdrawn mid-step (unit, bound 40m; not replayable) |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| if skipped; then exit 0; fi |
| +IMAGE_ARN=$(jq -er .ImageArn "$P/image.json"); MODE=withdraw-cert |
| CTL="https://$(tfo services controller_public_ip)"; PIN_HEX=$(cat "$P/controller.pin") |
| -cert bundle -cert-keys "$P/cert-keys.json" -empty -out "$P/no-certificates.json" |
| -ops object put --bucket equipo-hosted-dev-config-640012953448 --key controller/certificates.json --file "$P/no-certificates.json" |
| +end=$(( $(date +%s) + 1920 )) |
| +until grep -q "^HOSTED-BARRIER name=hosted-slow mode=$MODE " "$PROG" 2>/dev/null; do |
| + if grep -q '^HOSTED-END name=hosted-slow ' "$PROG" 2>/dev/null || [ "$(date +%s)" -ge "$end" ]; then ops finding "drill certificate withdrawn: missed window (no barrier)"; exit 0; fi |
| + sleep 10 |
| +done |
| +B=$(grep "^HOSTED-BARRIER name=hosted-slow mode=$MODE " "$PROG" | tail -n 1) |
| +after=$(date -d "$(barrier_field strike_after "$B")" +%s); before=$(date -d "$(barrier_field strike_before "$B")" +%s); VM=$(barrier_field vm "$B") |
| +now=$(date +%s); if [ "$now" -lt "$after" ]; then sleep $(( after - now )); fi |
| set +e |
| -cert reload -controller "$CTL" -controller-tls-pin "$PIN_HEX" -controller-pub "$P/keys/controller.pub" -operator-id operator -operator-key "$P/keys/operator.key" |
| +ops vms adopt |
| +a=$? |
| +SCAN=$(ops vms scan --image "$IMAGE_ARN" --max 2m | tail -n 1) |
| rc=$? |
| set -e |
| -[ "$rc" = 0 ] || ops fact "withdrawing the certificate" "cert reload exit $rc" "exit 0" |
| +ordinary "$a"; ordinary "$rc" |
| +LIVE=$(jq -r '[.[] | select(.State != "TERMINATED") | .ID] | join(" ")' <<<"$SCAN" 2>/dev/null || true) |
| +ok=no |
| +if [ "$rc" = 0 ] && [ "$VM" != unknown ] && grep -qw -- "$VM" <<<"$LIVE"; then ok=yes; fi |
| +if [ "$rc" = 0 ] && [ "$VM" = unknown ] && [ "$(wc -w <<<"$LIVE")" = 1 ] && grep -q " VM $LIVE source=controller .*attempt=" "$P/journal.tsv"; then ok=yes; fi |
| +if [ "$ok" != yes ] || [ "$(date +%s)" -gt "$before" ]; then ops finding "drill certificate withdrawn: missed window (vm=$VM live=$LIVE)"; exit 0; fi |
| +set +e |
| +cert bundle -cert-keys "$P/cert-keys.json" -empty -out "$P/no-certificates.json" |
| +c=$? |
| +ops object put --bucket equipo-hosted-dev-config-640012953448 --key controller/certificates.json --file "$P/no-certificates.json" |
| +o=$? |
| +ACK=$(cert reload -controller "$CTL" -controller-tls-pin "$PIN_HEX" -controller-pub "$P/keys/controller.pub" -operator-id operator -operator-key "$P/keys/operator.key") |
| +r=$? |
| +set -e |
| +ordinary "$o" |
| +if [ "$c$o$r" = 000 ] && jq -e '.certificates == 0' <<<"$ACK" > /dev/null; then |
| + ops ledger note strike "withdraw-cert acknowledged at $(date -u +%FT%TZ) vm=$LIVE" |
| +else |
| + ops finding "drill certificate withdrawn: the withdrawal was not acknowledged (bundle $c, put $o, reload $r)" |
| +fi |
| ``` |
| -`cert bundle` with `-empty` writes the empty set, `{"certificates":[]}` (without `-empty`, a set with no |
| -certificate is refused). Expected (`TestChainCertWithdrawnMidStep`): |
| -the running job fails `uncertified`, its VM stopped with proof, and **its result is not kept**: the |
| -step does not pass, has no sandbox and no base checks. Placed again once, the controller launches |
| -nothing for it, and after the launch window it ends `cannot_run` `hosted_unavailable`. When the |
| -suite ends, block 7.2b restores the certificate and settles: |
| +The withdrawal counts only when `cert reload` answers `"certificates": 0`. **7.2b (block), when the |
| +suite has ended:** restore the certificate, settle, judge. |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| +NAME=hosted-slow |
| CTL="https://$(tfo services controller_public_ip)"; PIN_HEX=$(cat "$P/controller.pin"); IMAGE_ARN=$(jq -er .ImageArn "$P/image.json") |
| -ops object put --bucket equipo-hosted-dev-config-640012953448 --key controller/certificates.json --file "$P/certificates.json" |
| set +e |
| +ops object put --bucket equipo-hosted-dev-config-640012953448 --key controller/certificates.json --file "$P/certificates.json" |
| +o=$? |
| cert reload -controller "$CTL" -controller-tls-pin "$PIN_HEX" -controller-pub "$P/keys/controller.pub" -operator-id operator -operator-key "$P/keys/operator.key" |
| -rc=$? |
| +r=$? |
| set -e |
| -[ "$rc" = 0 ] || ops fact "restoring the certificate" "cert reload exit $rc" "exit 0" |
| -ops vms settle --image "$IMAGE_ARN" --max 10m |
| -ops fact "drill certificate withdrawn" '<result>' 'not passed, no sandbox, cannot_run hosted_unavailable' |
| +ordinary "$o" |
| +if [ "$o$r" != 00 ]; then ops finding "restoring the certificate: put $o, reload $r"; fi |
| +ops vms settle --step drill-withdraw --image "$IMAGE_ARN" --max 10m |
| +END=$(hosted_end "$NAME"); REPORT=$(suite_report) |
| +ops ledger note suite "$(suite_line)" |
| +if ! grep -q 'NOTE strike withdraw-cert acknowledged' "$P/journal.tsv"; then exit 0; fi |
| +if [ -z "$REPORT" ] || [ "$REPORT" = - ] || ! grep -q ' status=ok ' <<<"$END "; then ops finding "drill certificate withdrawn: the scenario did not end ok: ${END:-none}"; exit 0; fi |
| +GOT=$(result_of "$NAME" "$REPORT") |
| +case "$GOT" in *certified=yes*|*checks=passed*) ops ledger note not-passed "certificate withdrawn: the result was kept: $GOT";; esac |
| +ops fact "drill certificate withdrawn" "$GOT" 'state=done checks=cannot_run reason=hosted_unavailable shown=hosted_unavailable sandbox=none certified=no base_checks=none jobs=2' |
| ``` |
| -A withdrawn certificate whose VM's result was kept as passed or sandboxed is a safety failure: |
| -`ops ledger note not-passed "certificate withdrawn: the result was kept"`. |
| +Expected (`TestChainCertWithdrawnMidStep`, the headless addendum): the running job fails |
| +`uncertified`, its VM stopped with proof, **its result not kept**; placed again once, nothing |
| +launches, and the step ends `cannot_run` `hosted_unavailable`. The job count (`jobs=2`) is |
| +unconfirmed, so a difference only there is a FINDING; a kept result (`certified=yes` or |
| +`checks=passed`) after an acknowledged withdrawal is NOT PASSED. Without an acknowledged withdrawal |
| +the result is not judged (a pass would not be a containment failure). |
| ### 7.3 Not run with this kit (coordinator's ruling) |
| -Each is recorded as a FINDING and listed for slice 3 or the production rehearsal: |
| - |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| -ops fact "drill not run: proxy killed mid-step" "no ops command stops a proxy host" "run" |
| -ops fact "drill not run: VM stopped mid-step" "vms settle --terminate stops every VM of the image, the retry's too" "run" |
| -ops fact "drill not run: orphan VM" "planting a VM needs a launch outside the controller (Task 17b proved the reaper)" "run" |
| -ops fact "drill not run: launch refused while fenced" "the fence stops the controller, which then cannot launch" "run" |
| +ops finding "drill not run: proxy killed mid-step: no ops command stops a proxy host (slice 3 or the production rehearsal)" |
| +ops finding "drill not run: VM stopped mid-step: vms settle --terminate stops every VM of the image, the retry's too (slice 3)" |
| +ops finding "drill not run: orphan VM: planting a VM needs a launch outside the controller; Task 17b proved the reaper (slice 3)" |
| +ops finding "drill not run: launch refused while fenced: the fence stops the controller, which then cannot launch (slice 3)" |
| ``` |
| ### 7.4 The alert email (block, then HUMAN, bounded 2 hours) |
| @@ -971,7 +1167,7 @@ ops fact "drill not run: launch refused while fenced" "the fence stops the contr |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| if skipped; then exit 0; fi |
| CTL="https://$(tfo services controller_public_ip)"; PIN_HEX=$(cat "$P/controller.pin") |
| -grep -q 'HUMAN-DONE sns-confirmed' "$P/journal.tsv" || ops fact "alert subscription" "not confirmed by Paul" "confirmed" |
| +if ! grep -q 'HUMAN-DONE sns-confirmed' "$P/journal.tsv"; then ops finding "alert subscription: not confirmed by Paul"; fi |
| set +e |
| cert alert-test -controller "$CTL" -controller-tls-pin "$PIN_HEX" -controller-pub "$P/keys/controller.pub" -operator-id operator -operator-key "$P/keys/operator.key" |
| rc=$? |
| @@ -980,15 +1176,19 @@ ops fact "alert test" "exit $rc" "exit 0" |
| ops wait-human alert-received --max 2h --background |
| ``` |
| -The controller publishes a test alert to the dev topic; Paul says when it reaches `<ALERT_EMAIL>`, |
| -and the agent runs `ops wait-human alert-received --done`. Past 2 hours the watchdog runs section S |
| -(the drill is over by then; section 8 follows on Paul's word) and the record shows the alert not |
| -received. |
| +Paul says when the test alert reaches `<ALERT_EMAIL>`; the agent runs |
| +`ops wait-human alert-received --done`, then section 8. Past 2 hours the watchdog runs section S |
| +and section 8 follows at once; the record shows the alert not received. |
| ## 8. Teardown and verification |
| -Section 8 runs after section 7, after a skip to teardown, or, on Paul's word, after section S. |
| -Short blocks pass `--stop 50`; units make no spend check. |
| +Section 8 runs after section 7, after a skip to teardown, or at once after any safe stop but a guard |
| +failure (R1). Short blocks are `ops block <id> --teardown -- bash "$P/blocks/<id>.sh"` (no spend gate; any create refuses with |
| +99); units make no spend check. Order (R5): staging off, fence and settle, terminate, unfence, the |
| +services destroy, then the images, the connector, the buckets and the other roots, then |
| +verification. **If a teardown step stops** (99, or a unit that fails): the run runs `ops report |
| +--stopped`, reports what still exists and its daily cost, and asks Paul; that spend is not bounded |
| +until he answers. |
| ### 8.1 Staging off, watchdogs stopped (block) |
| @@ -1002,40 +1202,32 @@ rc=$? |
| carlos env unset "${S[@]}" --no-prompt EQUIPO_HOSTED_CONTROLLER EQUIPO_HOSTED_CONTROLLER_TLS_PIN EQUIPO_HOSTED_CONTROLLER_PUB EQUIPO_HOSTED_KEY_ID EQUIPO_HOSTED_IMAGE EQUIPO_HOSTED_ACCOUNT |
| carlos secrets unset "${S[@]}" EQUIPO_HOSTED_KEY |
| set -e |
| -[ "$rc" = 0 ] || ops fact "staging hosted work off" "exit $rc" "exit 0" |
| +if [ "$rc" != 0 ]; then ops finding "staging hosted work off: carlos exit $rc"; fi |
| ``` |
| -`ops unit stop --all` stops any wait-human watchdog still running. Unsetting a variable that was |
| -never set (an early skip) is a FINDING; 1.2 showed what it does. |
| - |
| ### 8.2 Fence and settle (unit, bound 100m) |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| ops fence |
| +set +e |
| ops vms reconcile |
| +rc=$? |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then ops finding "vms reconcile: a scan was incomplete; the settles scan again"; fi |
| for IMAGE_ARN in $(images); do |
| ops vms settle --image "$IMAGE_ARN" --terminate --max 15m |
| done |
| ops ledger reconcile |
| ``` |
| -`ops fence` attaches `deny_launches` to the controller role and stops the controller host. Each |
| -settle terminates every known VM, proves the image clear by three scans, requires a direct read of |
| -every known ID, and repeats after 10 minutes. With the step-down image there are two: about 90 |
| -minutes in all. A live VM after a bound is a hard stop. |
| +`ops fence` attaches `deny_launches` to the controller role and stops the controller host. Each settle |
| +terminates every known VM, proves the image clear by three scans and a direct read of each known ID, |
| +and repeats after 10 minutes. With two images, about 90 minutes. A live VM after a bound is a hard |
| +stop. |
| -### 8.3 The images (unit, bound 20m) |
| - |
| -```sh |
| -set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| -for IMAGE_ARN in $(images); do |
| - img delete -arn "$IMAGE_ARN" -timeout 15m |
| - ops ledger deleted microvm-image "$IMAGE_ARN" img-delete |
| -done |
| -``` |
| - |
| -### 8.4 Controller terminate, unfence, services destroy (unit, bound 150m) |
| +### 8.3 Controller terminate, unfence, services destroy (unit, bound 200m) |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| @@ -1045,7 +1237,7 @@ ops unfence |
| rc=$? |
| set -e |
| if [ "$rc" != 0 ]; then |
| - ops fact "unfence" "exit $rc" "exit 0" |
| + ops finding "unfence refused (exit $rc); fencing and settling once more" |
| ops fence |
| for IMAGE_ARN in $(images); do |
| ops vms settle --image "$IMAGE_ARN" --terminate --max 15m |
| @@ -1057,21 +1249,45 @@ if grep -q 'TF-APPLY services start' "$P/journal.tsv"; then |
| ops tf services destroy-dev-services |
| rc=$? |
| set -e |
| - if [ "$rc" != 0 ]; then |
| - ops fact "services destroy" "exit $rc" "exit 0" |
| + ordinary "$rc" |
| + if [ "$rc" = 1 ]; then |
| + ops finding "services destroy failed (exit 1); reconciling and destroying once more" |
| ops tf reconcile services |
| ops tf services destroy-dev-services |
| fi |
| fi |
| ``` |
| -In this order and nothing else between: `ops controller terminate` reads every controller host back |
| -`terminated`; `ops unfence` detaches `deny_launches` only with that proof, every image settled with |
| -its repeat after the last fence and no image creation unresolved, and reads the detach back; the |
| -services destroy refuses while the policy is attached. If unfence refuses, 8.2 is repeated once |
| -inside this block (a new fence, a new settle with its repeat), then unfence again; a second refusal |
| -is a hard stop with the policy left attached. Every root whose apply started is destroyed; a failed |
| -destroy gets one `ops tf reconcile` and one re-destroy, then it is a hard stop. |
| +In this order: `ops controller terminate` reads every controller host back `terminated`; |
| +`ops unfence` detaches `deny_launches` only with that proof, every image settled with its repeat after |
| +the last fence and no image creation unresolved, and reads the detach back. Unfence has no ordinary |
| +class (99 only): its one pre-approved repeat (a new fence, a new settle with its repeat, then unfence |
| +again) is the only exception to "99 goes to recovery", and a second refusal is a hard stop with the |
| +policy attached. The images are still there, so the repeat's settles can scan them (R5). The |
| +services destroy: 1 is reconciled and destroyed once more; 99 (plan-check, the fence still |
| +attached, an unresolved intent) stops. |
| + |
| +### 8.4 The images (unit, bound 45m) |
| + |
| +```sh |
| +set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| +for IMAGE_ARN in $(images); do |
| + set +e |
| + img delete -arn "$IMAGE_ARN" -ledger "$P" -timeout 15m |
| + rc=$? |
| + set -e |
| + img_ordinary "$rc" |
| + if [ "$rc" != 0 ]; then |
| + ops finding "image delete $IMAGE_ARN: img exit $rc; once more" |
| + img delete -arn "$IMAGE_ARN" -ledger "$P" -timeout 15m |
| + fi |
| +done |
| +``` |
| + |
| +With `-ledger`, `img delete` deletes only an image the journal records (4 otherwise), and takes one already |
| +gone as done (`DELETED ... read-gone`), so a re-run, or this block's `8.4.retry1`, is safe. Each |
| +delete is about 20 minutes worst; two images and a retry fit 45 minutes only if the retry is for one |
| +of them, so a unit past its bound goes to `unit wait` (recovery), then `8.4.retry1`. |
| ### 8.5 The connector (unit, bound 130m) |
| @@ -1080,14 +1296,13 @@ set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| ops connector delete |
| ``` |
| -The first real exercise of the connector's interface cleanup: this drill's VMs used the connector |
| -for egress, so Lambda-managed interfaces may exist in the VM subnet for the first time. On |
| -`DELETE_FAILED`, one retry with the managed-operator condition dropped (the subnet condition kept); |
| -interfaces left after the delete are waited for within the same 120-minute budget and verified gone, |
| -never deleted by hand. What it saw goes into the record. A second failure is a hard stop. A |
| -connector never created is skipped by `ops` itself. |
| +The first real exercise of the connector's interface cleanup. On `DELETE_FAILED`, one retry with the |
| +managed-operator condition dropped; interfaces left after the delete are waited for within the same |
| +120-minute budget and verified gone, never deleted by hand. Codes: 1 (while the connector is still |
| +recorded: a refusal, a timeout, the budget spent) fails the unit, which is replayed once as |
| +`8.5.retry1`; 99 (interfaces not proved gone after the delete) stops. |
| -### 8.6 Buckets, config, network (unit, bound 60m) |
| +### 8.6 Buckets, config, network (unit, bound 70m) |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| @@ -1099,8 +1314,9 @@ if grep -q 'TF-APPLY config start' "$P/journal.tsv"; then |
| ops tf config destroy-dev-config |
| rc=$? |
| set -e |
| - if [ "$rc" != 0 ]; then |
| - ops fact "config destroy" "exit $rc" "exit 0" |
| + ordinary "$rc" |
| + if [ "$rc" = 1 ]; then |
| + ops finding "config destroy failed (exit 1); reconciling and destroying once more" |
| ops tf reconcile config |
| ops tf config destroy-dev-config |
| fi |
| @@ -1110,49 +1326,59 @@ if grep -q 'TF-APPLY network start' "$P/journal.tsv"; then |
| ops tf network destroy-dev-network |
| rc=$? |
| set -e |
| - if [ "$rc" != 0 ]; then |
| - ops fact "network destroy" "exit $rc" "exit 0" |
| + ordinary "$rc" |
| + if [ "$rc" = 1 ]; then |
| + ops finding "network destroy failed (exit 1); reconciling and destroying once more" |
| ops tf reconcile network |
| ops tf network destroy-dev-network |
| fi |
| fi |
| ``` |
| -The buckets are emptied by their fixed names (`<prefix>-<kind>-<account>`, `infra/hosted/README.md`), |
| -so a config apply that failed before writing its outputs still empties them; a bucket that does not |
| -exist is a FINDING from `ops`. The network destroy follows the connector's deletion, so its |
| -interfaces are gone first. |
| +The buckets are emptied by their fixed names, so a config apply that failed before its outputs |
| +still empties them. A bucket's empty refused (1) fails the unit, replayed once as `8.6.retry1`. |
| ### 8.7 Verify, then the state bucket (block) |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| +set +e |
| ops verify-gone |
| +rc=$? |
| +set -e |
| +if [ "$rc" = 1 ]; then ops finding "verify-gone: the tag index did not read; reading once more"; ops verify-gone; fi |
| +if [ "$rc" = 99 ]; then echo "verify-gone found something present or unproved; see its lines above"; exit 99; fi |
| ops bucket empty --name equipo-hosted-tfstate-640012953448 --expected-owner 640012953448 |
| ops bucket delete --name equipo-hosted-tfstate-640012953448 --expected-owner 640012953448 |
| ops verify-gone --all |
| ops estimate |
| ``` |
| -`ops verify-gone` reads every recorded resource directly (the tag index is a cross-check whose lag is |
| -recorded, not chased). The state bucket goes last. |
| +`ops verify-gone` reads every recorded resource directly and every tagged ARN of the run: one the |
| +ledger does not hold must be proved absent by a direct read, or it stops (99). **If it stops on such |
| +a resource** (R9; for example a type with no direct read, or a root volume the provider tagged), |
| +everything the ledger holds is already torn down: the agent reports the resource with |
| +`verify-gone`'s lines (its ARN, type and the direct read's answer) and asks Paul; the state bucket |
| +stays (pennies a month) until he answers. |
| ### 8.8 Records and docs-t1 (agent's shell) |
| 1. `ops report --out "$P/report.md"` and `ops bundle --out "$P/bundle.json"`; copy the bundle to |
| - `docs/superpowers/plans/HOSTED-DEV-RUN-<RUN>.json`. |
| + `docs/superpowers/plans/HOSTED-DEV-RUN-<RUN>.json`; copy the suite's kept reports (named by each |
| + `NOTE suite` line) next to it. |
| 2. Append `## Task 34 live run (<RUN>)` to `HOSTED-SLICE2-PROGRESS.md`: the pin, `hosted-dev-0.0.1` |
| and its `IMAGE_DIGEST`, every FINDING (`grep FINDING "$P/journal.tsv"`), the probe notes, the |
| - reboot length, the drill results, the rehearsal's S.1 line, the first-real-run results of |
| - section 10, the connector's interface facts, the final estimate and the bill items. |
| + reboot length, every `HOSTED-RESULT` and strike note, the rehearsal's S.1 line, the first-real-run |
| + results of section 10, the connector's interface facts, the final estimate and the bill items. |
| 3. Write `Task 34 PASSED (run <RUN>, <n> FINDINGs)` at the start of a line **only if every safety |
| check passed**: no hard stop and no `not-passed` note; every guard passed; `ops assert network`, |
| `status`, `enabled`, `cert-listed`, `release-file`, `image-digest` and `handoff-manifest` passed; |
| - the judge passed and Paul's certificate verified; every settle proved its image clear; hosted |
| - checks pass and fail were certified with their expected results; drill 7.2's result was not kept; |
| - the alert email arrived (`HUMAN-DONE alert-received`); fence, terminate and unfence ran in order; |
| - `ops verify-gone --all` passed; the final estimate stayed under $40. Otherwise write |
| - `Task 34 NOT PASSED` with the failed check. The production plan's 0.1 looks for the PASSED line. |
| + the judge passed and Paul's certificate verified; every step settle (`STEP-SETTLED`) and image |
| + settle proved its image clear; `hosted-pass` and `hosted-fail` gave their expected results; drill |
| + 7.2 struck with an acknowledged withdrawal and its result was not kept; the alert email arrived |
| + (`HUMAN-DONE alert-received`); fence, terminate and unfence ran in order; `ops verify-gone --all` |
| + passed; the final estimate stayed under $40. A missed drill window is a FINDING, not a failure, |
| + but 7.2 must have struck for PASSED. Otherwise write `Task 34 NOT PASSED` with the failed check. |
| 4. Commit both files locally (subject under 80 characters, the trailer); never push. |
| 5. On docs-t1: `ops unit stop --all`; `rm -rf "$P/keys"`; `git worktree remove --force "$P/repo"`; |
| `rm -rf "$P"`; check that no `hdev-<RUN>-*` or `hdev-r<RUN>-*` unit is loaded. |
| @@ -1164,88 +1390,103 @@ recorded, not chased). The state bucket goes last. |
| from 2.2's notes; S.2 fences (deny attach, controller host stopped); S.3 identifies every VM; S.4 |
| settles each image with its repeat, then reconciles every other intent and any interrupted `tf` |
| root; S.5 writes the bundle and `report.md --stopped`. It never checks spend, never unfences, never |
| -terminates the controller and deletes nothing but VMs. A fence that attached the policy ends the |
| -drill (reboot refuses while it is attached); one that attached nothing (no services yet) does not. |
| -What is left costs about $1.15 a day on the bill (proxies running, the controller stopped, three |
| -addresses, three volumes, the image), and the estimate counts $1.31 a day, until Paul says to run |
| -section 8 (from 8.1; 8.2's fence runs again harmlessly). |
| +terminates the controller and deletes nothing but VMs. **Then section 8 runs at once** (R1), |
| +pre-approved, unless the stop was the guard (account, caller, region): then nothing more runs, the run |
| +reports, and what exists costs about $1.15 a day on the bill until Paul answers. A fence that |
| +attached the policy ends the drill's live part (reboot refuses while it is attached). |
| ## 9. Spend |
| -All figures use `ops estimate`'s model (`internal/hostedops/estimate.go`), the account plan's |
| -section 11: hosts' hours since creation, rounded up per host, at on-demand rates with each host's |
| -public IPv4 address ($0.005/h) and 8 GB gp3 volume ($0.000964/h); every VM ever recorded at 4x the |
| -Large rate for its full 90-minute life ($1.86); every reservation not yet used ($1.86 a VM, $1 a |
| -build); each image build $1; each image's storage at its one-week minimum ($8 × 7/30 = $1.87); $1 |
| -for S3, SNS and alarms. |
| +All figures use `ops estimate`'s model (`internal/hostedops/estimate.go`): hosts' hours since |
| +creation, rounded up per host, at on-demand rates with each host's public IPv4 address ($0.005/h) and |
| +8 GB gp3 volume ($0.000964/h); every VM ever recorded at 4x the Large rate for 90 minutes ($1.86); |
| +every reservation not yet used ($1.86 a VM, $1 a build); each build $1; each image's storage at its |
| +one-week minimum ($8 × 7/30 = $1.87); $1 for S3, SNS and alarms. Teardown blocks journal the estimate |
| +but never refuse on it. |
| Hosts, per hour: controller `t4g.small` $0.0184 + $0.005 + $0.000964 = $0.024364; each proxy |
| `t4g.micro` $0.0092 + $0.005 + $0.000964 = $0.015164; the three **$0.054692 an hour**, $1.31 a day. |
| -Reservations stay counted until a VM uses each, so the estimate always holds every one: 5.2 two, 6.2 |
| -six, 7.1 two, 7.2 two: **12 VMs, $22.32**. Builds: one, plus one only if the step-down runs. |
| +Reservations stay counted until a VM uses each: 5.2 two, 6.2 six, 7.1 two, 7.2 two: **12 VMs, |
| +$22.32**. Builds: one, plus one only if the step-down runs. |
| | | Expected (to plan) | Worst case | |
| | --- | --- | --- | |
| -| Hosts | 9 h × $0.054692 = $0.49 | 25 h × $0.054692 = $1.37 | |
| +| Hosts | 9 h × $0.054692 = $0.49 | 26 h × $0.054692 = $1.42 | |
| | VMs and VM reservations | 12 × $1.86 = $22.32 | 13 × $1.86 = $24.18 (a late VM found by a settle repeat) | |
| | Image builds | 1 × $1 = $1.00 | 2 × $1 = $2.00 (the step-down) | |
| | Image storage | 1 × $1.87 | 2 × $1.87 = $3.73 (the step-down image) | |
| | S3, SNS, alarms | $1.00 | $1.00 | |
| -| **Estimate** | **$26.68** | **$32.28** | |
| - |
| -Host hours, from the services apply to the hosts' termination. Expected: hosts up and status 0.75, |
| -certification 1, signing 2, wiring 0.25, the three checks 1, the drills 1.5, the alert 0.5, teardown |
| -to termination 1.25: 8.25, rounded up to 9. Worst: 0.75, 1, the signing bound 12, 0.25, the suite |
| -1.67, the drills 2, the alert bound 2, teardown to termination 4.5 (8.2's 100 minutes, 8.3's 20, |
| -8.4's 150): 24.2, rounded up to 25. |
| - |
| -**Self-stop $40** leaves $7.72 over the worst case: four unplanned VMs, or about six days of hosts |
| -after a safe stop. **Ceiling $50**: the stop is checked only when a block or reservation starts, and |
| -the estimate leaves out the connector, the state bucket and data transfer. Teardown blocks are gated |
| -at $50, about 13 days of hosts after a worst-case safe stop. |
| +| **Estimate** | **$26.68** | **$32.33** | |
| + |
| +Host hours, from the services apply to the hosts' termination (8.3). Expected: up and status 0.75, |
| +certification 1, signing 2, wiring 0.25, three scenarios 1.5, two drills 1.5, the alert 0.5, teardown |
| +to termination 1.25: 8.75, rounded up to 9. Worst: 0.75, certification 1 (5.1's 20 minutes, 5.2's |
| +40), the signing bound 12, 0.25, three scenarios 2.6 (each up to 42 minutes plus its settle), two |
| +drills 1.8, the alert bound 2, teardown to termination 4.8 (8.1 10 minutes, 8.2 100, 8.3 200 at its |
| +worst with the unfence repeat): 25.2, rounded up to 26. |
| + |
| +**After a safe stop** (R1): the recovery (up to 36 minutes) then section 8 at once; the hosts end |
| +by 8.3, at most about 5.4 hours after the stop: at most **6 host-hours, about $0.33**, added to the |
| +estimate at the stop. Nothing else grows: no VM runs after S.4, and image storage is already |
| +charged at its minimum. The worst case above already covers the latest possible stop (the alert |
| +wait's expiry). The exceptions are a guard failure and a teardown step that stops: then about $1.15 |
| +a day on the bill (the controller stopped; proxies, three addresses, volumes, the image) until Paul |
| +answers. |
| + |
| +**Self-stop $40** leaves $7.67 over the worst case: four unplanned VMs. **Ceiling $50**: the stop is |
| +checked only when a block or reservation starts, and the estimate leaves out the connector, the |
| +state bucket and data transfer. Teardown is never refused on spend. |
| **The bill** is far below the estimate, which is a ceiling by design. Expected: hosts 9 hours about |
| -$0.49; VMs at the Large baseline of about $0.32 an hour (the account plan's rates): certification |
| -30 minutes $0.16, seven checks VMs at about 15 minutes $0.56; the image build about $0.20; image |
| -storage for a day about $0.27; S3, SNS, CloudWatch under $0.10: **about $1.80**. At most about $5 if |
| -every VM bursts at 4x and storage bills its full week. |
| +$0.49; VMs at the Large baseline of about $0.32 an hour: certification 30 minutes $0.16, seven checks |
| +VMs at about 15 minutes $0.56; the image build about $0.20; image storage for a day about $0.27; S3, |
| +SNS, CloudWatch under $0.10: **about $1.80**. At most about $5 if every VM bursts at 4x and storage |
| +bills its full week. |
| ## 10. First real runs, and what happens if each one fails |
| -| Path | Where | If it fails | |
| +| Path | Where | Codes and what follows | |
| | --- | --- | --- | |
| | systemd units, the env allowlist, linger | 0.1 | abort before any AWS call | |
| | `carlos` under `env -i` | 0.1, then 1.2 from a unit | abort; FINDING | |
| -| the recovery unit (lock, membership, safe stop, S.1's carlos) | 1.2, own run | abort if it never runs or ends; problems are FINDINGs | |
| -| refresh-only reconcile on real state | 2.3 | FINDING | |
| -| a re-apply after a failed apply (creates plus no-ops) | 2.3, 2.4, 4.1, only if an apply fails | a second failure: reconcile, skip; unexercised if nothing fails (recorded) | |
| -| OpenTofu import adoption | after a second failed apply, in its reconcile, then in the destroy | an adoption plan refusal is a hard stop; unexercised if nothing fails (recorded) | |
| -| the default VPC's gateway as `PRE-RUN` | 1.1, used by any network reconcile | an unaccounted gateway: hard stop | |
| -| AWS's build on base version 4, with the 23 + 5 RPMs | 3.3 | step down once; then skip | |
| +| the recovery unit (lock, membership, safe stop, S.1's carlos) | 1.2, own run, 50 minutes | abort if it never runs or ends; problems are FINDINGs | |
| +| refresh-only reconcile on real state | 2.3 | 1: FINDING; 99: stop | |
| +| a re-apply after a failed apply (creates plus no-ops) | 2.3, 2.4, 4.1 | 1: once, then reconcile and skip; 99: stop | |
| +| OpenTofu import adoption | in the reconcile after a second failed apply, then in the destroy | an adoption plan refusal (99): stop | |
| +| the connector | 2.5 | 1: reconcile, skip; 99: stop | |
| +| AWS's build on base version 4, with the 23 + 5 RPMs, tagged | 3.3 | 6: step down once; 1, 2, 5: skip; 4: stop | |
| | the hosted bubblewrap and containment suite on a real MicroVM | 5.2, 5.3 | skip | |
| -| the metadata and resolver probes | 5.3 | reached: NOT PASSED and skip; else a standing FINDING "unconfirmed" | |
| +| the metadata and resolver probes | 5.3 | reached: NOT PASSED and skip; otherwise a standing FINDING "unconfirmed" | |
| | `lambda:PassNetworkConnector` | 5.2 | skip | |
| -| proxies booting with `controller.json` written late | 4.2, 4.3 | not live in 15 minutes: skip | |
| -| the estimate's scan retry | every block | an incomplete scan after 3 minutes: hard stop | |
| -| Litestream install and restore check | 3.1, 4.3 | install: skip (digest); check: FINDING | |
| -| `ops controller reboot`, waiting for the host to go away | 5.1, 7.1 | 5.1 skip; 7.1 hard stop | |
| -| `cert bundle` (with and without `-empty`) and `cert reload` | 5.4b, 7.2 | skip, FINDING | |
| +| the pin, and proxies booting with `controller.json` late | 4.2, 4.3 | wait 1: skip; not live in 15 minutes: skip; assert: stop | |
| +| the estimate's scan retry | every block | an incomplete scan past 3 minutes: stop | |
| +| Litestream install and restore check | 3.1, 4.3 | install 1: skip, 99: stop; check 1: FINDING | |
| +| `ops controller reboot`, waiting for the host to go away | 5.1, 7.1 | 5.1: 1 skip, 99 stop; 7.1: any failure stops | |
| +| `vms scan` against the controller's table | 6, 7, the human waits | 99 (unexplained VM): stop; 1: FINDING | |
| +| `vms settle --step` per scenario | 5.2, 6.2, 7.1b, 7.2b | 99: stop | |
| +| the checks-started barrier and the strike window | 7.1, 7.2 | missed: FINDING; a strike outside it never happens | |
| +| `cert bundle` (with and without `-empty`) and `cert reload` | 5.4b, 7.2 | skip, FINDING; a withdrawal not acknowledged is not judged | |
| | the dev alert subscription and a real alert email | 2.4, 7.4 | FINDING; PASSED needs it | |
| -| `ops fence`, `ops controller terminate`, `ops unfence` | 8.2, 8.4 | unfence: one repeat of 8.2; then hard stop | |
| -| `tf` destroys | 8.4, 8.6 | one reconcile and one re-destroy; then hard stop | |
| -| the connector's interface cleanup | 8.5 | the built-in retry; then hard stop | |
| -| `ops verify-gone` with real direct reads | 8.7 | hard stop | |
| +| `ops fence`, `ops controller terminate`, `ops unfence` | 8.2, 8.3 | unfence: one repeat of fence and settle; then stop | |
| +| `tf` destroys | 8.3, 8.6 | 1: one reconcile and one re-destroy; 99: stop | |
| +| `img delete` with `-ledger`, resumable | 8.4 | ordinary: once more; 4: stop | |
| +| the connector's interface cleanup | 8.5 | 1: `8.5.retry1`; 99: stop | |
| +| `verify-gone` with the strict tag cross-check | 8.7 | 1: once more; 99: report and ask Paul (R9) | |
| ## 11. Unconfirmed, and open questions |
| -- The resolver address `169.254.169.253` and the MicroVM metadata protocol: probes pass on a |
| - timeout, VPC DNS is off and a VM has no role, so the drill cannot confirm either. Standing FINDING. |
| - The image probes only that resolver, not the VM VPC's `+2` address (`10.43.0.2`); VPC DNS off is |
| - asserted separately (2.3). A positive control that is one read-only command inside the existing |
| - probe does not exist: it would need a VPC with DNS on, or a role on the VM. |
| -- How long a reboot keeps the controller away (5.1 records it), and whether 7.1's step needs its |
| - retry. |
| +- **The images' tags** are passed on the create call, but no kit command reads them back, so the |
| + plan cannot verify them; `verify-gone`'s tag cross-check sees them only if the tag index lists |
| + MicroVM images. |
| +- The resolver address `169.254.169.253` and the MicroVM metadata protocol: probes pass on a timeout; |
| + standing FINDING. |
| +- 7.2's job count (`jobs=2`), the step `reason` on passed and failed checks, and `carlos db query`'s |
| + output (the result fields `base_checks` and `jobs` read `unknown` if it differs): unconfirmed |
| + (headless report). |
| +- During the human waits the scans need the agent attending; otherwise the controller's reaper (10 |
| + minutes) and the next step settle are the backstops. |
| +- How long a reboot keeps the controller away (5.1 records it). If the controller comes back between |
| + two 15-second reads, `ops controller reboot` never sees it go and runs into `--max`. |
| - Ireland rates for MicroVMs, `t4g` hosts and image storage; the bill confirms them. |
| - Whether a failed image build leaves an image AWS charges storage for (the estimate assumes yes). |
| -- The suite's hosted scenarios (prerequisite 4) do not exist yet. |
diff --git a/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md b/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md| index eed7769e..56009705 100644 |
| --- a/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md |
| +++ b/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md |
| @@ -3741,3 +3741,22 @@ from memory) and the test green again: |
| with an unfinished unit before the chain is read, so the check is a second guard no test can |
| reach without removing the first. |
| - **K8** `finding` journalling FACT: `TestFindingCommand` FAILED `kit34_test.go:559: no FINDING lines`. |
| + |
| +## Task 34 revision 2 (Astra p34-r1, rulings R1 to R10, 2026-12-02) |
| + |
| +The dev drill plan, revision 2: each of Astra's twelve round-1 findings with its fix (the plan's |
| +"Revision 2" section), written against the kit of `f384ee23` and `f0056f0a` and the headless contract |
| +of `2a884860` and `cad3e171`. No code changed; no AWS call. Teardown after any safe stop but a guard |
| +failure (R1) with `ops block --teardown`; fallbacks only on exit 1 or img's ordinary codes (R2); |
| +per-scenario step settles and controller-table scans (R3); `upoll` on `ops unit status` with the |
| +kit's measured bounds (R4); images deleted after unfence with `img delete -ledger` (R5); strikes only |
| +inside the `HOSTED-BARRIER` window (R6); `paul-cert-1.key` and the Mac check (R7); `ops finding` for |
| +skips and the corrected STS text (R8); verify-gone's stop reported to Paul (R9); the scratch hosted |
| +project as a prerequisite (R10); tagged images; `.retry1` IDs; `HOSTED-RESULT` expectations. |
| + |
| +Green: `TestPlanInvocationsParse`, `TestPlanCertInvocationsParse`, `TestPlanImgInvocationsParse`, |
| +`make budget`, `bash -n` on all 42 `sh` blocks and on the quoted part of `run.env`. The parse tests |
| +caught four span defects on the way (a `--teardown` block without its command, a retry wait without |
| +`--max`, a `--step` given a shell variable, `img delete -ledger` without a value); each was fixed in |
| +the plan text. The `run.env` helpers were run against a fake `ops`: `upoll` gave `done`, `over` and |
| +`unreadable`; `ordinary 99` and `img_ordinary 4` exited 99; the barrier and suite lines parsed. |