Skip to content

Test that no log message contains the key - #34

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/test-key-never-logged
Nov 11, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/test-key-never-logged

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle. The README section on the log callback promises that "the client does not write the key into any message", while a failed delivery's message carries the report's whole JSON body. No test held the client to that promise.

  • Adds Log_NeverContainsTheKeyOnAnyPathThatLogs. Every message kind the client logs is driven with a sentinel key: trace server answered 401 (a rejecting server), could not deliver (nothing listening, and the request cancelled when Close times out), dropped (an oversize name), queue full, dropped, and close timed out. Each kind is asserted to have been logged, so the check cannot pass vacuously, and no message may contain the key.
  • Characterization only: production code is unchanged.

Deferred issues

Docs sweep

The README ("What Report promises", "Turning it off", "The wire format", "Getting it", "Building"), the class and member XML docs, the csproj comment and <Version>, and the build.yml / test csproj comments were checked against the source. No drift was found.

Test plan

  • Build workflow green on ubuntu-latest (net8.0)
  • Build workflow green on windows-latest (net8.0 + net48)
  • The new test runs on each target framework (dotnet is not installed in the dispatch sandbox, so CI is the only anchor)

No tracking issue: the gap was 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

The README promises the client writes the key into no message, while a
failed delivery's message carries the whole body. Every message kind the
client logs is now driven with a sentinel key: a rejecting server, an
unreachable one, an oversize name, a full queue and a close that times out.

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

Copy link
Copy Markdown
Member Author

Self-review rubric (head feature/test-key-never-logged, CI run 42948459959):

  • Scope: PASS. Only tests/TraceClient.Tests/TraceClientTest.cs is modified (gh pr diff 34 --name-only), and the change is one new [Fact].
  • Tests-new: PASS (not applicable). No public member is added.
  • Tests-fix: not applicable. This is a characterization test with no production fix. Its non-vacuity is checked inside the test: each of the five message kinds must appear in the log before the key's absence is asserted.
  • Sibling structure: PASS. It follows the neighbouring Close_LogsHowManyReportsItGaveUpOn / Queue_LogsEveryReportItDropsForBeingFull pattern: a ConcurrentQueue<string> log, StubServer with status: / beforeReply:, and SpinWait.SpinUntil before release.
  • Sibling renames: not applicable.
  • Docs: PASS. The README promise under test is unchanged, and a full docs sweep against source found no drift.
  • Issue resolution: not applicable. There is no Closes, and the gap was found during triage.
  • CI: PASS. The ubuntu-latest (net8.0) and windows-latest (net8.0 + net48) jobs are green. Each target framework reports Total: 114, against 113 on main (run 42439952202), so the new test ran on all three.
  • No dependencies / single file / vendoring floor / never throws / non-blocking / environment seam / version / opt-out contract: PASS. src/ is untouched.

Judgment call flagged: the test adds about 5.5 s per framework, because the close timed out path can only be reached by waiting out TraceClient.Timeout. The same cost is already accepted in Close_LogsHowManyReportsItGaveUpOn. The queue full count depends on whether the sending thread has already taken the first flood report (4 or 5 drops), so only presence is asserted, not a count. This keeps the test free of timing flakes.

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 7c82064 into main Nov 11, 2026
2 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/test-key-never-logged branch November 11, 2026 02:50
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