Astra brief: hosts-used-scan-snapshot round 1
1 file changed,
+77
−0
docs/superpowers/reviews/CODEX-REVIEW-BRIEF-hosts-used-scan-snapshot.md+77 −0
CI failed — run details
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-hosts-used-scan-snapshot.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-hosts-used-scan-snapshot.md| new file mode 100644 |
| index 000000000..87945d710 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-hosts-used-scan-snapshot.md |
| @@ -0,0 +1,77 @@ |
| +# Review brief: branch hosts-used-scan-snapshot (#444), round 1 of 3 |
| + |
| +Repo carlos/platform, branch `hosts-used-scan-snapshot`, commit cab9c9cf (the fix), plus this brief's own commit. |
| +Under review: the diff `5f4df955..HEAD`, which touches only `scripts/hosts-used-scan-aws.sh` and |
| +`cmd/console/hostsused_scan_test.go`. Scope is narrow: this change only. Do not review the rest of the |
| +script or the activation code except where this change interacts with it. |
| +Authorities (all on main): spec `docs/superpowers/specs/2026-10-26-nearest-region-without-claims-design.md` |
| +§3b, plan `docs/superpowers/plans/2026-10-26-nearest-region-never-reuse.md` Task 11, README "Completing the |
| +history". Do not review against unmerged branches; if this work needs one, say so as a P1 and stop. |
| + |
| +You are an independent reviewer. Read the diff, then the code it touches, and check every claim in the |
| +comments, the commit message and this brief against that code. |
| + |
| +## The problem (#444) |
| + |
| +The script lists each box's data directory (`find . -maxdepth 3`) over SSM, which returns at most |
| +24,000 characters, so a big listing comes back in pages. Before this change, every page re-ran `find` and |
| +the pages were accepted only if every page's header (sha256, length, line count) matched. On flagship's |
| +busiest box (12,124 paths, about 23 pages) SQLite `-wal`/`-shm` files appear and vanish every few seconds, |
| +so the listing never matched itself and the box could not be scanned. Activation refuses an unscanned |
| +target, so flagship could not complete its hostname history. |
| + |
| +## Fixed: do not re-argue |
| + |
| +Paul's go (2026-10-27, via the coordinator): each box runs `find` once into a scratch file in /run or |
| +/dev/shm with a mktemp name, removed by exact path when done, including on failure; pages are cut from |
| +that file with the sha256, length and line-count check kept, now over the file; GNU find's |
| +`-ignore_readdir_race` so a file vanishing mid-walk doesn't fail the listing, any other find error still |
| +ok:false. The scan writing one scratch file per box is accepted. |
| + |
| +## What to check |
| + |
| +1. Correctness of a snapshot listing: the reassembled listing must be exactly what the one `find` saw; |
| + the integrity check (sha256, base64 length, line count) must still catch a short, cut or corrupted |
| + page or a replaced scratch file. Could any page come from a different snapshot or file? |
| +2. Command injection: the scratch file's name comes back from the box and is written into later SSM |
| + commands; HOSTS_SCAN_RUNDIR is written into every box command. Are both constrained enough? |
| +3. Cleanup: is the scratch file removed by exact path in every path you can find (success, a page that |
| + fails, a header mismatch and its retry, a snapshot command that fails, an interrupted run)? Name any |
| + path that leaks one, and whether it matters (tmpfs, root-only, about 500 KB). |
| +4. `-ignore_readdir_race`: does any find error other than a vanished entry still fail the box with |
| + ok:false? Is the flag placed where GNU find honours it for both finds? |
| +5. The tests: does TestHostsUsedScanAWSPagesOneSnapshot fail on the old script and prove a single |
| + snapshot is paged? Do the changed expectations in TestHostsUsedScanAWSFailsATargetClosed still pin |
| + every failure they pinned before (except the deliberately removed "changed while it was paged")? |
| + |
| +Run only `go test ./cmd/console -run TestHostsUsedScanAWS` if you run anything (needs GOFLAGS=-buildvcs=false |
| +in this worktree). |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. |
| + Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. (The |
| + census, and review of any newly changed security, root, termination |
| + or production-storage behaviour, still check the fix; see AGENTS.md, |
| + "Stopping rules".) |
| +- **P3**: clarity or polish. Goes on a follow-up list; never a reason for |
| + another round. |
| + |
| +A P1 states its failure scenario and the evidence (file:line). Do not |
| +raise a P2 to P1 to keep the review open. |
| + |
| +## Output |
| + |
| +Findings ranked P1, P2, P3. Each gives the section or task, the problem, |
| +the evidence (file:line, verified), the failure scenario, a concrete |
| +fix and the invariant or trust boundary it breaks (that is its fault |
| +family). End with exactly one verdict: |
| + |
| +- **READY**: no P1 and no P2. |
| +- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another |
| + round. |
| +- **NOT READY**: one or more P1s, listed. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of |
| +your own. Do not run the full test suites. |