carlos / platform Public

Reviews: Task 2 round 1 findings; Task 3 brief

Task 2: READY AFTER FIXES, one P2 (fixed in d56ed0a99). Task 3's per-task
review brief.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev dbc92e9c1ec9e5eda09362118fe350360da79503 parent d56ed0a
2 files changed, +78 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-instance-usage-task2-R1.md +11 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-instance-usage-task3.md +67 −0

CI cancelled — superseded by a newer push — run details

CI log
=== gate ===
go: downloading go1.26.10 (linux/arm64)
go version go1.26.10 linux/arm64
opentofu: arm64, tofu 1.13.9, aws 6.73.0, archive 2.8.1
  tofu: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/tofu_1.13.9_linux_arm64.tar.gz
  tofu: downloaded, digest verified
  aws: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-aws_6.73.0_linux_arm64.zip
  aws: downloaded, digest verified
  archive: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-archive_2.8.1_linux_arm64.zip
  archive: downloaded, digest verified
  installed in /tmp/carlos-opentofu-f6ByUM
.amadan/test-gate.sh
go: downloading github.com/aws/aws-sdk-go-v2 v1.44.0
go: downloading github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.68.0
go: downloading github.com/aws/aws-sdk-go-v2/service/s3 v1.105.0
go: downloading github.com/aws/smithy-go v1.28.1
go: downloading github.com/aws/aws-sdk-go-v2/service/costexplorer v1.67.5
go: downloading golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e
go: downloading golang.org/x/net v0.62.0
go: downloading github.com/aws/aws-sdk-go-v2/service/sns v1.43.0
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/prometheus/client_golang v1.17.0
go: downloading golang.org/x/sync v0.24.0
go: downloading golang.org/x/crypto v0.58.0
go: downloading github.com/aws/aws-sdk-go-v2/service/acm v1.45.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.324.0
go: downloading github.com/aws/aws-sdk-go-v2/service/iam v1.58.2
go: downloading github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.37.0
go: downloading github.com/aws/aws-sdk-go-v2/service/route53 v1.64.1
go: downloading golang.org/x/sys v0.49.0
go: downloading github.com/aws/aws-sdk-go-v2/service/sesv2 v1.66.6
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.18
go: downloading github.com/pion/randutil v0.1.0
go: downloading github.com/pion/transport/v4 v4.0.2
go: downloading github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.40
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/pion/dtls/v3 v3.1.4
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/prometheus/client_model v0.5.0
go: downloading github.com/prometheus/common v0.45.0
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading google.golang.org/protobuf v1.36.10
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0
go: downloading golang.org/x/text v0.43.0
go: downloading github.com/klauspost/compress v1.20.2
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/libc v1.74.1
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading github.com/google/uuid v1.6.0
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading modernc.org/memory v1.11.0
go: downloading modernc.org/mathutil v1.7.1
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/google/uuid v1.6.0
go: downloading modernc.org/memory v1.11.0
go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec

amadan: job cancelled — a newer push superseded it
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-instance-usage-task2-R1.md b/docs/superpowers/reviews/CODEX-FINDINGS-instance-usage-task2-R1.md
new file mode 100644
index 000000000..d35598983
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-instance-usage-task2-R1.md
@@ -0,0 +1,11 @@
+- **P2 — T6 does not test a response spanning midnight.** In [usagemeter_instances_test.go:46](/home/paulca/.paseo/worktrees/03ai90xp/instance-usage/internal/edge/usagemeter_instances_test.go:46), `TestRecordPlacesHourAtCompletion` calls `Record` directly twice, moving the clock between calls. It proves hour bucketing, but never exercises the serving path’s completion timing. A regression that records a response before it finishes could assign a midnight-spanning download to the previous day while this test still passes.
+
+ **Fix:** Add a channel-controlled response through `ServeHTTP`: start before midnight, write part of the body, advance the fake clock past midnight, finish the response, and wait for `ServeHTTP` to return. Assert one request and all bytes appear exclusively in the new hour.
+
+ **Fault family:** Exchange completion-time attribution (§5, T6).
+
+No P1 findings. Inspection found the shared locking, atomic drain, caller attribution, hop subsets, disable behavior, and compression/upgrade ordering consistent with the brief.
+
+The targeted tests could not start: the read-only sandbox prevented Go from creating its build work directory. Runtime and race validation remain unverified.
+
+**READY AFTER FIXES**
\ No newline at end of file
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-instance-usage-task3.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-instance-usage-task3.md
new file mode 100644
index 000000000..6765f0f33
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-instance-usage-task3.md
@@ -0,0 +1,67 @@
+# Review brief: instance usage Task 3 (the flush queue), round 1 of 3
+
+Repo carlos/platform, branch `instance-usage`, commit 964f7b7ce.
+Under review: the code in commit 964f7b7ce (`git show 964f7b7ce`), Task 3
+of `docs/superpowers/plans/2026-11-29-instance-usage.md`.
+Authorities: `docs/superpowers/specs/2026-11-29-instance-usage-design.md`
+(rev 5, merged on main as 96731431a) §5, §6 and §12 (switch, census);
+the plan's Task 3 and Global Constraints; AGENTS.md. Do not review
+against unmerged branches.
+
+You are an independent reviewer. This is a per-task review because the
+flush feeds billing and runs in the root binary's agent (AGENTS.md
+stopping rule 3). Read the diff, then the code around it, and check every
+claim against that code.
+
+## Fixed: do not re-argue
+
+- Paul's ruling (spec §2): counts are a lower bound; a lost count is
+ acceptable, a double count is not.
+- The design (writer id per process, batch id per drain, `applied` kept
+ forever, the 24-hour drop horizon as a limit on starting writes,
+ per-object ordering, one object per box, date and app) is reviewed and
+ closed.
+
+## What to check
+
+1. Exactly once: no interleaving of failed, lost-answer, delayed and
+ retried conditional Puts, overlapping writers on one box, restarts,
+ or horizon drops merges a batch into an object twice. Ordering: a later
+ batch is never written to an object while an earlier batch still owes
+ it.
+2. The horizon: no write or retry is started for a bucket whose hour began
+ more than 24 hours before the tick; exactly 24 hours is kept; drops are
+ counted in `DroppedBytes` and on the box status.
+3. Keys and bodies: an unsafe account or app never produces a key outside
+ `usage/instances/`; a body failing its v1/key check stops that object's
+ write and leaves the batch queued (until the horizon); the queue never
+ wedges other objects.
+4. The old `usage/edge/` family is byte-identical and still skips empty
+ flushes; the instance write runs on the same (prefix-rebased) store.
+5. The off switch `CARLOS_INSTANCE_USAGE=off`: no counting, no writes.
+6. The randomized simulation (T5) actually checks the invariants the spec
+ lists after every step, and would fail on the obvious breakages.
+7. Root-binary hygiene: ctx passed on, no sleeps in tests, logs bounded
+ (an unsafe name logs once per bucket today: is that a problem?).
+
+## 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.
+- **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 problem, the evidence
+(file:line, verified), the failure scenario, a concrete fix and the
+invariant or trust boundary it breaks (its fault family). End with
+exactly one verdict: **READY**, **READY AFTER FIXES** (no P1), or
+**NOT READY** (P1s listed).
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites.