Cover JSON encoding edges, close/report lifecycle and request headers in tests - #2
Open
dmccoystephenson wants to merge 1 commit into
Open
dmccoystephenson wants to merge 1 commit into
dmccoystephenson wants to merge 1 commit into
Conversation
… in tests Characterization tests only; no production change. Adds coverage for Infinity values, null/empty/all-skipped tags, quote() on \r and other control characters, close() twice, report() after close(), the User-Agent header, a 200 answer being logged, and builder trimming. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Member
Author
|
Self-review rubric (anchored on CI run 35968474968 and the diff):
Judgment calls, left for the maintainer:
Out-of-diff observation: CI annotations report that This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
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
Stage B cycle (unit-test expansion). Only characterization tests are added, and no production code is changed. Each new test pins behaviour of
TraceClientthat no existing test exercised:json_dropsInfiniteValuesAndKeepsFiniteOnes:±Infinityvalues are omitted, the same wayNaNalready is.json_omitsTagsWhenNullOrEmpty:nullor empty tags produce notagskey (README "The wire format").json_writesAnEmptyTagsObjectWhenEveryTagIsSkipped: characterizes current behaviour. A non-empty map that holds only null keys/values still emits"tags":{}. The result is valid JSON, and the behaviour is recorded here rather than changed.quote_escapesCarriageReturnAndEveryOtherControlCharacter/quote_passesPrintableAndNonAsciiCharactersThrough: covers\r, the\u00XXfallback (\0,\b,\f,\^_), the empty string, and pass-through of non-ASCII and DEL.close_isSafeToCallTwiceandreport_afterCloseIsDroppedWithoutThrowing: theclose()Javadoc says "safe to call more than once", and a latereport()reachesDiscardPolicywithout throwing.report_sendsAUserAgentNamingTheClientAndTheApplication: the header must matchtrace-client/X.Y.Z (<application>). A pattern is used instead of the literal version, so version bumps still touch only the four existing places.report_logsASuccessStatusOtherThan201: a200counts as a drop and is logged atFINE("A201is success; anything else is logged").builder_trimsTheBaseUrlAndApplicationAndDropsEveryTrailingSlash: surrounding whitespace is trimmed, and several trailing slashes collapse to one/api/metrics.The test fixture's
Receivedrecord now also captures theUser-Agentheader.A documentation accuracy sweep ran during triage first. It checked the README tables, the class Javadoc,
pom.xmland thebuild.ymlcomment against the code and found no drift, so this cycle moved to test expansion.No open issues existed at triage, so none were skipped. No tracking issue exists for this change; the gaps were found during triage.
Deferred: #3 (moving the GitHub Actions off the deprecated v4 / Node.js 20 versions) was filed during this cycle's self-review. It is kept out of this PR because it is unrelated to test coverage, and because
.github/workflows/*changes are do-not-auto-merge. It should go in a separate PR.Test plan
mvn -B verifyrun locally on Java 21:Tests run: 29, Failures: 0, Errors: 0, Skipped: 0(19 existing + 10 new)16314ea; the Java 8 leg confirms that no post-8 API is used in the tests)This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson