carlos / platform Public

Reviews: Task 6 round 1 findings

READY AFTER FIXES, two P2s fixed in 2f26b3e70; one P3 on the follow-up
list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 14aabe0503f0017efde14425f4dcb7508577b37f parent 2f26b3e
1 file changed, +27 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-instance-usage-task6-R1.md +27 −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-MgAsqa
.amadan/test-gate.sh
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/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 modernc.org/sqlite v1.55.0
go: downloading github.com/aws/aws-sdk-go-v2/service/sns v1.43.0
go: downloading golang.org/x/sys v0.49.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 github.com/prometheus/client_golang v1.17.0
go: downloading github.com/pion/stun/v3 v3.1.5
go: downloading github.com/pion/turn/v4 v4.1.4
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/lmittmann/tint v1.1.3
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.3.0
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/klauspost/compress v1.20.2
go: downloading github.com/pion/dtls/v3 v3.1.4
go: downloading github.com/pion/transport/v4 v4.0.2
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 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 github.com/klauspost/compress v1.20.2
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 modernc.org/mathutil v1.7.1
go: downloading modernc.org/memory v1.11.0
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec
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-task6-R1.md b/docs/superpowers/reviews/CODEX-FINDINGS-instance-usage-task6-R1.md
new file mode 100644
index 000000000..0737fe078
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-instance-usage-task6-R1.md
@@ -0,0 +1,27 @@
+No P1 findings. Two P2 fixes and one P3 follow-up:
+
+1. **P2 — The startup check can block usage requests beyond their deadline.**
+ [usagefrom.go:191](/home/paulca/.paseo/worktrees/03ai90xp/instance-usage/internal/console/usagefrom.go:191) passes the worker’s lifetime context into `usageFromCheck`, which holds `usageFromMu` during store operations at [usagefrom.go:99](/home/paulca/.paseo/worktrees/03ai90xp/instance-usage/internal/console/usagefrom.go:99). If the startup GET stalls, subsequent requests wait on that mutex even after their 15-second context expires. The AWS transport’s inactivity limits do not provide a whole-operation deadline.
+
+ **Fix:** Bound each startup attempt with a timeout and make waiting for the shared check respect request cancellation. Test a blocked startup read and a request whose deadline expires while waiting.
+ **Fault family:** Bounded network operations and cancellation.
+
+2. **P2 — Usage aggregation silently overflows `int64`.**
+ [apiusage.go:335](/home/paulca/.paseo/worktrees/03ai90xp/instance-usage/internal/console/apiusage.go:335) uses unchecked addition when combining a host’s counts across objects. [apiusage.go:244](/home/paulca/.paseo/worktrees/03ai90xp/instance-usage/internal/console/apiusage.go:244) also adds hosts into totals without checking overflow. Two valid counters of `4611686018427387904` bytes produce `-9223372036854775808`, returned as a successful, memoised answer. This can affect either one host across dates or the total across different hosts.
+
+ **Fix:** Check additions for all counter fields and response totals. Return aggregation failures through `InstanceUsageRead` so they produce a failed job and 503. Add boundary tests for both aggregation levels.
+ **Fault family:** Numeric integrity of usage totals.
+
+3. **P3 — The shared oversized-object log describes the wrong outcome.**
+ The new route reaches [usagedays.go:480](/home/paulca/.paseo/worktrees/03ai90xp/instance-usage/internal/console/usagedays.go:480), which says “sweep usage” and “skipped like an unreadable day.” For instance usage, the entire request fails with 503; nothing is skipped to produce a partial answer.
+
+ **Fix:** Use wording that describes the object read failure without claiming a particular caller’s handling. Keep this on the follow-up list.
+ **Fault family:** Accurate operational diagnostics.
+
+The five implementer concerns are ruled on as follows: declaring the job only while the switch is on is appropriate; F6 reasonably covers an `@from` store failure; the misleading log is P3 above; retaining an oversized settled object’s error for six hours follows the existing cache policy and continues to refuse the answer; and a client cancellation correctly records an unsuccessful request-driven read.
+
+Static inspection found the tenant gate and history check before memo lookup, account/app/month isolation, real-body validation after prefetch, and the claim-worker reporting guard intact.
+
+The targeted tests did **not run**: Go attempted to update `go.mod`, which the read-only workspace refused. No full suites ran and I edited no files. Apply the P2 fixes without reopening review, per the stopping rule.
+
+**READY AFTER FIXES**
\ No newline at end of file