Files
pad/internal/server
xarmian 8ee68e9b4e test(server): the body-reader accounting asks the type checker, so a request reached through a struct field, context value, alias or embedding is counted (BUG-2820) (#1546)
TestEveryRequestBodyReaderIsAccountedFor scanned internal/server with a
parser that matched the spelling `http.Request` and names bound to it. A
request reached through a struct field, a context value, a type alias, an
embedded field, an import alias, a dot import, a var declaration, a
call-derived alias, a named result or a range binding was invisible, and
accounting was per file with a reader count as a workaround.

- collectRequestBodyReads loads the package with go/packages and counts
  every selector whose resolved object is the SAME object that looking the
  member up on net/http.Request yields (Body, FormValue, PostFormValue,
  ParseForm, ParseMultipartForm, MultipartForm, PostForm, MultipartReader,
  FormFile). Accounting is per call site: file::function::member -> count,
  with the per-file reasons kept.
- A fixture package (testdata/bodyreaders) pins the 12 forms the parser
  could not see, the 9 its own controls held it to, and 6 non-readers,
  including the two shadowing cases the parser over-flagged on purpose,
  which are now exact.
- New: TestEveryRequestHandoffIsClassified. A request passed to code outside
  the module must be classified. fosite's five New*Request calls read the
  OAuth form body (BUG-2811) and are pinned per site; interface dispatch
  (http.Handler.ServeHTTP) is named as statically unresolvable.
- Measured on this tree: the type checker finds exactly the readers the
  parser found, file for file. The blind spots were real, but nothing
  used them.
- The parser (scanFileForRequestBodyReads) and its controls
  (TestBodyReaderScanDiscriminates) are retired; their cases live in the
  fixture.

Claude-Session: https://claude.ai/code/session_01A3rXV7GDLAhBe9mL4V6z2m
2026-09-25 14:22:55 -04:00
..