Skip to content

Freeze the install-ID file loader's behaviour in fixtures - #53

Merged
dmccoystephenson merged 1 commit into
mainfrom
test/install-id-fixtures
Nov 21, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
test/install-id-fixtures

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

The fleet's release automation checks, before every release of a trace client, that the install-ID file loader still treats files written by earlier releases the same way. This PR adds what that check needs.

What was added

  • src/test/resources/install-id-fixtures/: the shared corpus of 20 install-ID files (the same corpus used for trace-client-python, minus the directory case git cannot hold), plus expected.txt, which records the outcome for each one: loaded <id>, replaced or kept. A .gitattributes line marks the directory binary so CRLF, BOM and non-UTF-8 bytes are stored exactly (checked with git show HEAD:…/crlf.id | xxd showing 0d0a and bom.id starting efbbbf).
  • InstallIdFixturesTest: fails if the *.id files and the files expected.txt names differ. Each fixture is copied into a fresh temp directory and passed to TraceClient.installIdFromFile(File). For loaded, the ID must match and the bytes must be unchanged. For replaced, the result must be a lowercase uuid4 and the file must now hold exactly that ID plus \n. For kept, the bytes must be unchanged and the result must be a fresh uuid4 that is not in the file.
  • VersionConsistencyTest: checks that the pom.xml project version matches the trace-client X -- header, VERSION = "X", TraceClient.VERSION and the README <version>X</version> snippet, and that each of these appears exactly once.
  • README: a short note that released fixtures are frozen.

The client source and the version are unchanged.

Measured classification

Every line of expected.txt was measured, not assumed. A throwaway harness outside the repository ran the loader on each fixture, first at the 0.8.0 tag and then at main. Both gave identical results:

  • loaded: comment-first (real-id), created, crlf, first-of-two (first-id), invalid-lines-first (third.is-valid), leading-blank-lines, max-length, padded, plain, tabs, trailing-newline, uppercase-uuid (case preserved)
  • replaced: bad-chars, bom, empty, non-ascii, too-long, whitespace-only
  • kept: not-utf8, id-then-not-utf8 (the whole file is decoded strictly as UTF-8 before any line is looked at, so a bad byte after a valid ID still makes the file unreadable)

This matches trace-client-python's classification of the same corpus exactly. No differences were found.

Testing

mvn -B verify was run locally on JDK 21: 128 tests, 0 failures. To confirm the new test catches changes, two deliberate breakages were tried and both made it fail: an extra unlisted fixture, and a wrong outcome line. CI runs the suite on Java 8, 17 and 21.

drafted by Claude on behalf of Daniel Stephenson

🤖 Generated with Claude Code

Adds the shared install-ID fixture corpus under
src/test/resources/install-id-fixtures with an expected.txt measured
against the 0.8.0 release, InstallIdFixturesTest to hold the loader to
it, and VersionConsistencyTest to keep pom.xml, TraceClient.java and the
README snippet on one version. The fixtures are stored as binary so
CRLF, BOM and non-UTF-8 bytes survive exactly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson
dmccoystephenson merged commit 1a27378 into main Nov 21, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the test/install-id-fixtures branch November 21, 2026 05:06
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