Skip to content

Test that a blank InstallId file path means no installation ID - #34

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/test-blank-install-file
Nov 16, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/test-blank-install-file

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • A Stage B (unit-test expansion) test is added: aBlankInstallIdFileMeansNone. It checks that InstallId::fromFile("") and InstallId::fromFile(" \t ") on an enabled client make up no ID (installId() is empty), send no install tag, and write no file named by the whitespace into the working directory.
  • The rule was documented on InstallId::file ("Blank means none", trace_client.hpp:930) and enforced by the isBlank(install.file) check in init (trace_client.hpp:1171), but no test asserted it. The existing blank-ID test covers only InstallId::of(" \t "), and installIdFromFile("") is tested only as a direct call, where it returns a fresh in-memory UUID.
  • This is characterization only: production code is unchanged.

Triage notes

No tracking issue: the gap was found during triage.

Test plan

  • make test (g++, C++11, -Wall -Wextra -pedantic -Werror) passed locally with 77 tests, 0 failed checks. That is up from 76, and the new test is registered in tests[].
  • Mutation check: with the isBlank(install.file) guard replaced by true, the new test failed in four ways. installId() was non-empty, an install tag was sent, and a file named " \t " appeared in the working directory. With the header restored, the test passes.
  • CI: linux (g++/clang++ × c++11/17/20), linux-libcurl, linux-sanitizers, macos, windows. clang++ is not installed locally, so the clang legs are covered only by CI.

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

InstallId::file documents "Blank means none", and the constructor skips
installIdFromFile for a blank path, but nothing asserted it. Without that
check a blank path would make up an in-memory ID and a whitespace-only
path would write a file of that name into the working directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (scored against the diff and CI run 43795307253):

  • Scope: PASS. One file was changed: test/test_trace_client.cpp, +24 lines and nothing deleted. Production code is unchanged.
  • Tests-new: PASS. No public API was added. The new test exercises InstallId::fromFile with blank paths, and the constructor's isBlank(install.file) branch (trace_client.hpp:1171).
  • Tests-fix: N/A, since this is not a bug fix. A mutation check was run instead. With the guard replaced by true, the new test failed at lines 1626, 1631 and 1635 (non-empty installId(), a file " \t " written to the working directory, an install tag sent). With the header restored, it passes.
  • Sibling structure: PASS. The test sits in the installation ID section, next to aBlankInstallIdMeansNoneAndAnOverlongOneIsRejected. It uses the existing StubServer, exists and CHECK_EQ helpers, and its body assertion has the same form as its neighbour's.
  • Sibling renames: N/A. Nothing was renamed.
  • Docs: PASS. No behaviour changed. A Stage A sweep of the README, header comments, Makefile, CMakeLists.txt and build.yml found no untracked drift. The only false claim, "tags always holds at least version", is tracked in The version tag is dropped when an event's own tags fill the 32-tag cap #21.
  • Issue resolution: N/A. There is no Closes, because the gap was found during triage.
  • CI: PASS. All 11 jobs are green on head 1483b22.
  • Registered: PASS. aBlankInstallIdFileMeansNone occurs twice: once as a definition and once in tests[]. The local run printed 77 tests, 0 failed checks, up from 76.
  • C++11: PASS. make test (C++11, -Werror) built clean locally, and both linux c++11 legs are green.
  • No new dependency / Never throws / Curl argv fixed / Version triple: PASS. Neither trace_client.hpp nor the build files were touched.
  • Sanitizers: PASS. linux-sanitizers (thread; address,undefined) are both green.

Finding, not blocking: test/test_trace_client.cpp:1631. CHECK(!exists(" \t ")) resolves the path relative to the test binary's working directory, which is the repo root under make test. If the guard ever regresses, the failing run will also leave that stray file behind. The check is kept because a written file is the most harmful result of such a regression; the file is visible in git status as untracked.

This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 11037b0 into main Nov 16, 2026
11 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/test-blank-install-file branch November 16, 2026 02:59
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