Skip to content

Run Go tests through gotestsum with dorny/test-reporter#280

Merged
mariusvniekerk merged 3 commits intomainfrom
gotestsum
May 7, 2026
Merged

Run Go tests through gotestsum with dorny/test-reporter#280
mariusvniekerk merged 3 commits intomainfrom
gotestsum

Conversation

@mariusvniekerk
Copy link
Copy Markdown
Collaborator

Summary

  • CI Go test steps (unit, live GraphQL, integration, race) now run via gotestsum --format pkgname-and-test-fails --jsonfile, publishing per-suite check runs through dorny/test-reporter@v2.7.0 (golang-json).
  • make test, test-short, test-integration, and test-gitlab-container use the same gotestsum invocation, writing JSON event logs to tmp/.
  • gotestsum is wired in as a Go tool (go get -tool gotest.tools/gotestsum), so contributors invoke it as go tool gotestsum without a separate install.
  • Bug fix: worktree diffs with hideWhitespace=true no longer return whitespace-only modifications. git diff --raw ignores -w (compares blob SHAs); we now treat the --numstat map as ground truth and drop "modified" entries that aren't in it.

🤖 Generated with Claude Code

mariusvniekerk and others added 2 commits May 7, 2026 13:01
git's `--raw` output ignores `-w` because it compares blob SHAs, while
`--numstat` honors it. The worktree diff helpers merged both feeds but
only used numstat to populate addition/deletion counts, so a whitespace-
only modification stayed in the file list with 0/0 counts even when
hideWhitespace was true. The reproduction:

  $ git diff --raw     -w HEAD   →  M f.txt
  $ git diff --numstat -w HEAD   →  (empty)

Use the numstat map as ground truth for tracked content changes: when
hideWhitespace is true, drop any "modified" entry whose path is absent
from numstat. Renames, copies, additions, and deletions are kept since
their presence in --raw still reflects a real history change even with
0/0 counts.

Surfaced by TestWorktreeDiffFilesHidesWhitespaceOnlyChanges, which now
passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wire `gotestsum --format pkgname-and-test-fails --jsonfile` into the
Makefile (`test`, `test-short`, `test-integration`, `test-gitlab-container`)
and CI so passing packages collapse to a single line and failures keep
their full output. Each Go test step in CI now writes a JSON event log
under `tmp/` that `dorny/test-reporter@v2.7.0` ingests as `golang-json`,
publishing per-suite check runs alongside the existing logs (requires the
new `checks: write` permission). gotestsum is added via `go get -tool`
so contributors invoke it through `go tool gotestsum` without a separate
install.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@roborev-ci
Copy link
Copy Markdown

roborev-ci Bot commented May 7, 2026

roborev: Combined Review (a2b2588)

Medium issues remain around diff filtering correctness and missing regression coverage.

Medium

  • internal/workspace/diff.go:287 - dropWhitespaceOnlyModifications treats any modified file absent from git diff --numstat -w as whitespace-only. This can incorrectly hide real metadata-only changes, such as executable-bit flips, because --numstat may omit files with no line additions or deletions. Preserve modified entries with non-content metadata changes, or verify candidate drops with a path-specific whitespace-insensitive content diff while checking mode changes separately.

  • internal/workspace/diff.go:113 - The whitespace-hidden worktree diff behavior lacks e2e/API coverage despite changing user-visible diff output. Add a full-stack test using a real SQLite-backed server and git worktree to verify whitespace-only modifications are hidden while substantive changes remain visible.


Synthesized from 3 reviews (agents: codex, gemini | types: default, security)

When a workflow run is cancelled mid-test (e.g. concurrency cancel from
a follow-up push), gotestsum's --jsonfile is left without a final
elapsed-bearing event. The publish steps still ran under
'if: always() && ...' and dorny/test-reporter then errored with
"missing elapsed on final test event", clobbering the run with a
red annotation that has nothing to do with the actual test results.
Switch the conditions to !cancelled() so we only publish when there's
a real, complete result file to parse; success and failure paths still
publish as before.
@roborev-ci
Copy link
Copy Markdown

roborev-ci Bot commented May 7, 2026

roborev: Combined Review (9842ee9)

Medium: whitespace-hiding diff behavior lacks coverage for worktree flows.

Medium

  • internal/workspace/diff.go:113 - The user-visible hideWhitespace behavior for worktree diffs has no e2e/API-level coverage for full worktree and path-specific diff flows. A regression could re-show whitespace-only modifications or hide real modifications without being caught. Add a test that creates both whitespace-only and substantive worktree changes, requests diffs with hideWhitespace enabled, and verifies only whitespace-only modified entries are omitted.

Synthesized from 3 reviews (agents: codex, gemini | types: default, security)

@mariusvniekerk mariusvniekerk merged commit b188228 into main May 7, 2026
9 checks passed
@mariusvniekerk mariusvniekerk deleted the gotestsum branch May 7, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant