Fix test helpers to print the field under test, not the container#50
Merged
Conversation
The shared assertion helpers in destinations_test.go printed the whole *Destination via %s instead of the int/string field they claimed to be checking, so when an assertion fired the failure message hid the value that mismatched. assertError accepted any error, which is the checklist theater AGENTS.md warns against. This change rewrites each helper to take the field directly (matching AGENTS.md's "test helpers take only the field under test" guidance), adds t.Helper() so failure lines point at the caller, and adds assertErrorContains for tests that should pin which error came back. Meta-tests using a capturing fake testing.T lock in the new failure message format. Call sites in resolver_test.go are updated to pass a context name instead of *Destination. Fixes #46 https://claude.ai/code/session_01WjHPSobuzrRkjwUgjAJWMk
3 tasks
dolph
added a commit
that referenced
this pull request
May 16, 2026
The release workflow defaults to a patch bump when a merged PR has no release:* label. Docs-only PR #45 and test-only PR #50 were both opened unlabeled because AGENTS.md only mentioned the labels exist without instructing agents to apply one. #45 likely cut an empty patch release; #50 needed retroactive labeling before merge. Replace the passing mention with a short rubric covering when to use skip / patch / minor / major, and an explicit "before merge" deadline so future agents pick exactly one. https://claude.ai/code/session_01WjHPSobuzrRkjwUgjAJWMk Co-authored-by: Claude <noreply@anthropic.com>
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
assertPortEquals,assertSchemeEquals,assertHostEqualsnow take the field under test directly so failure messages print the actual mismatched value instead of routing through*Destination.String(). The%sfor anintbug inassertPortEqualsis gone with it.assertNoError/assertErroraccept aname stringfor call-site context (better than the previous unused*Destinationargument), and a newassertErrorContains(t, err, substr)helper is available for tests that should pin which error came back — addressing the "checklist theater" pattern AGENTS.md calls out.t.Helper()so failure lines point at the caller, not the helper.testing.Tlock in the new failure-message contract (e.g.assertPortEqualsmust mention "Port" and both numeric values).TestTcpUrlWithoutPortandTestUdpUrlWithoutPortnow assert on the "Unsupported scheme" substring instead of just "some error came back," so an unrelated regression inNewDestinationcan no longer make them silently pass.resolver_test.gocall sites are updated to pass a context-name string.router_test.goandsource_test.godefine their own helpers and didn't need changes.Test plan
go vet ./...— cleangofmt -l .— emptygo build ./...— cleango test -race ./...— same pass/fail set asorigin/main; the pre-existingTestRouteToLoopback{1,2,3}failures are the documented sandbox-routing issue from Tests aren't hermetic and major modules are untested; production code is hard to test #24 (not a regression)TestAssert*meta-tests pass and would fail to compile against the old helper signatures (the TDD "right reason")Fixes #46
https://claude.ai/code/session_01WjHPSobuzrRkjwUgjAJWMk
Generated by Claude Code