test(e2e): assert exact reporter event-type sequence per example - #78
Merged
Conversation
The JSON-mode check only verified event shape and that the stream ended on complete, so a dropped, duplicated, or reordered intermediate Step, Progress, Message, Warning, or Error event from a runnable example would pass silently. Compare the decoded sequence against one derived from each example's fixed fixture data instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tests/e2e/examples_test.go's JSON-mode check only verified event shape(every
typeknown, everytimestampRFC3339) and that the stream ended oncomplete. A missing, duplicated, or reordered intermediateStep,Progress,Message,Warning, orErrorevent from any of the fourrunnable examples would pass unnoticed as long as the final event was still
complete. Adds anexpectedEventSequencehelper that derives the exactJSON
EventTypesequence each example must emit from its fixed fixture datain
_examples/<name>/main.go, and asserts the decoded sequence matches itexactly. Updates
tests/e2e/README.mdto document the stronger runtimeassertion. No reporter behavior or example fixture changed — test and docs
only.
Checks
make check— gofmt leaves no diff,golangci-lint run(
.golangci.yml) clean,go test -v ./...green (unit +tests/e2e)ok github.com/frostyard/std/reporter 0.003s ok github.com/frostyard/std/tests/e2e 5.045s coverage: 74.6% check-coverage: observed total statement coverage 100.0% (required >= 95.0%) check-coverage: OKgo test -race -short ./...greenok github.com/frostyard/std/reporter 1.012s ok github.com/frostyard/std/tests/e2e 6.222sgo.modstill declares no dependencies (stdlib only) — unchanged, noimport added outside stdlib and
github.com/frostyard/std/reporterexact output changes update
docs/specs/reporter-package.md— this PRonly strengthens an existing test's assertion; no reporter output
behavior changed, so
docs/specs/reporter-package.mdis untouched.Verified the new assertion actually catches a regression by
temporarily deleting one
Warningcall from_examples/deploy/main.goand re-running
go test -run TestExamples/deploy/json -v ./tests/e2e/...:it failed with
event type sequence = [... want step message warning ...], thenrestored the file before committing.
Docs housekeeping
AGENTS.md,docs/design/overview.md,docs/specs/*updated forbehavior or convention changes — not applicable;
tests/e2e/README.md(the e2e suite's own doc) is updated instead, since no
AGENTS.mdordocs/specs/*claim changed.Protected boundaries
Not applicable — this PR touches only
tests/e2e/examples_test.goandtests/e2e/README.md; no.github/workflows/**,.goreleaser.yaml,.svu.yaml, orpolicies/agent-governance.jsonfiles are touched.Risk classification
Low — test-only strengthening of an existing e2e assertion plus a
matching doc update; no production code, reporter behavior, example
fixtures, or CI/release configuration changed.
make check, race tests, andthe docs integrity check all pass unchanged.
Verification
node scripts/check-docs.mjsgreenok docs_index_coverage: 1.000 (required 1) ok link_integrity: 1.000 (required 1) ok symlink_resolution: 1.000 (required 1) checked: 12 docs, 153 links, 9 symlinksPR review rubric