review: round 1 findings and scoped-check brief, console-request-ctx
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+48
−0
docs/superpowers/reviews/CHECK-BRIEF-console-request-ctx-R1-fix.md+20 −0docs/superpowers/reviews/FINDINGS-console-request-ctx-R1.md+28 −0
CI failed — run details
diff --git a/docs/superpowers/reviews/CHECK-BRIEF-console-request-ctx-R1-fix.md b/docs/superpowers/reviews/CHECK-BRIEF-console-request-ctx-R1-fix.md| new file mode 100644 |
| index 000000000..e753a5f52 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CHECK-BRIEF-console-request-ctx-R1-fix.md |
| @@ -0,0 +1,20 @@ |
| +# Scoped check: console-request-ctx, after round 1 (not a review round) |
| + |
| +Repo carlos/platform, branch `console-request-ctx` (tip in the prompt). |
| +Round 1 (`docs/superpowers/reviews/FINDINGS-console-request-ctx-R1.md`) |
| +ended READY AFTER FIXES with one P2 on the service-credential binding. |
| +The fix is commit 9b8bd6be. AGENTS.md rule 1: the review does not reopen, |
| +but the changed security gate is checked. Scope: `git show 9b8bd6be` only. |
| + |
| +Check: |
| +1. The P2: resolved, partly, not. |
| +2. serviceBinding now takes the request context (callers handleAPIApps, |
| + apiPrincipalAccountSaying, teamInScope): does every refusal it made |
| + before still refuse, a cancelled read included? Can any path now admit |
| + a service credential it refused before, or bind it to a different |
| + account? |
| +3. The new test cases: would they fail on the old code, any flake risk? |
| + |
| +Answer each: OK, or a finding with file:line, failure scenario and fix, |
| +marked P1 or P2. End with exactly one line: CHECK PASSED, or CHECK FAILED |
| +with the P1s. Do not edit files, spawn reviewers or run full suites. |
diff --git a/docs/superpowers/reviews/FINDINGS-console-request-ctx-R1.md b/docs/superpowers/reviews/FINDINGS-console-request-ctx-R1.md| new file mode 100644 |
| index 000000000..e12817520 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/FINDINGS-console-request-ctx-R1.md |
| @@ -0,0 +1,28 @@ |
| +Reviewed `7e50962dd68738bf9fc77cd49e6e73032ce0148b...b663ba9a646d924888b8ddd3f9e796c1fe419f46`, round 1. The requested tip adds only the brief to its named implementation commit. |
| + |
| +No P1 findings. One P2 finding. No P3 findings. |
| + |
| +**P2 — `/api/cli/apps` still waits without cancellation for service credentials.** |
| + |
| +Location: [apicli.go:765](/home/paulca/amadan.net/carlos/platform-console-request-ctx/internal/console/apicli.go:765), through `serviceBinding` at line 164. |
| + |
| +**Invariant:** Database calls on the selected request paths must leave the connection queue when the request is cancelled. |
| + |
| +The service-principal branch calls `serviceBinding(p)`, which calls `AccountByID`. That compatibility wrapper supplies `context.Background()`. If another request takes the sole connection after bearer resolution, this account lookup remains queued even after the client disconnects. The person-principal branch correctly uses the request context. |
| + |
| +**Fix:** Pass the request context through `serviceBinding` to `AccountByIDContext`, preserving its existing refusal behavior. Add a service-token case to [requestctx_test.go:136](/home/paulca/amadan.net/carlos/platform-console-request-ctx/internal/console/requestctx_test.go:136). Currently both new tests exercise `/api/cli/apps` only with a person’s token, so neither detects this omission. |
| + |
| +The remaining checks: |
| + |
| +- **Authorization:** I found no weakened gate. Session and bearer lookup errors refuse authentication. Membership, role and app checks preserve errors rather than treating them as permission. Linked-app and demo checks refuse failed reads. Cancellation of best-effort token timestamps does not bypass credential validation. |
| +- **Source guards:** Both bearer-resolver scans recognize the old and new names. The plan-exempt scan checks `EffectiveLimitsContext`, while accepting callers of either wrapper. The placement census follows the renamed implementation and still requires `effectivePlacement`. |
| +- **Detached callers and writes:** The five explicitly documented background calls remain outside this slice. First-account creation retains its cancellation-independent mint context. Last-seen cancellation follows the existing failed-write policy, including retaining the hourly reservation. A cancelled banner-notice write can delay notice recording, but cannot fabricate notice or authorize earlier enforcement. |
| +- **Transactions:** The changed pending-changes transaction performs reads only. It uses `BeginTx(ctx)`, context-aware queries, deferred rollback and a checked commit. I found no partial-write path. |
| +- **Tests:** By inspection, both new tests would detect the old implementation. The queue test synchronizes on `WaitCount` and handler completion; its ten-second timer bounds failure rather than scheduling cancellation. The context test checks later queries on the exercised paths, subject to the service-token omission above. |
| +- **Ratchet:** Independently confirmed console `db-no-context` drops from 629 to 591, with no raised allowance. The `server.go` reduction combines two fields into `bannerNotice`; it does not remove explanatory comments. |
| + |
| +Changed Go files pass formatting checks, and `git diff --check` is clean. Targeted tests stopped before compilation because Go attempted to update `go.mod` in the read-only workspace. No full suites ran, and no files were changed. |
| + |
| +This round has no P1, so the review closes under the stopping rule. Apply the P2 fix with the required scoped check of the changed binding gate. |
| + |
| +READY AFTER FIXES |
| \ No newline at end of file |