Repository navigation
Freeze the install-ID file loader's behaviour in fixtures - #48
Merged
Merged
Conversation
Adds tests/install-id-fixtures (20 ID files plus expected.txt, measured against the 0.5.0 release) and a test that checks installIdFromFile against every line, plus a version-consistency test. The API-shape test now compares TRACE_CLIENT_VERSION with package.json instead of a literal. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What was added
tests/install-id-fixtures/: 20 install-ID files (the shared corpus the other trace clients use, minus an empty directory, which git cannot hold) andexpected.txt, which records whatTraceClient.installIdFromFiledoes with each one..gitattributesmarks the directory binary so CRLF, BOM and non-UTF-8 bytes are stored exactly.tests/install-id-fixtures.test.ts: fails if the*.idfiles differ from thoseexpected.txtnames; for every line, copies the fixture into a fresh temp directory, calls the loader, and asserts the outcome (loaded: that ID returned and the file untouched;replaced: a lowercase uuid4 returned and the file now exactly that plus\n;kept: file byte-identical and a uuid4 not in the file returned).tests/version-consistency.test.ts: package.json's version must appear, exactly once each, in both root entries of package-lock.json, thetrace-client X --header andTRACE_CLIENT_VERSION = "X"in trace-client.ts, and the README'strace-client-js/X (line. The API-shape test now comparesTRACE_CLIENT_VERSIONwith package.json instead of the literal"0.5.0", so a version bump needs no test edit.No change to
trace-client.tsor to the version.Why
The fleet's release automation will check, before every future release, that each released fixture stays byte-identical, that each released
loaded/keptline ofexpected.txtstays unchanged, and that this CI is green on the tagged commit. An ID a previous release stored must keep loading as the same ID, and a file the loader cannot read must never be overwritten.Measured classification
Every line was measured with a throwaway harness against the 0.5.0 tag and then again at
main(07f6660); both agree.third.is-valid), comment-first (real-id), bom (bom-id), id-then-not-utf8 (good-id)Differences from trace-client-python (bold above):
bom.idis loaded asbom-id(Python: replaced):String.prototype.trimstrips U+FEFF.not-utf8.idis replaced (Python: kept):readFileSync(path, "utf8")decodes invalid bytes to U+FFFD instead of failing, so the file reads as holding no ID and is overwritten.id-then-not-utf8.idis loaded asgood-id(Python: kept), for the same reason.So this client has no
keptcase in the corpus; the test still supports one.Testing
npm ci && npm run typecheck && npm testpasses locally on Node 22 (117 tests). Corrupting a fixture was checked to make the fixture test fail. The committed bytes were checked withxxd(crlf.idends0d0a,bom.idstartsefbbbf).drafted by Claude on behalf of Daniel Stephenson
🤖 Generated with Claude Code