Skip to content

test(e2e): assert exact reporter event-type sequence per example - #78

Merged
bketelsen merged 1 commit into
mainfrom
cockpit/worker-15c98f809c49ed07
Aug 30, 2026
Merged

test(e2e): assert exact reporter event-type sequence per example#78
bketelsen merged 1 commit into
mainfrom
cockpit/worker-15c98f809c49ed07

Conversation

@bketelsen

Copy link
Copy Markdown
Contributor

Summary

tests/e2e/examples_test.go's JSON-mode check only verified event shape
(every type known, every timestamp RFC3339) and that the stream ended on
complete. A missing, duplicated, or reordered intermediate Step,
Progress, Message, Warning, or Error event from any of the four
runnable examples would pass unnoticed as long as the final event was still
complete. Adds an expectedEventSequence helper that derives the exact
JSON EventType sequence each example must emit from its fixed fixture data
in _examples/<name>/main.go, and asserts the decoded sequence matches it
exactly. Updates tests/e2e/README.md to document the stronger runtime
assertion. 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: OK
  • go test -race -short ./... green
    ok github.com/frostyard/std/reporter 1.012s ok github.com/frostyard/std/tests/e2e 6.222s
  • go.mod still declares no dependencies (stdlib only) — unchanged, no
    import added outside stdlib and github.com/frostyard/std/reporter
  • New or changed behavior has focused tests, including failure paths;
    exact output changes update docs/specs/reporter-package.md — this PR
    only strengthens an existing test's assertion; no reporter output
    behavior changed, so docs/specs/reporter-package.md is untouched.
    Verified the new assertion actually catches a regression by
    temporarily deleting one Warning call from _examples/deploy/main.go
    and re-running go test -run TestExamples/deploy/json -v ./tests/e2e/...:
    it failed with
    event type sequence = [... want step message warning ...], then
    restored the file before committing.

Docs housekeeping

  • AGENTS.md, docs/design/overview.md, docs/specs/* updated for
    behavior or convention changes — not applicable; tests/e2e/README.md
    (the e2e suite's own doc) is updated instead, since no AGENTS.md or
    docs/specs/* claim changed.

Protected boundaries

Not applicable — this PR touches only tests/e2e/examples_test.go and
tests/e2e/README.md; no .github/workflows/**, .goreleaser.yaml,
.svu.yaml, or policies/agent-governance.json files 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, and
the docs integrity check all pass unchanged.

Verification

  • node scripts/check-docs.mjs green
    ok 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 symlinks
  • Checked against the
    PR review rubric

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.
@bketelsen
bketelsen marked this pull request as ready for review August 30, 2026 02:22
@bketelsen
bketelsen added this pull request to the merge queue Aug 30, 2026
Merged via the queue into main with commit 85b977b Aug 30, 2026
8 checks passed
@bketelsen
bketelsen deleted the cockpit/worker-15c98f809c49ed07 branch August 30, 2026 02:31
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