Skip to content

Approve stdout and stderr separately in every approval test - #59

Merged
MPV merged 1 commit into
masterfrom
claude/approve-stdout-stderr
Jul 24, 2026
Merged

Approve stdout and stderr separately in every approval test#59
MPV merged 1 commit into
masterfrom
claude/approve-stdout-stderr

Conversation

@MPV

@MPV MPV commented Jul 23, 2026

Copy link
Copy Markdown
Owner

What

Give the approval suite a shared verify(t, file) helper that approves what the tool prints to stdout (the images) and to stderr (the error message, if any) as two separate golden files, and route every test through it.

Requires bumping go-approval-tests v1.2.0 → v1.5.0 for Options().WithAdditionalInformation(...). .received.txt files are gitignored.

Why

The suite only captured stdout, so a change to what a manifest sends to stderr — an error appearing or disappearing — was invisible. Later PRs change exactly that (treating an unsupported kind as skippable; the CLI's exit/stderr behavior), and those changes should land as reviewable golden-file diffs rather than silent shifts.

What's in the diff

Nine verify() call sites, each gaining a .stdout + .stderr golden (the old single-stream .approved.txt is renamed to .stdout.approved.txt, and a .stderr.approved.txt is added):

  • 8 success cases — the 7 TestKind kinds and TestMultiple — carry an empty .stderr golden. That empty golden is the point: a regression that leaked to stderr on a passing manifest would now fail the suite.
  • 1 error caseTestError.Service — carries a non-empty .stderr golden holding the current text, error processing document: unsupported kind Service. This is the baseline that Skip non-workload documents instead of aborting the stream #54 later flips to empty when a Service becomes skippable.

Behavior change

None — test-infrastructure only (test code + go.mod/go.sum + .gitignore). Supersedes the draft #46.

Note

Replaces #58, which I inadvertently closed — GitHub refuses to reopen a PR after its branch was force-pushed. Same branch (claude/approve-stdout-stderr), same commit, correct diff.

Stack

Base of both stacks: parsing (#49#54#56) and CLI (#50#55#57).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC


Generated by Claude Code

The approval suite only captured stdout (the image list), so a change to
what a manifest sends to stderr — an error appearing or disappearing —
was invisible. Later PRs change exactly that (treating an unsupported
kind as skippable; the CLI's exit/stderr behavior), and those changes
should land as reviewable golden-file diffs.

Add a shared verify() helper that approves stdout and stderr as two
separate golden files, and route every test (TestKind, TestError,
TestMultiple) through it. Expected behavior now lives entirely in the
goldens: success cases carry an empty stderr golden, and the Service
case carries the error text. This needs go-approval-tests v1.5.0 for
WithAdditionalInformation; received files are gitignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC
@MPV
MPV force-pushed the claude/approve-stdout-stderr branch from a0611cd to abb45b2 Compare July 23, 2026 08:38
@MPV
MPV merged commit b21318a into master Jul 24, 2026
1 check passed
@MPV
MPV deleted the claude/approve-stdout-stderr branch July 24, 2026 06:40
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.

2 participants