Skip to content

Test opt-out precedence, a blank base URL and whitespace trimming - #11

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/opt-out-precedence-tests
Oct 19, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/opt-out-precedence-tests

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle: four characterization tests are added to test/test_trace_client.cpp for README "Turning it off" promises that had no assertion. No production code is changed.

  • doNotTrackOptsOutWhateverTraceUsageReportingSays — TRACE_USAGE_REPORTING=on does not cancel DO_NOT_TRACK=1, and TRACE_USAGE_REPORTING=off opts out even when DO_NOT_TRACK=0 ("Any one of these yields a client that does nothing").
  • disabledReasonIsTheFirstOptOutThatApplies — when several conditions hold, disabledReason() is the first in the documented order: "config" over "no key" and over "unavailable", "no key" over "unavailable" ("the first that applies is the reason").
  • aBlankBaseUrlIsUnavailable — an empty or all-whitespace base URL gives reason "unavailable", and report/close on it are harmless (the README lists "a blank base URL" but only the blank application name was tested).
  • surroundingWhitespaceIsNotSent — whitespace around the base URL, application and key is not sent in the path, Authorization, User-Agent or JSON body (current behaviour of TraceClient::start).

All four are registered in main()'s tests[] table.

Test plan

  • make test (g++, C++11, -Wall -Wextra -pedantic -Werror): 50 tests, 0 failed checks (46 before + 4 new)
  • make test STD=c++20: 50 tests, 0 failed checks
  • CI Build matrix (linux, linux-libcurl, linux-sanitizers, macos, windows) green on the PR head

Skipped issues

No tracking issue — gap found during triage.

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

@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (anchored on CI run 39242533100 and local make test):

  • Scope: PASS — the only file changed is test/test_trace_client.cpp. It adds 4 test functions and 4 tests[] entries, with no production or doc change.
  • Tests-new: PASS (n/a) — no new public method or function is added.
  • Tests-fix: n/a — this is a characterization-only Stage B cycle with no bug fix. All four tests pass against the unchanged header.
  • Sibling structure: PASS — the tests are static void sentence-named functions using CHECK/CHECK_EQ and StubServer. They sit beside the existing opt-out tests (after environmentWinsOverTheConfigFlagAndTheKey).
  • Sibling renames: n/a — nothing is renamed.
  • Docs: PASS — no behaviour changed. The README "Turning it off" claims these tests check ("any one of these", "the first that applies is the reason", "a blank base URL") were re-read against TraceClient::init (trace_client.hpp:1078-1086) and match.
  • Issue resolution: n/a — there is no Closes. TRACE_CLIENT_CURL override is ignored on Windows when System32\curl.exe exists #1 was skipped because it needs an owner decision, and that is recorded in the PR body.
  • CI: PASS — all 11 jobs are green: linux ×6, linux-libcurl, both linux-sanitizers jobs, macos and windows.
  • Registered: PASS — each new name appears twice in the file. The run printed 50 tests, 0 failed checks, up from 46.
  • C++11: PASS — local make test (c++11, -Werror) and STD=c++20 are both clean, and the CI c++11 legs are green.
  • No new dependency / Never throws / Curl argv fixed / Version triple: PASS (n/a) — trace_client.hpp, Makefile and CMakeLists.txt are untouched.
  • Sanitizers: PASS — thread and address,undefined are green.

Judgment note: surroundingWhitespaceIsNotSent pins behaviour the README does not promise in so many words. It covers trimming of the base URL, application and key in TraceClient::start (trace_client.hpp:1110-1123). It locks in current behaviour as a regression guard; if that trimming is ever deliberately dropped, this test should change with it.

Summary: 4 characterization tests are added for opt-out precedence, a blank base URL and whitespace trimming. CI is green. No findings block merge.

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


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 791d318 into main Oct 19, 2026
11 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/opt-out-precedence-tests branch October 19, 2026 11:10
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