Skip to content

Test both opt-out variables together and a disabled client's silence - #18

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/test-env-combinations-and-silent-disabled
Oct 24, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/test-env-combinations-and-silent-disabled

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle. Two characterization tests are added to tests/TraceClient.Tests/TraceClientTest.cs; no production code is changed.

  • Environment_EitherVariableAloneTurnsReportingOffAndNeitherTurnsItBackOn (theory, 3 cases): TRACE_USAGE_REPORTING=on does not cancel DO_NOT_TRACK=1, DO_NOT_TRACK=0 does not cancel TRACE_USAGE_REPORTING=off, and both opt-outs together still give reason environment. Previously each variable was only tested on its own, so the OR in EnvironmentDisables() (IsOff(...) || IsYes(...)) had no guard against becoming an override.
  • DisabledClient_LogsNothingEvenForAReportItWouldHaveDropped: for each disabled reason (config, no key, environment), Report with an overlong name and with more than MaxTags tags logs nothing and sends nothing. This locks in the README promise that "a disabled client does nothing and costs nothing": Report returns before the size checks in Json().

A documentation sweep (Stage A) was run first against README.md, the TraceClient.cs header and XML docs, both csproj files and build.yml. No drift was found, so the cycle moved on to test expansion.

Skipped issues

Test plan

  • Build workflow green on ubuntu-latest (net8.0)
  • Build workflow green on windows-latest (net8.0 + net48)

dotnet could not run in the dispatch sandbox, so the local anchor is UNVERIFIED. The CI matrix on the PR head is the gate.

No tracking issue: these gaps were found while comparing the test suite against TraceClient.cs branch by branch.

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

Either environment variable alone turns reporting off, and a value in
one that is not an opt-out never cancels an opt-out in the other. A
disabled client -- whichever reason -- returns from Report before the
size checks, so it logs nothing even for a report it would have dropped.

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

Copy link
Copy Markdown
Member Author

Self-review rubric (Phase 4), anchored on CI run 40050430162 on the PR head:

  • Scope: PASS. The only file modified is tests/TraceClient.Tests/TraceClientTest.cs, with +46 lines and no other changes.
  • Tests-new: N/A, because no public member was added. Both tests target existing behaviour (EnvironmentDisables, DisabledReason, Report on a disabled client).
  • Tests-fix: N/A. This is a characterization-only cycle with no production change, so there is nothing to stash-revert.
  • Sibling structure: PASS. The naming follows Subject_BehaviourInPlainWords. The environment is set through _environment, logs are collected with log: queue.Enqueue, and every client is closed.
  • Sibling renames: N/A. Nothing was renamed.
  • Docs: PASS. The tests assert what README "Turning it off" and "a disabled client does nothing and costs nothing" already state. A full Stage A sweep found no drift.
  • Issue resolution: N/A. No Closes. Non-ASCII application name drops every report on .NET 5+ (User-Agent header) #12 was skipped as a wire-format contract decision.
  • CI: PASS. ubuntu-latest net8.0 shows 87/87, and windows-latest shows 87/87 on net8.0 and 87/87 on net48. The latest main run had 83, so the 3 theory cases and 1 fact executed on every target.
  • No dependencies / single file / vendoring floor / environment seam / version agreement / opt-out contract: PASS. src/ is untouched.
  • Never throws / non-blocking & bounded: N/A, because production code is unchanged.

Observations:

  • tests/TraceClient.Tests/TraceClientTest.cs, new DisabledClient_LogsNothingEvenForAReportItWouldHaveDropped: the final Assert.Empty(_server.Received) is trivially true, since nothing could have been queued. It is kept only as a guard alongside the log assertion. No timing-sensitive assertion was introduced.
  • The local dotnet anchor could not run in the dispatch sandbox (UNVERIFIED locally). The CI matrix on the head SHA served as the gate.

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 71136ee into main Oct 24, 2026
2 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/test-env-combinations-and-silent-disabled branch October 24, 2026 01:36
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