Files
w3cjandClaude Sonnet 5.5 3c2ea0e621 fix(testlog): match build errors to their package, name crashed test
Build errors from several packages were held as one block of stray
lines and given to the first package's FAIL line, so a package could
get another package's errors, and the errors were dropped when an ok
line came between. The parser now reads each "# pkg" header and the
compiler output after it as a block of its own, which no marker
discards. A block continues only on compiler output (error lines,
indented notes, vet lines, "too many errors"), so a crash from the
next package stays with that package. A "[build failed]" or "[setup
failed]" line claims the block whose header names its package or its
external test package. For a "command-line-arguments" header, the
directory of a file in the error lines is matched against the package
path. The claimed block becomes that package's (package) failure.
Blocks nobody claims are kept in a separate (build) failure instead of
being dropped.

A crash during a verbose run also lost the name of the test that was
running. The (package) failure now has a RunningTest field holding it,
empty when unknown. The crash-detection rules are unchanged.

The fixtures are real go test output generated locally from throwaway
packages with compile errors and a panicking goroutine, in a temp
folder outside the repository, because devvm's CI has no build
failure. Paths were rewritten to /tmp/ciw and /go. Each finding has a
failing test written first, plus table cases for the edge cases.

Left from review:
- internal/testlog/testlog.go: a package that fails only because a
  dependency did not compile gets no (package) entry of its own, as
  the errors sit under the dependency's header.
- internal/testlog/testlog.go: dedupe can drop RunningTest when a go
  test entry repeats a gotestsum one or two entries are merged.
- internal/testlog/testlog.go: a lone "# word" line from a CI script
  opens a build block and can produce a false (build) failure.
- internal/testlog/testlog.go: the (build) failure is added after the
  whole log is read, not in log order.
- One commit on the branch is missing the Co-Authored-By trailer.

Built in steps:
- test(testlog): reproduce mixed build errors and unnamed crash test
- fix(testlog): split build errors by package, name the crashed test
- fix(testlog): address review findings

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-22 21:10:47 -07:00
..