Skip to content

Cover coalescing with infinite values, null tags and server-wide tags - #33

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/coalescing-edge-tests
Oct 29, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/coalescing-edge-tests

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle: three characterization tests for paths through the 0.7.0 coalescing code in report() that no existing test drove. No production code is changed.

  • coalesce_infiniteValuesAreTheSameEventAsNoValue: +Infinity, -Infinity and no value are counted as one event. The existing coalesce_keysOnNameValueAndTagsButNotTagOrder only covers NaN.
  • coalesce_aTagWithANullKeyOrValueIsLeftOutOfTheEventAndNeverThrows: a tag map with a null key and a null value goes through the coalescing key (new TreeMap<>(merged), which throws on a null key) without throwing, and is the same event as the map without them. The test acts as a regression guard for the never-throws promise if withVersion() ever stops dropping null tags.
  • coalesce_aCountCarriesTheInstallAndServerWideTagsBeforeItsOwn: a count event keeps the install and server-wide tags: entries, with coalesced added last.

All three tests assert current behaviour, and no bug was found.

Triage notes (skipped issues)

All four open issues (#13, #15, #27, #31) ask for a maintainer decision on the wire format or the server-wide opt-out contract. Each one lists options, so none was picked up for autonomous implementation this cycle.

Test plan

  • mvn -B verify run locally on Java 21: Tests run: 97, Failures: 0, Errors: 0, Skipped: 0 (94 before this change)
  • CI matrix green on Java 8, 17 and 21

No tracking issue: this gap was found during triage.

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

The coalescing tests drove only finite or NaN values and plain tags.
These pin three more paths through report(): an infinite value is the
same event as no value; a tag with a null key or value is dropped
before the TreeMap key is built, so it neither throws nor makes a
different event; and a count carries the install and server-wide tags
ahead of its coalesced tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (scored against the diff and CI run 40833499389):

  • Scope: PASS. Only src/test/java/software/stephenson/trace/TraceClientTest.java is modified (+75 lines, 3 new tests). There is no formatting churn.
  • Tests-new: PASS (not applicable). No public members were added. The three tests cover existing report() coalescing paths.
  • Tests-fix: not applicable. No production change. The tests characterize current behaviour.
  • Sibling structure: PASS. The names follow the coalesce_* series, use Arrange/Act/Assert comments, run against the loopback HttpServer fixture, and use @TempDir plus writeServerWideConfig for the server-wide file.
  • Sibling renames: not applicable.
  • Docs: PASS. There is no behaviour change, so the README and Javadoc are unaffected. The new tests agree with the documented order (the event's own tags, then version, install, server-wide tags and coalesced) and with the documented rule that an infinite value is sent as no value.
  • Issue resolution: not applicable (no Closes).
  • CI: PASS. build (8), build (17) and build (21) are green on head 3131c72. Locally, mvn -B verify (Java 21) ran 97 tests with 0 failures (94 before).
  • No dependencies / single file / Java 8: PASS. pom.xml and src/main are untouched. The test code uses only Java 8 APIs (HashMap, Collections.singletonMap), and the Java 8 leg confirms this.
  • Never throws / non-blocking / environment seam / version agreement / opt-out contract: not applicable (no production change).

Observations:

  • TraceClientTest.java coalesce_infiniteValuesAreTheSameEventAsNoValue and coalesce_aTagWithANullKeyOrValueIsLeftOutOfTheEventAndNeverThrows: the "nothing more sent at once" check relies on a 200 ms Thread.sleep, as the existing coalesce_sendsTheFirstAtOnce... and coalesce_keysOnNameValue... tests do. A slow runner could only make that check pass more easily, never fail it, because a late count would be caught by the later exact-size assertion after close(). The flake risk therefore stays at the existing level.
  • TraceClientTest.java coalesce_aTagWithANullKeyOrValueIsLeftOutOfTheEventAndNeverThrows: the comment says the TreeMap key is safe only because withVersion() drops null tags. This was confirmed against TraceClient.java withVersion (it copies only non-null keys and values) and report (new TreeMap<>(merged)).

Summary: the PR adds tests only, CI is green on all three JDKs, and no blocking findings remain.

This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 7a9deea into main Oct 29, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/coalescing-edge-tests branch October 29, 2026 07:09
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