Skip to content

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

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

What

  • test/install-id-fixtures/: the shared corpus of 20 install-ID files, plus expected.txt recording what TraceClient::installIdFromFile does with each one (loaded <id>, replaced or kept). .gitattributes marks the directory binary so the CRLF, BOM and non-UTF-8 bytes are stored and checked out exactly.
  • installIdFixturesLoadAsReleased in test/test_trace_client.cpp: copies each fixture into a fresh temp directory, calls the loader there and asserts the outcome (loaded: the ID is returned and the bytes are unchanged; replaced: a lower-case uuid4 is returned and the file is now exactly that plus \n; kept: the bytes are unchanged and a uuid4 not in the file is returned). It fails if expected.txt and the *.id files in the directory disagree.
  • theVersionIsTheSameEverywhere: the version in CMakeLists.txt must appear exactly once in each of the header banner trace-client X (C++) --, #define TRACE_CLIENT_VERSION "X" and the README's trace-client-cpp/X (.
  • The Makefile (outside CXXFLAGS, so the sanitizer job's override keeps it) and CMakeLists.txt define TRACE_CLIENT_SOURCE_DIR, so the fixtures are found from build\Release under MSVC.
  • Three README lines: released fixtures are frozen; a new case is a new fixture plus its expected.txt line.

No change to trace_client.hpp or to the version.

Why

The fleet's release automation will check, before every release, that every released fixture stays byte-identical, that every released loaded and kept line of expected.txt stays unchanged, and that CI (which runs this test) is green on the tagged commit. An ID a previous release stored must keep loading as the same ID, and an unreadable file must never be overwritten.

Measured classification

Each line was measured, not assumed: a throwaway harness outside the repository ran every fixture through installIdFromFile at tag 0.4.0 and again at main (96439f5); the results were identical.

  • loaded: comment-first (real-id), created, crlf (crlf-id), first-of-two (first-id), id-then-not-utf8 (good-id), invalid-lines-first (third.is-valid), leading-blank-lines, max-length, padded, plain, tabs, trailing-newline, uppercase-uuid
  • replaced: bad-chars, bom, empty, non-ascii, not-utf8, too-long, whitespace-only
  • kept: none

Differences from trace-client-python on the same corpus: the C++ loader reads bytes and does not decode UTF-8, so not-utf8.id is replaced (Python: kept) and id-then-not-utf8.id is loaded as good-id (Python: kept). No fixture in the corpus is kept here; the test still implements that outcome.

Testing

  • make test with g++ 9 at -std=c++11, c++17 and c++2a: 83 tests, 0 failed checks.
  • make test-libcurl: passes.
  • CMake build run from / (not the source tree): both new tests pass, confirming the fixture path resolves independently of the working directory.
  • The new tests were seen to fail when an expected.txt line was changed, an unlisted .id file was added, and the README version was altered.
  • clang++, the sanitizer jobs, macOS and MSVC are left to CI (no clang on the local box).

drafted by Claude on behalf of Daniel Stephenson

🤖 Generated with Claude Code

test/install-id-fixtures holds the shared corpus of hand-written ID files,
and expected.txt records what installIdFromFile does with each at 0.4.0
(loaded <id>, replaced or kept). installIdFixturesLoadAsReleased checks every
line and that expected.txt names exactly the fixtures present, so an ID a
release stored keeps loading as the same ID. theVersionIsTheSameEverywhere
checks the header banner, TRACE_CLIENT_VERSION and the README's User-Agent
against CMakeLists.txt. .gitattributes stores the fixtures as binary so CRLF,
BOM and non-UTF-8 bytes survive checkout; the Makefile and CMakeLists.txt
pass the source directory so MSVC finds them from build\Release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYNeumA4DYW41mYg7nCwNn
@dmccoystephenson
dmccoystephenson merged commit 83469ad into main Nov 21, 2026
11 checks passed
@dmccoystephenson
dmccoystephenson deleted the test/install-id-fixtures branch November 21, 2026 05:11
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