Repository navigation
Carry the program's version on every event (0.2.0) - #3
Merged
Merged
Conversation
The constructor now takes the program's own version as a required argument after the application name. It is trimmed and sent as the tag "version" on every event; an event's own "version" tag wins, and the caller's tags are never modified. A blank version, or one over 255 bytes, disables the client with reason "unavailable", matching how a blank base URL or application name is handled, since nothing in the client throws. The default-constructed (disabled) client holds the placeholder version "disabled". The User-Agent still names the client's version. Breaking change: TRACE_CLIENT_VERSION 0.1.0 -> 0.2.0. Mirrors Stephenson-Software/trace-client-java#5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AuTszT2gqv7nLVYrtKD4ji
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AuTszT2gqv7nLVYrtKD4ji
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.
Every event sent by the C++ client now carries the program's own version, mirroring Stephenson-Software/trace-client-java#5.
Changes
TraceClienttakes the program's version as a required argument right after the application name:versionon every event (startup,command, anything else). An event's ownversiontag wins; the caller'sTagsare never modified (the merge is done on a copy,detail::withVersion). The client has no other default tags."unavailable". A bad version follows that same convention."disabled".trace-client-cpp/0.2.0 (<application>)).TRACE_CLIENT_VERSION0.1.0 → 0.2.0 (header banner, macro, README wire format; aVERSION 0.2.0was added to the CMakeproject()). Old 3–5 argument calls fail to compile rather than silently shifting arguments (booldoes not convert tostd::string).disabledReason()/enabledargument notes updated. The header doc comment no longer hand-tagsversiononstartup.Tests
Existing tests were moved to the new signature and expected bodies; four were added: an event tagged with the trimmed version (User-Agent still the client's), an event's own version winning, the caller's tags not being mutated, and a blank/overlong version being rejected (exactly 255 bytes after trimming is accepted).
make test(g++ 9, c++11 / c++17 / c++2a): 26 tests, 0 failed checks.make test-libcurl: 26 tests, 0 failed checks.ctest: 1/1 passed.Mutation probes: with the version injection removed from
enqueue, 3 checks failed (including the new trimmed-version test); with the merge changed to overwrite the event's ownversion, 2 checks failed. Both were restored.Known nit: the class doc comment calls the version the "second argument to the constructor"; it is the third. It can be fixed in review.
🤖 Generated with Claude Code
https://claude.ai/code/session_01AuTszT2gqv7nLVYrtKD4ji
drafted by Claude on behalf of Daniel Stephenson