Skip to content

Test non-201 answers, sender resilience, trimming and ParamName - #9

Open
dmccoystephenson wants to merge 1 commit into
mainfrom
feature/test-status-trimming-paramnames
Open

dmccoystephenson wants to merge 1 commit into
mainfrom
feature/test-status-trimming-paramnames

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Stage B — unit-test expansion (wire-status handling, sender resilience, constructor input handling). Test-only; no production code is changed.

Summary

  • Report_TreatsAnyStatusButExactly201AsAFailure — a 200 is logged as answered 200, pinning the README promise that exactly 201 is success.
  • Report_KeepsSendingAfterAFailedDelivery — a 500 on the first report does not stop the sending thread; the next two reports are still delivered, in order, and only the failure is logged.
  • Constructor_TrimsTheBaseUrlApplicationAndKey — surrounding whitespace on baseUrl, application and key never reaches the path, Authorization, User-Agent or body.
  • Constructor_NamesTheParameterItRejects — every constructor ArgumentException carries the right ParamName (baseUrl, application, version, installId); previously only the malformed-URL case was checked.

These are characterization tests: each asserts behaviour the code already has, so they are expected to pass on the current source.

Test plan

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

Local verification: UNVERIFIED — no .NET SDK is installed in the dispatch sandbox, so the CI matrix on the PR head is the gate.

Triage notes

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

Four characterization tests for behaviour that had none: a 200 is logged
as a failure like any status but 201; a 500 does not stop the sending
thread from delivering the reports behind it; the constructor trims the
base URL, application and key before they reach the wire; and each
ArgumentException names the parameter it rejects.

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

Copy link
Copy Markdown
Member Author

Self-review rubric (posted as a comment, not an independent review):

  • Scope: PASS — gh pr diff 9 touches only tests/TraceClient.Tests/TraceClientTest.cs (+66 lines, 4 new [Fact]s); no production, doc or config change.
  • Tests-new: PASS (n/a) — no new public member; four characterization tests were added for existing members.
  • Tests-fix: n/a — no bug fix; every test asserts current behaviour, so no stash-and-revert experiment applies.
  • Sibling structure: PASS — names follow Subject_BehaviourInPlainWords, log assertions use ConcurrentQueue<string>, extra StubServers are in using blocks, every enabled client is Close()d, no bare Thread.Sleep is used for correctness.
  • Sibling renames: n/a — nothing renamed.
  • Docs: PASS — no behaviour changed; the one drift found in the repo-wide sweep (the Close() bound) is filed separately as Close() docs say it waits at most the timeout; it can wait the timeout plus 500 ms #8.
  • Issue resolution: n/a — no Closes #N; the PR body records that no tracking issue exists.
  • CI: PASS — both Build legs are green on head 17447af; the summaries show Total: 70 on net8.0 (ubuntu), net8.0 (windows) and net48 (windows), up from 66 on main at cf9c27c, so the four new tests ran 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 — no library code paths changed.

Notes:

  • tests/TraceClient.Tests/TraceClientTest.cs Report_KeepsSendingAfterAFailedDelivery — the ordering assertion depends on the client sending one request at a time and waiting for each answer (single Drain thread, synchronous SendAsync(...).GetResult()), and on StubServer enqueuing Received before it calls status(). Both hold in the current source, so the test is deterministic rather than timing-sensitive.
  • Local verification was UNVERIFIED: no .NET SDK in the dispatch sandbox. The CI matrix on the exact head SHA served as the anchor.

Summary: test-only change, green on every CI target. No findings call for changes.

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


drafted by Claude on behalf of Daniel Stephenson

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