plans: Task 34 dev drill rev 3, Astra round 2
Astra round 2's open findings: section 8 is one teardown script armed as the recovery's continuation before the first human wait, its 23 h bound summed over every permitted retry; each operation classified before the next dependent one; a watcher per scenario that settles at the step's own end, reads only its run's lines and strikes only inside the window; unreadable polls go to bounded recovery; one delete block per image; missing progress lines are findings; resumable bucket teardown.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+672
−417
docs/superpowers/plans/2026-12-01-hosted-2-dev-live-plan.md+641 −417docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md+31 −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 1.5s
ci-box: codex: fetched and verified in 3.5s
ci-box: codex-code-mode-host: fetched and verified in 1.5s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.4s
ci-box: tofu: fetched and verified in 1.7s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.9s
ci-box: pi: installed and verified in 14.3s
ci-box: opencode: installed and verified in 2.3s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.8s
ci-box: clone deepened in 6.1s
ci-box: file times set from content: 4063 files, 303 directories
ci-box: ready in 26.7s
=== 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.236s
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 d4d72a19..db53755a 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,15 +1,55 @@ |
| # Hosted runners slice 2, Task 34: the dev drill in `kass` (for Paul's GO) |
| -**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 |
| +**Revision:** 3 (2026-12-02), after Astra's round 2 (`.superpowers/sdd/2026-11-30-hosted-runners-slice-2/p34-r2.md`), |
| +with the coordinator's revision 3 rulings (`task-34-rev3-brief.md`), the run kit's round 2 |
| +(`dc868b1c`, `0acdeea7`; `kit-p34-report.md`, "Round 2") and the headless round 2 (`4efc4956`). |
| +Revision 2 answered Astra's round 1 with rulings R1 to R10 (`task-34-rev2-brief.md`), the kit of |
| +`f384ee23` and `f0056f0a` and the headless contract of `2a884860` and `cad3e171`. Next: Astra's last |
| +round, 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 3: each open finding of Astra's round 2 and its fix |
| + |
| +1. **Unattended recovery left spend unbounded** (finding 1). Section 8 is one script, |
| + `$P/teardown.sh` (8.0), written and armed at 2.2b, before the first human wait: |
| + `ops continuation arm "$P/teardown.sh" --max 23h` (kit K9). After any recovery but a guard |
| + failure (or a failed credential check), the recovery unit starts it unattended as |
| + `hdev-<RUN>-teardown`. Its first command is `ops unit stop --all` (kit concern 3), and the agent |
| + disarms it before running section 8 by hand (kit concern 2). 23 hours covers every permitted |
| + retry (the sum, 21 h 51 min, is in 8.0); from a trigger the hosts are gone within about 6 hours |
| + (about $0.33) and the continuation ends within about 23 h 42 min. 2.2b states the credentials' |
| + limit. |
| +2. **Classified after the next action** (finding 2). Every operation is classified on its next |
| + lines, before anything that depends on it: 4.2's two puts, 5.1's two puts before the reboot, |
| + 5.4b's bundle, put and reload, and the drills' put before any reload. |
| +4. **The settle bound started late** (finding 4). Each scenario has a watcher (`watch.sh`, a unit |
| + beside its suite run) that settles the step the moment its `HOSTED-CHECKS-END` line appears, with |
| + `--ended-at` set to the line's `ended_at` (kit K10, headless `4efc4956`), so the 10 minutes count |
| + from the step's real end. 6.2 states the clock-skew limit between the instance and docs-t1. |
| +5. **Timeout paths** (finding 5). An `unreadable` poll now runs `ops safe-stop` (bounded recovery, |
| + in the background); `ops unit wait` runs only for `done` or `over`, and acts at once on both. |
| + Image deletion is one block per image (`8.4.1`, `8.4.2`), each with one `.retry1` on exit 1 only; |
| + every attempt is budgeted in 8.0. |
| +6. **Missing progress markers exited the block** (finding 6). Every marker read is `pline`, which |
| + prints nothing for an absent line; each absence goes to a FINDING. `scenario_end` and the drill end |
| + blocks are gone: the watcher handles each end. |
| +10. **The strike window** (finding 10). The watcher takes its run id from the new run's |
| + `HOSTED-SUITE-START` (an id the ledger has not seen, naming this scenario and mode) and reads only |
| + lines with `run=<id>`, so 7.1's old lines cannot end 7.2. 7.2 uploads the empty set before the |
| + window (nothing changes until a reload). The deadline is checked immediately before the |
| + mutation, with 60 seconds kept for it, and after it the mutation's own time (the journal's |
| + `REBOOT` line, the reload's answer) is compared with `strike_before`: later is "missed window", |
| + not judged. |
| +13. **`8.6.retry1` after a partial config destroy** (finding 13). `bucket empty` and `bucket delete` |
| + take a recorded bucket that a direct read shows absent as done (kit K11), so the retry goes on to |
| + the destroy; another owner still stops (99). |
| + |
| +Findings 3, 7, 8, 9, 11 and 12 were addressed in revision 2 and are unchanged. |
| + |
| ## Revision 2: each Astra finding and its fix |
| 1. **Safe stop left spend unbounded** (R1). After any safe stop, section 8 runs at once, |
| @@ -100,7 +140,7 @@ checks (pass, fail, new module), each settled before the next, and two Task 30 d |
| 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); |
| +**Hard stops** (exit 99, then section S, whose recovery starts section 8 unattended from 2.2b on): 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 |
| @@ -112,20 +152,22 @@ 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 |
| +`<id>.retry1` of a replayable unit or teardown step, on exit 1; one repeat of the fence and settle |
| +inside 8.3 if unfence refuses; buckets emptied by their fixed names, resumably; `ops safe-stop` run |
| +again after its bound; section 8 after any safe stop but a guard failure, unattended through the |
| +continuation armed at 2.2b (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.33**. Self-stop **$40**; ceiling **$50**. |
| -After a safe stop, teardown runs at once and adds at most about **$0.33** of host time. |
| +**$26.68** to plan, with a proven worst case of **$32.66**. Self-stop **$40**; ceiling **$50**. |
| +After a safe stop the armed teardown runs unattended: the hosts are gone within about 6 hours of |
| +the trigger, at most about **$0.33** more. |
| **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, and section 8 follows at once. |
| +signing or alert bound, the watchdog runs section S, and the armed continuation runs section 8. |
| ## Prerequisites (before the GO; no AWS) |
| @@ -185,40 +227,48 @@ Staging is fixed: app `equipo-staging`, account `bds`, console `https://console. |
| `<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` |
| +- **Short blocks** run as `ops block <id> --stop 40 -- bash "$P/blocks/<id>.sh"` (section 8's |
| + steps run inside `teardown.sh` as `ops block <id> --teardown -- bash "$P/teardown.sh" step <id>`), 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. |
| + 30 seconds and prints one word: `running` (call again), `done <result> <status>`, `over` (the bound |
| + has passed) or `unreadable` (three failed reads in a row). On `done` or `over` the agent runs |
| + `ops unit wait <id> --max <bound>` in the background with a 45-minute timeout: for a unit done with |
| + status 0 it returns at once; for a failed unit, or one past its bound (which it stops at once), it |
| + asks for recovery and waits for it (up to 35 minutes 45 seconds). It never waits on a running unit. |
| + On `unreadable` the agent runs `ops safe-stop` in the background (40 minutes) directly: a unit whose |
| + state cannot be read is treated as a stop. Unit bounds: 2.3 30m, 2.4 25m, 2.5 25m, 3.3 115m, 4.1 |
| + 45m, 4.2 25m, 5.1 25m, 5.2 40m, the scenario watchers `6.2.pass`, `6.2.fail`, `6.2.newmod` 105m, |
| + `7.1` 135m, `7.2` 110m, and section 8 by hand (`8`) 1380m. Short blocks with longer bounds: 4.3 25m; |
| + 1.2 runs outside `ops block` with a 50-minute timeout. OpenTofu has no time bound of its own; the |
| + unit's bound is its limit. |
| - **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`. |
| + end 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. Not replayable, because they create, strike or tear down: 2.5, 3.3, |
| + 5.2, the watchers, `8`; their expected failures are handled inside. Section 8 retries its own steps |
| + inside `teardown.sh` (8.0). A unit that ended with any other status 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. 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. |
| + step-down (two images) expect "finished with problems" (two settles can outrun its 30 minutes). |
| + From 2.2b on, the recovery itself starts the armed continuation, `$P/teardown.sh`, unless a guard |
| + failure came first (kit K9); the agent then polls it (`upoll teardown 1380`) and never starts |
| + section 8 beside it. Before 2.2b nothing is armed and the agent runs section 8 by hand. |
| +- **Section 8 by hand.** When the drill reaches section 8 with no stop, or a stop came before 2.2b: |
| + `ops continuation disarm` (from 2.2b on), then `ops unit start 8 -- bash "$P/teardown.sh"`, polled |
| + with `upoll 8 1380`. If the journal shows `CONTINUATION started`, the continuation is running it |
| + already: poll `ops unit status teardown` instead. |
| - **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.** |
| + and watcher from 2.4 to 7.4 starts `if skipped; then exit 0; fi`, but for 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`, |
| @@ -261,6 +311,10 @@ git -C "$W" grep -q 'ProtocolHostedRunners *= *Protocol40' "$PIN" -- internal/wi |
| 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 '"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; } |
| +git -C "$W" grep -q '"continuation arm"' "$PIN" -- internal/hostedops/ops.go || { echo "ABORT: $PIN has no teardown continuation (kit dc868b1c)"; exit 1; } |
| +git -C "$W" grep -q 'HOSTED-CHECKS-END' "$PIN" -- internal/headless || { echo "ABORT: $PIN has no checks-end line (headless 4efc4956)"; exit 1; } |
| +CRED_EXP=$(env -i HOME="$HOME" PATH="$PATH" aws configure export-credentials --profile kass --format process | jq -er '.Expiration // "none"') || { echo "ABORT: the kass credential_process does not work under env -i with HOME and PATH"; exit 1; } |
| +echo "kass credentials expire: $CRED_EXP" |
| [ "$(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 |
| @@ -271,6 +325,7 @@ case "$P" in *[!A-Za-z0-9/._-]*) echo "ABORT: the scratch path has characters a |
| RUN=$(date -u +%m%d)-$(head -c3 /dev/urandom | od -An -tx1 | tr -d ' \n') |
| git -C "$W" worktree add --detach "$P/repo" "$PIN" |
| mkdir -m 700 "$P/keys" "$P/bin" "$P/blocks" |
| +printf '%s\n' "$CRED_EXP" > "$P/credential-expiry" |
| for c in equipo-hosted-ops equipo-hosted-controller equipo-hosted-image equipo-hosted-certify; do |
| (cd "$P/repo" && CGO_ENABLED=0 nice -n 19 go build -o "$P/bin/$c" "./cmd/$c"); done |
| (cd "$P/repo" && CGO_ENABLED=0 nice -n 19 go test ./internal/hostedops/... ./cmd/equipo-hosted-ops ./cmd/equipo-hosted-image ./cmd/equipo-hosted-certify -count=1) |
| @@ -302,12 +357,12 @@ status_live() { local end=$(( $(date +%s) + 900 )); while [ "$(date +%s)" -lt "$ |
| 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"; } |
| +pline() { grep "^$1 run=$2 " "$PROG" 2>/dev/null | tail -n 1 || true; } |
| +field() { sed -n "s/.* $1=\([^ ]*\).*/\1/p" <<<"$2"; } |
| +result_field() { sed -n 's/.* result=//p' <<<"$1"; } |
| +jtime() { awk -F'\t' -v v="$1" 'index($2, v " ") == 1 {t = $1} END {print t}' "$P/journal.tsv"; } |
| +settle_step() { "${OPSB[@]}" vms settle --step "$1" ${2:+--ended-at "$2"} --image "$3" --max 10m; } |
| +bg_reboot() { "${OPSB[@]}" controller reboot --enabled 1 --max 10m > "$P/reboot.out" 2>&1 & } |
| EOF |
| "$P/bin/equipo-hosted-ops" -dir "$P" -run "$RUN" ledger init |
| "$P/bin/equipo-hosted-ops" -dir "$P" -run "$RUN" unit probe |
| @@ -315,7 +370,8 @@ echo "P=$P RUN=$RUN" |
| ``` |
| - 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, |
| + `carlos` and the `kass` credential process answer under `env -i` (the credentials' `Expiration`, |
| + or `none`, is printed and kept for 1.1); 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. |
| @@ -369,6 +425,8 @@ set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| ops guard |
| ops inventory |
| ops quota |
| +ops ledger note credential-expiry "$(cat "$P/credential-expiry")" |
| +if [ "$(cat "$P/credential-expiry")" != none ]; then ops finding "kass credentials carry an Expiration, $(cat "$P/credential-expiry"): an unattended continuation after it fails its guard (2.2b)"; fi |
| ops estimate --stop 40 |
| ``` |
| @@ -443,6 +501,33 @@ 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. |
| +### 2.2b Section 8 armed (agent's shell, sandbox off; before the first human wait) |
| + |
| +The agent writes section 8's script, 8.0, exactly as printed (only `<P printed by 0.1>` filled in), |
| +to `$P/teardown.sh`, then runs this block in its shell: |
| + |
| +```sh |
| +set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| +chmod 600 "$P/teardown.sh" |
| +bash -n "$P/teardown.sh" |
| +ops continuation arm "$P/teardown.sh" --max 23h |
| +``` |
| + |
| +From here on, any recovery (a failed block, a failed unit wait, an expired watchdog, `ops safe-stop`) |
| +ends by starting `$P/teardown.sh` unattended, as `hdev-<RUN>-teardown`, unless a guard refusal was |
| +journalled after the arm, the recovery's own credential check failed, the file changed, it was |
| +disarmed, or it already ran (kit K9). 8.0 gives its bound and the spend it implies. |
| + |
| +**Credentials during long waits.** The continuation's first guard runs the `kass` profile's |
| +`credential_process` (in `~/.aws/config`) through `aws configure export-credentials`, with the unit's |
| +environment (`HOME`, `PATH`). The caller is the IAM user `remote-agent` (Task 17b), whose access keys |
| +do not lapse with a session. 0.1 records whether the exported credentials carry an `Expiration` |
| +(`$P/credential-expiry`, noted at 1.1). **Known limit:** if they do and it falls within the drill |
| +(the signing wait alone is 12 hours), or if the credential process needs something that lapses (an |
| +unlocked vault), a trigger after that point fails the continuation's guard. The continuation does |
| +not start (`CONTINUATION not run`), and the run waits for Paul with the controller stopped and the |
| +rest standing, about $1.15 a day. 0.1 shows only that the process works at GO. |
| + |
| ### 2.3 Network (unit, bound 30m) |
| ```sh |
| @@ -701,12 +786,16 @@ 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=$? |
| +rc=$? |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then skip_to_teardown "proxy A's controller.json was not placed"; exit 0; fi |
| +set +e |
| ops object put --bucket "$CONFIG_BUCKET" --key proxy/b/controller.json --file "$P/proxy-controller.json" |
| -b=$? |
| +rc=$? |
| set -e |
| -ordinary "$a"; ordinary "$b" |
| -if [ "$a$b" != 00 ]; then skip_to_teardown "the proxies' controller.json was not placed"; fi |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then skip_to_teardown "proxy B's controller.json was not placed"; exit 0; fi |
| ``` |
| The wait is `ops wait object --bucket equipo-hosted-dev-config-640012953448 --key pins/controller.spki --max 15m`: |
| @@ -745,8 +834,18 @@ ops estimate --stop 40 |
| CONFIG_BUCKET=equipo-hosted-dev-config-640012953448 |
| jq -n --arg d "$IMAGE_DIGEST" --arg i "$(jq -er .ImageArn "$P/image.json")" --arg v "$(jq -er .VersionArn "$P/image.json")" '[{digest: $d, image_arn: $i, version_arn: $v}]' > "$P/certification-images.json" |
| printf 'EQUIPO_HOSTED_ENABLED=1\n' > "$P/controller.env" |
| +set +e |
| ops object put --bucket "$CONFIG_BUCKET" --key controller/certification-images.json --file "$P/certification-images.json" |
| +rc=$? |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then skip_to_teardown "the certification images file was not uploaded"; exit 0; fi |
| +set +e |
| ops object put --bucket "$CONFIG_BUCKET" --key controller/env --file "$P/controller.env" |
| +rc=$? |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then skip_to_teardown "controller/env was not uploaded"; exit 0; fi |
| start=$(date +%s) |
| set +e |
| ops controller reboot --enabled 1 --max 10m |
| @@ -760,7 +859,7 @@ ops assert enabled |
| `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 |
| +about 14 minutes; with the two puts, each classified before the next step, about 22). 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. |
| @@ -870,14 +969,14 @@ about $0.055 an hour, $0.66 for the full 12 hours. No VM runs (5.2 settled its s |
| 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). |
| +the armed continuation runs section 8 (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; section 8 runs now"; exit 0; fi |
| +if grep -q 'WAIT-EXPIRED cert-signed' "$P/journal.tsv"; then echo "the signing wait expired; section S ran and started the armed continuation"; 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" |
| @@ -954,202 +1053,285 @@ if [ "$rc" = 1 ]; then skip_to_teardown "the checks VMs were not admitted"; exit |
| Six: three steps, each with one retry. Codes: 1 skips, 99 goes to recovery. |
| -**For each scenario in turn, `hosted-pass`, then `hosted-fail`, then `hosted-new-module`:** |
| - |
| -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): |
| +**The scenario watcher, `watch.sh`.** The agent writes it once, exactly as printed, to |
| +`$P/blocks/watch.sh`. It runs as a unit beside each suite run, with the scenario and the mode as its |
| +arguments, and does everything docs-t1 owes that scenario: |
| + |
| +1. **Its run** (finding 10). It waits up to 10 minutes for a `HOSTED-SUITE-START` line whose run id |
| + the ledger has not seen (`NOTE suite-run`) and which names this scenario and mode, notes it, and |
| + from then on reads only lines carrying `run=<id>`. The progress file is rewritten at each suite |
| + start, and no other run's line can be taken for this one. |
| +2. **The settle at the step's end** (finding 4). The moment `HOSTED-CHECKS-END run=<id>` appears, it |
| + runs `ops vms settle --step hosted-pass --ended-at 2026-12-02T10:05:00Z --image "$IMAGE_ARN" --max 10m` |
| + (with the line's `ended_at`; the step is the scenario's: `hosted-pass`, `hosted-fail`, `hosted-new-module`, `drill-reboot`, |
| + `drill-withdraw`). `ended_at` is the instance's own end of the checks step (its `finished_at`, |
| + capped at when the scenario saw it), never later than the real end, and the 10 minutes count from |
| + it. Codes: 0 goes on; 99 (a VM of the image live 10 minutes after the step ended) stops; 1 |
| + (`--ended-at` refused: in the future, or before the image's last settle) is a FINDING, and the |
| + step is settled from now instead. **Clock-skew limit:** `ended_at` is the instance's clock, the |
| + bound is docs-t1's. With the instance's clock behind, the settle starts later on docs-t1's clock by |
| + the skew, and a skew larger than what is left of the 10 minutes is an immediate stop with no scan |
| + (kit concern 5); with it ahead, `--ended-at` reads as the future, is refused, and the bound counts |
| + from docs-t1's now, up to the skew late. Both hosts keep NTP time, so the skew is seconds. |
| +3. **The scans.** Every 5 minutes, `ops vms scan --image "$IMAGE_ARN" --max 2m`: 99 stops (a live VM |
| + neither the controller's nor a recorded launch, for 2 minutes); 1 is a FINDING. |
| +4. **The strike**, in a drill mode only (section 7). |
| +5. **The end.** At `HOSTED-SUITE run=<id>` (or 60 minutes), it reads `HOSTED-CHECKS-END` once more |
| + (it may have landed in the same moment) and settles from its `ended_at`, or from now if it never |
| + came (a FINDING), finishes the drill's own work (7.1's reboot and status, 7.2's |
| + restore), notes the suite line, and compares `HOSTED-END run=<id>`'s `result=` with the expected |
| + `HOSTED-RESULT` line (`ops fact`). A missing `HOSTED-SUITE-START`, `HOSTED-CHECKS-END`, |
| + `HOSTED-SUITE` or `HOSTED-END` line, or a status other than `ok`, is a FINDING (finding 6), and the |
| + next scenario runs. |
| + |
| +Its bound: 10 minutes for its run and 60 for the suite, at whose deadline one settle (up to about 13 |
| +minutes from the step's end) or one scan (about 4) may still be running; then a fallback settle (13) |
| +and the end (2): 102, so **105 minutes**. 7.1 adds the reboot's status (`status_live`, 16.5, and |
| +`ops assert status`, 6) and its wait (up to 14, overlapping the suite): **135**. 7.2 adds the restore |
| +(a put and a reload, 5): **110**. |
| ```sh |
| set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| +NAME=$1; MODE=$2 |
| if skipped; then exit 0; fi |
| +if [ "$MODE" != plain ] && [ -e "$P/drills-skipped" ]; then exit 0; fi |
| IMAGE_ARN=$(jq -er .ImageArn "$P/image.json") |
| -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' |
| -``` |
| - |
| -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 --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' |
| -``` |
| - |
| -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 `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 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 |
| -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 |
| +CTL="https://$(tfo services controller_public_ip)"; PIN_HEX=$(cat "$P/controller.pin") |
| +case "$NAME/$MODE" in |
| + hosted-pass/plain) STEP=hosted-pass; WANT='state=done checks=passed reason=- shown=- sandbox=bubblewrap certified=yes base_checks=trusted jobs=1';; |
| + hosted-fail/plain) STEP=hosted-fail; WANT='state=done checks=failed reason=- shown=- sandbox=bubblewrap certified=yes base_checks=none jobs=1';; |
| + hosted-new-module/plain) STEP=hosted-new-module; WANT='state=done checks=cannot_run reason=deps_new_module shown=needs_network sandbox=none certified=no base_checks=none jobs=1';; |
| + hosted-slow/controller-reboot) STEP=drill-reboot; WANT='state=done checks=passed reason=- shown=- sandbox=bubblewrap certified=yes base_checks=trusted jobs=1';; |
| + hosted-slow/withdraw-cert) STEP=drill-withdraw; WANT='state=done checks=cannot_run reason=hosted_unavailable shown=hosted_unavailable sandbox=none certified=no base_checks=none jobs=2';; |
| + *) echo "unknown scenario $NAME/$MODE"; exit 1;; |
| +esac |
| +settle_now() { |
| + local rc |
| + set +e |
| + settle_step "$STEP" "$1" "$IMAGE_ARN" |
| + rc=$? |
| + set -e |
| + ordinary "$rc" |
| + if [ "$rc" = 1 ] && [ -n "$1" ]; then |
| + ops finding "$STEP: settle refused --ended-at $1 (clock skew, or an end before the image's last settle), settling from now" |
| + settle_now "" |
| + elif [ "$rc" = 1 ]; then |
| + ops finding "$STEP: the settle from now was refused (exit 1)" |
| + fi |
| +} |
| +prepare() { |
| + local c o |
| + prepared=yes |
| + set +e |
| + cert bundle -cert-keys "$P/cert-keys.json" -empty -out "$P/no-certificates.json" |
| + c=$? |
| + set -e |
| + if [ "$c" != 0 ]; then ops finding "$STEP: missed window, the empty set was not written (cert bundle exit $c)"; struck=missed; return 0; fi |
| + set +e |
| + ops object put --bucket equipo-hosted-dev-config-640012953448 --key controller/certificates.json --file "$P/no-certificates.json" |
| + o=$? |
| + set -e |
| + ordinary "$o" |
| + if [ "$o" = 1 ]; then ops finding "$STEP: missed window, the empty set was not uploaded"; struck=missed; return 0; fi |
| + uploaded=yes |
| +} |
| +put_back() { |
| + local o r |
| + set +e |
| + ops object put --bucket equipo-hosted-dev-config-640012953448 --key controller/certificates.json --file "$P/certificates.json" |
| + o=$? |
| + set -e |
| + ordinary "$o" |
| + if [ "$o" = 1 ]; then ops finding "$STEP: the real certificate set was not put back (exit 1), no reload"; return 0; fi |
| + if [ "$1" = reload ]; then |
| + 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" |
| + r=$? |
| + set -e |
| + if [ "$r" != 0 ]; then ops finding "$STEP: the reload after restoring failed (cert exit $r)"; fi |
| + fi |
| +} |
| +strike() { |
| + local B after VM SCAN LIVE a rc ok r t ACK |
| + B=$(pline HOSTED-BARRIER "$RUNID") |
| + if [ -z "$B" ]; then return 0; fi |
| + after=$(date -d "$(field strike_after "$B")" +%s) |
| + before=$(date -d "$(field strike_before "$B")" +%s) |
| + if [ "$MODE" = withdraw-cert ] && [ "$prepared" = no ]; then prepare; fi |
| + if [ "$struck" != no ] || [ "$(date +%s)" -lt "$after" ]; then return 0; fi |
| + struck=missed |
| + VM=$(field vm "$B") |
| + 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 ]; then ops finding "$STEP: missed window, vm=$VM live=${LIVE:-none}"; return 0; fi |
| + if [ $(( $(date +%s) + 60 )) -gt "$before" ]; then ops finding "$STEP: missed window, too little time left before $(field strike_before "$B")"; return 0; fi |
| + case "$MODE" in |
| + controller-reboot) |
| + ops ledger note strike "controller-reboot started at $(date -u +%FT%TZ) vm=$LIVE" |
| + bg_reboot |
| + RB=$! |
| + struck=pending;; |
| + withdraw-cert) |
| + reloaded=yes |
| + set +e |
| + 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 |
| + t=$(date +%s) |
| + if [ "$r" = 0 ] && jq -e '.certificates == 0' <<<"$ACK" > /dev/null 2>&1 && [ "$t" -le "$before" ]; then |
| + ops ledger note strike "withdraw-cert acknowledged at $(date -u +%FT%TZ) vm=$LIVE" |
| + struck=yes |
| + else |
| + ops finding "$STEP: missed window, the withdrawal was not acknowledged in time (reload exit $r, at $t, strike_before $before)" |
| + fi;; |
| + esac |
| +} |
| +RUNID= |
| +end=$(( $(date +%s) + 600 )) |
| +while [ -z "$RUNID" ]; do |
| + L=$(grep '^HOSTED-SUITE-START ' "$PROG" 2>/dev/null | tail -n 1 || true) |
| + R=$(field run "$L") |
| + if [ -n "$R" ] && ! grep -q "NOTE suite-run $R " "$P/journal.tsv" && [ "$(field scenarios "$L")" = "$NAME" ] && [ "$(field mode "$L")" = "$MODE" ]; then RUNID=$R; fi |
| + if [ -z "$RUNID" ] && [ "$(date +%s)" -ge "$end" ]; then ops finding "$STEP: no new suite run for $NAME $MODE started within 10 minutes"; exit 0; fi |
| + if [ -z "$RUNID" ]; then sleep 10; fi |
| +done |
| +ops ledger note suite-run "$RUNID $NAME $MODE" |
| +settled=no; struck=no; prepared=no; uploaded=no; reloaded=no; RB=; before=0 |
| +next_scan=$(( $(date +%s) + 300 )); end=$(( $(date +%s) + 3600 )) |
| +while :; do |
| + CE=$(pline HOSTED-CHECKS-END "$RUNID") |
| + if [ "$settled" = no ] && [ -n "$CE" ]; then settle_now "$(field ended_at "$CE")"; settled=yes; fi |
| + if [ -n "$(pline HOSTED-SUITE "$RUNID")" ]; then break; fi |
| + if [ "$MODE" != plain ] && [ "$settled" = no ]; then strike; fi |
| + if [ "$(date +%s)" -ge "$next_scan" ]; then |
| + set +e |
| + ops vms scan --image "$IMAGE_ARN" --max 2m |
| + rc=$? |
| + set -e |
| + ordinary "$rc" |
| + if [ "$rc" = 1 ]; then ops finding "$STEP: a scan did not read (exit 1)"; fi |
| + next_scan=$(( $(date +%s) + 300 )) |
| + fi |
| + if [ "$(date +%s)" -ge "$end" ]; then ops finding "$STEP: no HOSTED-SUITE line for run $RUNID within 60 minutes"; break; 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 |
| +CE=$(pline HOSTED-CHECKS-END "$RUNID") |
| +if [ "$settled" = no ] && [ -n "$CE" ]; then settle_now "$(field ended_at "$CE")"; settled=yes; fi |
| +if [ "$settled" = no ]; then ops finding "$STEP: no HOSTED-CHECKS-END line for run $RUNID, settling from now"; settle_now ""; fi |
| +if [ -n "$RB" ]; then |
| + set +e |
| + wait "$RB" |
| + rb=$? |
| + set -e |
| + cat "$P/reboot.out" |
| + if [ "$rb" != 0 ]; then echo "the controller reboot failed (exit $rb) with a VM running"; exit 99; fi |
| + RT=$(jtime REBOOT) |
| + if [ -n "$RT" ] && [ "$(date -d "$RT" +%s)" -le "$before" ]; then struck=yes; else ops finding "$STEP: missed window (late), the reboot was journalled at ${RT:-never}, after strike_before"; struck=late; fi |
| + if ! status_live; then echo "the controller and proxies were not live within 15 minutes of the reboot"; exit 99; fi |
| + ops assert status |
| +fi |
| +if [ "$uploaded" = yes ] && [ "$reloaded" = yes ]; then put_back reload; elif [ "$uploaded" = yes ]; then put_back none; fi |
| +SU=$(pline HOSTED-SUITE "$RUNID"); END=$(pline HOSTED-END "$RUNID") |
| +ops ledger note suite "${SU:-no HOSTED-SUITE line for run $RUNID}" |
| +if [ -z "$END" ]; then ops finding "$STEP: no HOSTED-END line for run $RUNID"; exit 0; fi |
| +if [ "$(field status "$END")" != ok ]; then ops finding "$STEP: the scenario ended $(field status "$END")"; exit 0; fi |
| +GOT=$(result_field "$END") |
| +if [ "$MODE" != plain ] && [ "$struck" != yes ]; then ops finding "$STEP: not judged, no strike inside the window: $GOT"; exit 0; fi |
| +if [ "$MODE" = controller-reboot ] && [ "${GOT##*jobs=}" = 2 ]; then WANT=${WANT%jobs=1}jobs=2; fi |
| +if [ "$MODE" = withdraw-cert ]; then case "$GOT" in *certified=yes*|*checks=passed*) ops ledger note not-passed "certificate withdrawn: the result was kept: $GOT";; esac; fi |
| +ops fact "$STEP" "$GOT" "$WANT" |
| ``` |
| -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:** |
| +**For each scenario in turn, `hosted-pass`, then `hosted-fail`, then `hosted-new-module`:** |
| -```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" |
| -``` |
| +1. start its suite in the agent's shell (sandbox off, background, 60 minutes): |
| + `bash -c '. "<P>/run.env"; suite hosted-pass'` (then `hosted-fail`, `hosted-new-module`); |
| +2. start its watcher: `ops unit start 6.2.pass -- bash "$P/blocks/watch.sh" hosted-pass plain` |
| + (then `ops unit start 6.2.fail -- bash "$P/blocks/watch.sh" hosted-fail plain` and |
| + `ops unit start 6.2.newmod -- bash "$P/blocks/watch.sh" hosted-new-module plain`), polled with |
| + `upoll` (105 minutes); |
| +3. start the next scenario only when the watcher's `ops unit wait` has returned 0. |
| + |
| +Expected `HOSTED-RESULT` lines (the headless report): `hosted-pass` |
| +`state=done checks=passed reason=- shown=- sandbox=bubblewrap certified=yes base_checks=trusted jobs=1`; |
| +`hosted-fail` the same with `checks=failed` and `base_checks=none`; `hosted-new-module` |
| +`state=done checks=cannot_run reason=deps_new_module shown=needs_network sandbox=none certified=no base_checks=none jobs=1`. |
| +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`. |
| -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. Drills on real VMs, and the alert email |
| -### 7.2 The certificate withdrawn mid-step (unit, bound 40m; not replayable) |
| +Each drill runs `hosted-slow` in its own mode, watched by `watch.sh` in that mode, which strikes only |
| +inside the scenario's checks-started window (R6, finding 10). Before the drills, block 7.0: |
| ```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") |
| -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 |
| -ops vms adopt |
| -a=$? |
| -SCAN=$(ops vms scan --image "$IMAGE_ARN" --max 2m | tail -n 1) |
| +ops reserve vm 4 |
| 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 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 |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then ops finding "the drill VMs were not admitted, the drills are skipped"; touch "$P/drills-skipped"; fi |
| ``` |
| -The withdrawal counts only when `cert reload` answers `"certificates": 0`. **7.2b (block), when the |
| -suite has ended:** restore the certificate, settle, judge. |
| +Four: two drills, each with one retry. Codes: 1 skips both drills (7.4 still runs), 99 goes to |
| +recovery. Then, for 7.1 and 7.2 in turn, unless `$P/drills-skipped` exists: |
| -```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") |
| -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" |
| -r=$? |
| -set -e |
| -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' |
| -``` |
| - |
| -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). |
| +1. the suite in the agent's shell (background, 60 minutes): |
| + `bash -c '. "<P>/run.env"; suite hosted-slow mode=controller-reboot'` (7.1) or |
| + `bash -c '. "<P>/run.env"; suite hosted-slow mode=withdraw-cert'` (7.2); |
| +2. the watcher: `ops unit start 7.1 -- bash "$P/blocks/watch.sh" hosted-slow controller-reboot` |
| + (135 minutes) or `ops unit start 7.2 -- bash "$P/blocks/watch.sh" hosted-slow withdraw-cert` |
| + (110 minutes), polled with `upoll`. |
| + |
| +**The strike, in the watcher.** On `HOSTED-BARRIER run=<id>`: |
| +- 7.2 prepares at once: it writes the empty set (`cert bundle` with `-empty`) and uploads it to |
| + `controller/certificates.json`, classifying each before the next (a bundle failure, or a put's 1: |
| + FINDING "missed window", nothing struck; a put's 99 stops). The upload changes nothing until the |
| + controller reloads. |
| +- From `strike_after`, it reads the VM: with the barrier's `vm=` known, that VM must be live in a |
| + fresh `ops vms 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: FINDING "missed window". |
| +- Immediately before the mutation it checks the deadline, keeping 60 seconds for the call: now plus |
| + 60 seconds must not pass `strike_before`, or "missed window". |
| +- 7.1's mutation is `ops controller reboot --enabled 1 --max 10m`, started in the background inside |
| + the watcher (so the step's settle is not held up behind it); its time is the journal's `REBOOT` |
| + line, written just before the reboot call, after the guard and the policy read. 7.2's mutation is |
| + `cert reload`; its time is when the reload answered `"certificates": 0`. |
| +- After the mutation, that time is compared with `strike_before`: later is "missed window (late)", |
| + and the drill is not judged. |
| +- If 7.2 uploaded the empty set but never reloaded, it puts the real set back with no reload (the |
| + controller never read the empty one). |
| + |
| +### 7.1 The controller away mid-step (unit `7.1`, bound 135m; not replayable) |
| + |
| +At the end the watcher waits for the reboot: any failure, or a stack not live 15 minutes after it |
| +(`status_live`), stops (99: a VM runs); then `ops assert status`. Expected, as |
| +`TestChainKillControllerMidStep` allows: |
| +`state=done checks=passed reason=- shown=- sandbox=bubblewrap certified=yes base_checks=trusted jobs=1`, |
| +or the same with `jobs=2` (the first job failed `hosted_unavailable` and one retry passed); the |
| +watcher takes the `jobs=2` line when the result says `jobs=2`. 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 (unit `7.2`, bound 110m; not replayable) |
| + |
| +At the end the watcher puts the real set back, `$P/certificates.json`, classifies the put at once |
| +(1: FINDING and no reload; 99: stop), then reloads (a failure: FINDING). Expected |
| +(`TestChainCertWithdrawnMidStep`, the headless addendum): |
| +`state=done checks=cannot_run reason=hosted_unavailable shown=hosted_unavailable sandbox=none certified=no base_checks=none jobs=2`. |
| +The job count is unconfirmed, so a difference only there is a FINDING; a kept result |
| +(`certified=yes` or `checks=passed`) after a strike inside the window is NOT PASSED. Without such a |
| +strike the result is not judged. |
| ### 7.3 Not run with this kit (coordinator's ruling) |
| @@ -1177,192 +1359,227 @@ ops wait-human alert-received --max 2h --background |
| ``` |
| 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. |
| +`ops wait-human alert-received --done`, then section 8 by hand. Past 2 hours the watchdog runs |
| +section S and the armed continuation runs section 8; the record shows the alert not received. |
| ## 8. Teardown and verification |
| -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) |
| - |
| -```sh |
| -set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| -ops unit stop --all |
| -S=(--app equipo-staging --account bds --console https://console.carloku.com) |
| -set +e |
| -carlos env unset "${S[@]}" --no-prompt EQUIPO_HOSTED_RUNNERS |
| -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 |
| -if [ "$rc" != 0 ]; then ops finding "staging hosted work off: carlos exit $rc"; fi |
| -``` |
| - |
| -### 8.2 Fence and settle (unit, bound 100m) |
| +Section 8 is one script, `$P/teardown.sh` (8.0), written and armed at 2.2b. It runs: |
| +- **unattended**, as the armed continuation `hdev-<RUN>-teardown`, which the recovery unit starts |
| + after any safe stop but a guard failure (or a failed credential check). If the agent is attending |
| + it polls it (`upoll teardown 1380`) and never starts section 8 beside it; |
| +- **by hand**, when the drill reaches here with no stop (or a stop came before 2.2b): |
| + `ops continuation disarm`, then `ops unit start 8 -- bash "$P/teardown.sh"`, polled with |
| + `upoll 8 1380`. |
| + |
| +Inside, every step is `ops block <id> --teardown -- bash "$P/teardown.sh" step <id>` (the guard and the ledger's ownership run, the spend |
| +gate does not, and any create refuses with 99). Order (R5): staging off, fence and settle, terminate, |
| +unfence and the services destroy, then the images, the connector, the buckets and the other roots, |
| +then verification. A step that may be retried runs `--optional` first; on exit 1 it runs once more as |
| +`<id>.retry1`, required; 99 always stops. A required step that fails asks for recovery, which spares |
| +the continuation and does not start it again; the block exits 99, the script ends (`set -e`), and |
| +the run reports what still exists and its daily cost (`ops report --stopped`) and asks Paul. That |
| +spend is not bounded until he answers. |
| + |
| +### 8.0 The script, and its bound |
| + |
| +| Step | One attempt (from the kit's bounds) | Attempts | Budget | |
| +| --- | --- | --- | --- | |
| +| `ops unit stop --all` and 8.1, staging off: five `carlos` calls, the guard, up to four units stopped at 90 s each | 20 m | 1 | 20 m | |
| +| 8.2: `ops fence` (guard 2, attach and read 2, host stop 10), `vms reconcile` (5), each image's settle with its repeat (15 + 10 + 15 and a guard: 41; two images 82), `ledger reconcile` (5) | 108 m, so 110 | 1 (fence and settle have no ordinary class; reconcile's 1 is a FINDING inside) | 110 m | |
| +| 8.3: `controller terminate` (12), `unfence` (5), its one repeat (fence 14, settles 82, unfence 5), the services destroy (30), `tf reconcile` (10), the destroy again (30) | 188 m, so 190 | 1 (its repeats are inside) | 190 m | |
| +| 8.4.1, 8.4.2: one image delete each (`-timeout 15m`, plus guard, STS and reads: 20) | 20 m | 2 each (`.retry1` on exit 1) | 80 m | |
| +| 8.5: `connector delete` (its 120-minute budget, then reads) | 130 m | 2 (`8.5.retry1` on exit 1) | 260 m | |
| +| 8.6: three bucket empties (7 each), the config destroy, `tf reconcile` and destroy again (70), the network the same (70) | 161 m, so 165 | 2 (`8.6.retry1` on exit 1; buckets resumable) | 330 m | |
| +| 8.7: `verify-gone` (about 90 direct reads at up to 60 s: 90), once more on exit 1 (90), the state bucket's empty and delete (10), `verify-gone --all` (90), `estimate` (5) | 285 m | 1 | 285 m | |
| +| One recovery, when a required step fails | 36 m | 1 | 36 m | |
| +| **Sum** | | | **1311 m = 21 h 51 min** | |
| + |
| +`--max 23h` (1380 minutes) leaves 69 minutes' margin, under the kit's 24-hour cap. From a trigger (a |
| +watchdog's deadline or a failed block), the continuation starts within about 31 minutes plus 90 |
| +seconds per running unit (at most four here: about 37 minutes) and runs at most 23 hours plus a |
| +5-minute stop: **about 23 h 42 min end to end**. The hosts are gone when 8.3 ends, at most |
| +37 + 20 + 110 + 190 = 357 minutes after the trigger: **6 host-hours, about $0.33**. Image storage is |
| +already charged at its one-week minimum; the buckets, the connector and the topic cost pennies. |
| ```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 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 Controller terminate, unfence, services destroy (unit, bound 200m) |
| - |
| -```sh |
| -set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| -ops controller terminate |
| -set +e |
| -ops unfence |
| -rc=$? |
| -set -e |
| -if [ "$rc" != 0 ]; then |
| - 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 |
| - done |
| - ops unfence |
| -fi |
| -if grep -q 'TF-APPLY services start' "$P/journal.tsv"; then |
| - set +e |
| - ops tf services destroy-dev-services |
| - rc=$? |
| - set -e |
| - 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: `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" |
| +if [ "${1:-}" = step ]; then |
| + case "$2" in |
| + 8.1) |
| + S=(--app equipo-staging --account bds --console https://console.carloku.com) |
| + set +e |
| + carlos env unset "${S[@]}" --no-prompt EQUIPO_HOSTED_RUNNERS |
| + 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 |
| + if [ "$rc" != 0 ]; then ops finding "staging hosted work off: carlos exit $rc"; fi |
| + ;; |
| + 8.2) |
| + 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 |
| + ;; |
| + 8.3) |
| + ops controller terminate |
| + set +e |
| + ops unfence |
| + rc=$? |
| + set -e |
| + if [ "$rc" != 0 ]; then |
| + 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 |
| + done |
| + ops unfence |
| + fi |
| + if grep -q 'TF-APPLY services start' "$P/journal.tsv"; then |
| + set +e |
| + ops tf services destroy-dev-services |
| + rc=$? |
| + set -e |
| + 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 |
| + ;; |
| + 8.4) |
| + IMAGE_ARN=$3 |
| + set +e |
| 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) |
| - |
| -```sh |
| -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. 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 70m) |
| - |
| -```sh |
| -set -euo pipefail; P='<P printed by 0.1>'; . "$P/run.env" |
| -if grep -q 'TF-APPLY config start' "$P/journal.tsv"; then |
| - ops bucket empty --name equipo-hosted-dev-config-640012953448 --expected-owner 640012953448 |
| - ops bucket empty --name equipo-hosted-dev-litestream-640012953448 --expected-owner 640012953448 |
| - ops bucket empty --name equipo-hosted-dev-image-inputs-640012953448 --expected-owner 640012953448 |
| + rc=$? |
| + set -e |
| + img_ordinary "$rc" |
| + if [ "$rc" != 0 ]; then exit 1; fi |
| + ;; |
| + 8.5) |
| + ops connector delete |
| + ;; |
| + 8.6) |
| + if grep -q 'TF-APPLY config start' "$P/journal.tsv"; then |
| + ops bucket empty --name equipo-hosted-dev-config-640012953448 --expected-owner 640012953448 |
| + ops bucket empty --name equipo-hosted-dev-litestream-640012953448 --expected-owner 640012953448 |
| + ops bucket empty --name equipo-hosted-dev-image-inputs-640012953448 --expected-owner 640012953448 |
| + set +e |
| + ops tf config destroy-dev-config |
| + rc=$? |
| + set -e |
| + 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 |
| + fi |
| + if grep -q 'TF-APPLY network start' "$P/journal.tsv"; then |
| + set +e |
| + ops tf network destroy-dev-network |
| + rc=$? |
| + set -e |
| + 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 |
| + ;; |
| + 8.7) |
| + set +e |
| + ops verify-gone |
| + rc=$? |
| + set -e |
| + ordinary "$rc" |
| + if [ "$rc" = 1 ]; then ops finding "verify-gone: the tag index did not read, reading once more"; ops verify-gone; 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 |
| + ;; |
| + *) echo "no step $2"; exit 1;; |
| + esac |
| + exit 0 |
| +fi |
| +ops unit stop --all |
| +ops block 8.1 --teardown -- bash "$P/teardown.sh" step 8.1 |
| +ops block 8.2 --teardown -- bash "$P/teardown.sh" step 8.2 |
| +ops block 8.3 --teardown -- bash "$P/teardown.sh" step 8.3 |
| +I1=$(images | sed -n 1p); I2=$(images | sed -n 2p) |
| +if [ -n "$I1" ]; then |
| set +e |
| - ops tf config destroy-dev-config |
| + ops block 8.4.1 --teardown --optional -- bash "$P/teardown.sh" step 8.4 "$I1" |
| rc=$? |
| set -e |
| 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 |
| + if [ "$rc" = 1 ]; then ops block 8.4.1.retry1 --teardown -- bash "$P/teardown.sh" step 8.4 "$I1"; fi |
| fi |
| -if grep -q 'TF-APPLY network start' "$P/journal.tsv"; then |
| +if [ -n "$I2" ]; then |
| set +e |
| - ops tf network destroy-dev-network |
| + ops block 8.4.2 --teardown --optional -- bash "$P/teardown.sh" step 8.4 "$I2" |
| rc=$? |
| set -e |
| 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 |
| + if [ "$rc" = 1 ]; then ops block 8.4.2.retry1 --teardown -- bash "$P/teardown.sh" step 8.4 "$I2"; fi |
| fi |
| -``` |
| - |
| -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 |
| +ops block 8.5 --teardown --optional -- bash "$P/teardown.sh" step 8.5 |
| +rc=$? |
| +set -e |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then ops block 8.5.retry1 --teardown -- bash "$P/teardown.sh" step 8.5; fi |
| +set +e |
| +ops block 8.6 --teardown --optional -- bash "$P/teardown.sh" step 8.6 |
| 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 |
| +ordinary "$rc" |
| +if [ "$rc" = 1 ]; then ops block 8.6.retry1 --teardown -- bash "$P/teardown.sh" step 8.6; fi |
| +ops block 8.7 --teardown -- bash "$P/teardown.sh" step 8.7 |
| +echo "section 8 done; 8.8 is the agent's" |
| ``` |
| -`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. |
| +**What each step does.** 8.1 turns hosted work off on staging (an unset of a variable never set is a |
| +FINDING; 1.2 showed what it does). 8.2's fence attaches `deny_launches` 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; a VM live past a bound stops. 8.3: `controller |
| +terminate` reads every controller host back `terminated`; `unfence` detaches `deny_launches` only |
| +with that proof and every image settled with its repeat after the last fence, and reads the detach |
| +back. Unfence has no ordinary class (99 only): its one pre-approved repeat is the one exception to |
| +"99 goes to recovery" (the coordinator's explicit exception), and a second refusal |
| +stops with the policy attached; the images still exist, so the repeat's settles can scan them. The |
| +services destroy: 1 is reconciled and destroyed once more, 99 (plan-check, the fence attached, an |
| +unresolved intent) stops. 8.4: `img delete` with `-ledger` deletes only a recorded image and takes |
| +one already gone as done, so each `.retry1` is safe; 4 stops. 8.5 is the connector's first real |
| +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 never deleted |
| +by hand; 1 (while the connector is still recorded) is retried as `8.5.retry1`, 99 (interfaces not |
| +proved gone after the delete) stops. 8.6 empties the buckets by their fixed names: a recorded bucket |
| +a direct read shows gone is done (`DELETED ... read-gone`, kit K11), so `8.6.retry1` after a partial |
| +config destroy goes on to the destroy (finding 13); another owner stops. 8.7: `verify-gone` reads |
| +every recorded resource directly and every tagged ARN of the run; one the ledger does not hold must |
| +be proved absent, or it stops (99). **If it stops on such a resource** (R9; a type with no direct |
| +read, or a root volume the provider tagged), everything the ledger holds is already torn down: the |
| +run reports the resource with `verify-gone`'s lines and asks Paul; the state bucket stays (pennies) |
| +until he answers. |
| ### 8.8 Records and docs-t1 (agent's shell) |
| +After `teardown.sh` has ended, by hand or as the continuation (then when the agent or Paul |
| +returns): |
| + |
| + |
| 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`; copy the suite's kept reports (named by each |
| `NOTE suite` line) next to it. |
| @@ -1385,15 +1602,18 @@ stays (pennies a month) until he answers. |
| ## S. Safe stop |
| -`ops safe-stop`, in the background (rules above). S.0 stops every journalled unit; S.1 runs |
| +`ops safe-stop`, in the background (rules above). S.0 stops every journalled unit but the recovery |
| +unit and the continuation; S.1 runs |
| `carlos env unset --app equipo-staging --account bds --console https://console.carloku.com --no-prompt EQUIPO_HOSTED_RUNNERS` |
| 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. **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). |
| +terminates the controller and deletes nothing but VMs. **Then, from 2.2b on, the recovery unit |
| +starts the armed continuation** (section 8, unattended), unless a guard refusal was journalled after |
| +the arm, the recovery's own credential check failed, the file changed, it was disarmed, or it already |
| +ran (kit K9). If it does not start, the run reports and waits for Paul; what exists costs about $1.15 |
| +a day (the controller stopped; proxies, three addresses, volumes, the image). A fence that attached |
| +the policy ends the drill's live part (reboot refuses while it is attached). |
| ## 9. Spend |
| @@ -1407,34 +1627,35 @@ 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: 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.2a six, 7.0 four: **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 | 26 h × $0.054692 = $1.42 | |
| +| Hosts | 9 h × $0.054692 = $0.49 | 32 h × $0.054692 = $1.75 | |
| | 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.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 |
| +| **Estimate** | **$26.68** | **$32.66** | |
| + |
| +Host hours, from the services apply to the hosts' termination. 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, every step at its bound: up and status |
| +0.85 (4.2 25 minutes, 4.3 25), certification 1.1 (5.1 25, 5.2 40), the signing bound 12, wiring |
| +0.25, three watchers 5.25 (105 minutes each), 7.0 and two drills 4.4 (10, 135, 110), the alert bound |
| +2, then the alert watchdog's trigger and the continuation to 8.3's end, 6 (8.0): 31.85, rounded up |
| +to 32. |
| + |
| +**After a trigger** (a watchdog's expiry or a failed block, from 2.2b on): the continuation ends |
| +the hosts within 357 minutes, at most **6 host-hours, about $0.33**, added to the estimate at the |
| +trigger; nothing else grows (no VM runs after S.4, and image storage is already charged at its |
| +minimum). The worst case above already contains the latest trigger. The continuation itself ends |
| +within about 23 h 42 min. The exceptions are a guard failure, a failed credential check at the |
| +trigger (2.2b's known limit) and a teardown step that stops: then about $1.15 a day on the bill until |
| +Paul answers. |
| + |
| +**Self-stop $40** leaves $7.34 over the worst case: three 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. |
| @@ -1449,8 +1670,9 @@ bills its full week. |
| | 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 | |
| +| `carlos` and the `kass` credential process 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, 50 minutes | abort if it never runs or ends; problems are FINDINGs | |
| +| the teardown continuation | 2.2b, then any trigger | not started (guard, credentials, file): the run waits for Paul | |
| | 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 | |
| @@ -1459,33 +1681,35 @@ bills its full week. |
| | 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; otherwise a standing FINDING "unconfirmed" | |
| | `lambda:PassNetworkConnector` | 5.2 | skip | |
| -| 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 pin, and proxies booting with `controller.json` late | 4.2, 4.3 | wait 1: skip; each put classified before the next; 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 | |
| +| `ops controller reboot`, waiting for the host to go away | 5.1, 7.1 | 5.1: puts first, each classified; 1 skip, 99 stop; 7.1: any failure stops | |
| +| `vms scan` against the controller's table | 6, 7, the signing wait | 99 (unexplained VM): stop; 1: FINDING | |
| +| `vms settle --step --ended-at` at each `HOSTED-CHECKS-END` | 6.2, 7 (the watcher) | 99: stop; 1 (clock skew): FINDING and settle from now | |
| +| the run id and the checks-started window | 6.2, 7 (the watcher) | no new run, a missing line: FINDING; missed or late: FINDING, not judged | |
| +| `cert bundle` (with and without `-empty`) and `cert reload` | 5.4b, 7.2 | skip, FINDING; a withdrawal not acknowledged in the window 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.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 | |
| +| `img delete` with `-ledger`, one block per image | 8.4.1, 8.4.2 | ordinary: `.retry1` once; 4: stop | |
| | the connector's interface cleanup | 8.5 | 1: `8.5.retry1`; 99: stop | |
| +| resumable bucket teardown | 8.6, 8.7 | a recorded bucket already gone is done; another owner: 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 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 images' tags** are passed on the create call; no kit command reads them back (accepted by |
| + the coordinator's ruling on revision 2's question 1). |
| - 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. |
| +- **Credentials during the waits** (2.2b): whether the `kass` credential process still works, |
| + unattended, at a trigger up to about 21 hours after GO. |
| +- **Clock skew** between the instance and docs-t1 (6.2): seconds with NTP; a large skew would stop a |
| + settle early or count its bound late. |
| - 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. |
diff --git a/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md b/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md| index 932f2f38..3018e1e0 100644 |
| --- a/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md |
| +++ b/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md |
| @@ -3858,3 +3858,34 @@ Mutation checks, each restored and green again (`go test ./internal/hostedops -c |
| - **K11c** another owner accepted: FAILED `:184 ... = 0, want 99`. |
| - **K11d** OpenTofu's record not marked: FAILED `:175 tf-recorded empty: the bucket's state is |
| confirmed, want absent`. |
| + |
| +## Task 34 revision 3 (Astra p34-r2, 2026-12-02) |
| + |
| +The dev drill plan, revision 3, for Astra's last round: each open round-2 finding (1, 2, 4, 5, 6, 10, |
| +13) with its fix (the plan's "Revision 3" section), written against kit round 2 (`dc868b1c`, |
| +`0acdeea7`) and headless round 2 (`4efc4956`). No code changed; no AWS call. |
| + |
| +- Section 8 is one script, `$P/teardown.sh`, armed at 2.2b before the first human wait |
| + (`ops continuation arm ... --max 23h`); its steps are `ops block <id> --teardown` with `--optional` |
| + and one `.retry1` on exit 1 for the image deletes (one block per image), the connector and the |
| + buckets and roots. 8.0's budget: 1311 minutes with every permitted retry and a final recovery; 23 |
| + hours leaves 69 minutes; hosts gone within 357 minutes of a trigger (about $0.33). |
| +- Each scenario has a watcher unit (`watch.sh`) that takes its run id from the new |
| + `HOSTED-SUITE-START`, settles at `HOSTED-CHECKS-END` with `--ended-at`, scans every 5 minutes, |
| + strikes in drill modes only inside the window (deadline checked before the mutation, the |
| + mutation's own time compared after), and handles every absent progress line as a FINDING. |
| +- Every operation is classified before the next dependent one (4.2, 5.1, 5.4b, the drills); an |
| + `unreadable` poll runs `ops safe-stop`; `ops unit wait` only for `done` or `over`. |
| + |
| +Green: `TestPlanInvocationsParse`, `TestPlanCertInvocationsParse`, `TestPlanImgInvocationsParse`, |
| +`make budget`, `bash -n` on all 32 `sh` blocks and on the quoted part of `run.env`. The parse tests |
| +caught two span defects (an `--ended-at` placeholder the parser refuses, a `--teardown` span without |
| +its command), fixed. `watch.sh` and `teardown.sh` were run against a stub `ops` and `cert` and a |
| +synthetic progress file (no AWS, no staging): a plain scenario with `--ended-at` refused (clock skew) |
| +settled from now and judged; a suite that failed before its scenario gave FINDINGs and exit 0; the |
| +withdrawal prepared, struck, settled at `ended_at`, restored and judged; a reboot inside the window |
| +settled at `ended_at` and took the `jobs=2` line; a late reboot was "missed window (late)", not |
| +judged; two live VMs with unknown IDs were "missed window" with no reboot; `teardown.sh` ran its |
| +steps in the ruled order, and an ordinary image-delete failure took `8.4.1.retry1`. The stub run |
| +found one real race, fixed in the plan: when `HOSTED-CHECKS-END` and `HOSTED-SUITE` land between two |
| +reads, the watcher now reads the checks-end line once more before settling from now. |