Skip to content

Carry the program's version on every event (0.2.0) - #3

Merged
dmccoystephenson merged 2 commits into
mainfrom
program-version-on-every-event
Sep 30, 2026
Merged

dmccoystephenson merged 2 commits into
mainfrom
program-version-on-every-event

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Every event sent by the C++ client now carries the program's own version, mirroring Stephenson-Software/trace-client-java#5.

Changes

  • TraceClient takes the program's version as a required argument right after the application name:
    trace_client::TraceClient trace(baseUrl, "MyGame", MYGAME_VERSION, key, enabled, logger);
  • The version is trimmed and sent as the tag version on every event (startup, command, anything else). An event's own version tag wins; the caller's Tags are never modified (the merge is done on a copy, detail::withVersion). The client has no other default tags.
  • A blank version, or one over 255 bytes after trimming, is not an exception: the header promises that nothing in the client throws, and a blank base URL or application name is already handled by disabling the client with reason "unavailable". A bad version follows that same convention.
  • The default-constructed (disabled) client holds the placeholder version "disabled".
  • The User-Agent is unchanged and still names the client's version (trace-client-cpp/0.2.0 (<application>)).
  • Breaking: TRACE_CLIENT_VERSION 0.1.0 → 0.2.0 (header banner, macro, README wire format; a VERSION 0.2.0 was added to the CMake project()). Old 3–5 argument calls fail to compile rather than silently shifting arguments (bool does not convert to std::string).
  • README: example passes the version, a new "Every event carries the program's version" section, wire-format example and the disabledReason()/enabled argument notes updated. The header doc comment no longer hand-tags version on startup.

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.
  • ASan+UBSan (g++): 26 tests, 0 failed checks.
  • CMake build + ctest: 1/1 passed.
  • Not run locally (toolchain missing on the machine used): clang++, TSan, macOS, MSVC. CI covers these.

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 own version, 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

dmccoystephenson and others added 2 commits September 29, 2026 21:27
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
@dmccoystephenson
dmccoystephenson merged commit f70ed16 into main Sep 30, 2026
11 checks passed
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