Repository navigation
trace-client 0.3.0: every event carries the program's version - #3
Merged
Merged
Conversation
The constructor options now require `version`, the program's own version (trimmed; missing, blank or over 255 characters throws). Every event is sent with the tag `version` set to it; an event's own `version` tag wins and the caller's tags object is never modified. TraceClient.disabled() uses an internal placeholder. The User-Agent still carries the client's version. Mirrors trace-client-java 0.4.0 (PR #5). 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.
Summary
Every event the client sends now carries the program's own version as the tag
version, mirroring Stephenson-Software/trace-client-java#5 (Java 0.4.0). Breaking change, so the client is bumped to 0.3.0.TraceClientOptions.version: stringis required (typed non-optional). It is trimmed; missing, blank, or longer than 255 characters after trimming (TraceClient.MAX_VERSION_LENGTH) throws anError.startup,page-view,command, anything) is sent withtags.version= that version. An event's ownversiontag wins. The caller'stagsobject is copied, never modified. Anull/undefinedeventversionis dropped as before, so the program's version fills it (same as the Java client'swithVersion).TraceClient.disabled()still takes no arguments; it uses the internal placeholder version"disabled".User-Agentis unchanged in shape and still carries the client's version:trace-client-js/0.3.0 (<application>).TRACE_CLIENT_VERSION, the file header,package.json,package-lock.json, README and CHANGELOG. Top-level exports are unchanged.Consumer call:
Docs
README example passes
version; a new "Every event carries the program's version" section covers the requirement, the tag on every event, the event's own tag winning, and upgrading from 0.2.0 (addversion; hand-addedversiontags may be dropped). The wire-format example now showsversionintags. CHANGELOG has a 0.3.0 entry.Testing
npm run typecheck: clean. Additionally checked thatnew TraceClient(url, app)and{ key }withoutversionfail to compile.npm test: 44/44 pass. Existing tests were moved to the new signature and expected bodies; new tests cover the trimmed version on every event, an event's own version winning, the caller's tags object (plain and frozen) not being mutated, and missing/blank/non-string/overlong versions being rejected (255 after trimming accepted).withVersionmutating the caller's object in place, 2 tests fail (42/44). Both restored; 44/44 again.🤖 Generated with Claude Code
https://claude.ai/code/session_01AuTszT2gqv7nLVYrtKD4ji
drafted by Claude on behalf of Daniel Stephenson