Skip to content

Tag every event with the program's version (0.2.0) - #2

Merged
dmccoystephenson merged 1 commit into
mainfrom
program-version-on-every-event
Sep 30, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
program-version-on-every-event

Conversation

@dmccoystephenson

@dmccoystephenson dmccoystephenson commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Every event the C# client sends now carries the program's own version as the tag version, mirroring trace-client-java PR #5.

  • The constructor takes the program's version as a required third argument, right after the application name:
    new TraceClient(baseUrl, "my-game", "1.4.0", key: ..., enabled: ..., log: ...).
    It is trimmed; null, blank, or longer than 255 characters after trimming throws ArgumentException.
  • Every event is tagged version = that value. An event's own version tag wins. The caller's tags are copied (WithVersion), never modified.
  • TraceClient.Disabled() still constructs, with an internal placeholder version.
  • The User-Agent still carries the client's version.
  • The version tag counts toward the server's 32-tag limit, so an event may now carry 31 tags of its own (the size test was updated accordingly, as in the Java change).
  • Breaking change: 0.1.0 → 0.2.0 (the Version constant, csproj, file header, README).

Note for consumers: a 0.1.0 call that passed the key positionally (new TraceClient(url, app, key)) would now compile with the key in the version slot. The README example passes key, enabled and log by name, and the upgrade note says so.

Docs

README example passes the version; new "Every event carries the program's version" section; wire-format example and the XML doc comment example no longer hand-tag version on startup.

Testing

  • dotnet test -c Release -p:IncludeNetFramework=false (the CI Linux leg, .NET SDK 8.0.424): 50 passed, 0 failed. Existing tests were moved to the new signature and expected bodies; new tests cover the trimmed version on a command event, an event's own version winning, the caller's dictionary not being mutated, and null/blank/overlong versions being rejected.
  • The .NET Framework 4.8 leg runs on Windows only and was not run locally; CI is the check there.
  • Mutation probes: removing the injection in Report failed 5 of 50 tests; ignoring an event's own version failed 1; removing the version validation/trimming failed 2. Each was restored and the suite returned to all passing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AuTszT2gqv7nLVYrtKD4ji


drafted by Claude on behalf of Daniel Stephenson

The constructor now takes the program's own version as a required third
argument, right after the application name. It is trimmed; null, blank, or
longer than 255 characters after trimming throws ArgumentException. Every
event is sent with the tag `version` set to it, unless the event carries its
own `version` tag, which wins. The caller's tags are copied, never modified.
TraceClient.Disabled() uses an internal placeholder version. The User-Agent
still carries the client's version.

Mirrors trace-client-java PR #5. Breaking change: 0.1.0 -> 0.2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AuTszT2gqv7nLVYrtKD4ji
@dmccoystephenson
dmccoystephenson force-pushed the program-version-on-every-event branch from 03217d1 to d5fd1c3 Compare September 30, 2026 03:29
@dmccoystephenson
dmccoystephenson merged commit 98ad213 into main Sep 30, 2026
2 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