| new file mode 100644 |
| index 000000000..40e16a47a |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/FINDINGS-flake-appregion-replaced.md |
| @@ -0,0 +1,26 @@ |
| +Reviewed commit `2a5f24c10f1ce8b37bc5fe358d188fc47a6a476f` against the brief’s base, `619c64c5`. Round 1. No P1 findings; two P2 corrections to the brief. No defect found in the test change. |
| + |
| +1. **P2 — The 200 ms probe explanation does not apply to this POST.** |
| + Evidence: [review brief:65](/home/paulca/amadan.net/carlos/platform-flake-appregion/docs/superpowers/reviews/REVIEW-BRIEF-flake-appregion-replaced.md:65). In the installed Go 1.26.10 source, [transfer.go:179](/home/paulca/.local/go-dist/src/net/http/transfer.go:179) restricts `probeRequestBody` to methods that usually lack bodies; POST skips it. Instead, [transfer.go:106](/home/paulca/.local/go-dist/src/net/http/transfer.go:106) sets `FlushHeaders`, and [request.go:754](/home/paulca/.local/go-dist/src/net/http/request.go:754) flushes before copying the body. |
| + |
| + The failure scenario remains valid: the handler can signal `reading` before either pipe write supplies bytes. However, no 200 ms delay is required. **Fix:** explain the direct header flush and remove the probe-based timing explanation. |
| + |
| +2. **P2 — The resolver’s response-status list omits the linked-app guard.** |
| + Evidence: [review brief:40](/home/paulca/amadan.net/carlos/platform-flake-appregion/docs/superpowers/reviews/REVIEW-BRIEF-flake-appregion-replaced.md:40). [appregionset.go:488](/home/paulca/amadan.net/carlos/platform-flake-appregion/internal/console/appregionset.go:488) calls `refuseLinkedPage`, which renders the guard’s status. That guard returns 503 on lookup failure at [linkedpolicy.go:340](/home/paulca/amadan.net/carlos/platform-flake-appregion/internal/console/linkedpolicy.go:340), or 409 for a linked app at line 354. |
| + |
| + Those cases contradict the stated list of 302, 404 and 500, although neither introduces a 403. **Fix:** include 409 and 503, or state only that the resolver cannot return 403. |
| + |
| +The six requested checks otherwise hold: |
| + |
| +- **403 attribution:** The route registration, wrappers, admission gate, account resolver and linked-app guard provide no alternative 403 path for this request. The CSRF refusal at `appregionset.go:439` explains it. |
| +- **Blocking and timeout:** The client transport consumes the five-byte prefix independently of the handler reading it. An early transport failure closes the request body, releasing the pipe writer with an error. Once the prefix is consumed, the existing 10-second select still detects a handler that never reads. That timer does not cover the preceding write or provide an overall request deadline. |
| +- **Signal ordering:** The middleware wraps the body without reading it. `accountAppIncarnation` completes before `csrfFormOK` initiates the read that fires `firstReadSignal`. Standard-library socket buffering does not invoke this wrapper. |
| +- **Preserved coverage:** The prefix write completes before the replacement, while the token, region and EOF remain withheld until afterwards. The unchanged assertions still check 303, unchanged replacement region and no region audit event. Moving `ParseForm` ahead of incarnation resolution is a valid mutation witness: it would resolve the replacement and permit its region change. |
| +- **Comment accuracy:** The new comment correctly describes pipe-write ordering and the signal firing before bytes arrive. |
| +- **Transport errors:** `t.Error(err)` marks the test failed; sending a nil response does not conceal the error. The later “no response” check adds another failure. |
| + |
| +Validation was limited to source inspection. The permitted targeted test command failed before compilation because Go could not create its build directory in the read-only sandbox. I did not independently reproduce the brief’s stress or mutation results. No files were changed. |
| + |
| +Apply the two P2 documentation corrections without another review round. |
| + |
| +**READY AFTER FIXES** |
| \ No newline at end of file |