Skip to content

Test escaping and untrimmed passthrough in every JSON string field - #37

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/test-escaping-and-untrimmed-fields
Nov 14, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/test-escaping-and-untrimmed-fields

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle, scoped to JSON string handling. Test-only; no production code is changed.

  • Quote_WritesDeleteAndTheUnicodeLineSeparatorsAsIs — U+007F, U+2028 and U+2029 are written unescaped. JSON only requires U+0000–U+001F to be escaped, so this output is valid.
  • Json_EscapesTheApplicationNameAndTagKeysLikeTagValues — quotes, backslashes and newlines in the application, the name and tag keys are escaped. Until now only tag values and bare control characters were exercised.
  • Report_SendsTheNameAndTagsUntrimmed — end to end: an event's name, tag keys and tag values are sent exactly as given. The constructor's trimming covers only the application, version and key (Constructor_TrimsTheBaseUrlApplicationAndKey).

A Stage A documentation sweep was run first (README sections, class/member XML docs, csproj comments, build.yml) and found no drift against the source, so the cycle fell back to Stage B.

Deferred issues

All three open issues are maintainer-gated contract changes, so none was picked up:

Test plan

  • CI Build, ubuntu-latest (net8.0): green, with the three new tests in the total
  • CI Build, windows-latest (net8.0 + net48): green
  • Local dotnet test could not be run because the dispatch sandbox does not allow dotnet. The CI matrix on the PR head is the gate for this PR (UNVERIFIED locally).

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

Quote was only exercised on tag values and bare control characters.
Pin that the application, name and tag keys are escaped the same way,
that DEL and U+2028/U+2029 go out unescaped (valid JSON), and that
Report sends an event's name, tag keys and tag values untrimmed, unlike
the application, version and key the constructor trims.

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

Copy link
Copy Markdown
Member Author

Self-review rubric (head of feature/test-escaping-and-untrimmed-fields):

  • Scope: PASS. The diff touches only tests/TraceClient.Tests/TraceClientTest.cs (+43 lines, three new [Fact]s). No production code, docs or project files are changed.
  • Tests-new: PASS (not applicable). No public member is added.
  • Tests-fix: PASS (not applicable). This is a characterization-only Stage B cycle and fixes no bug.
  • Sibling structure: PASS. The tests follow the Subject_BehaviourInPlainWords naming. They use the shared _server fixture and Close() before asserting, and sit next to the existing Quote_EscapesCarriageReturnAndEveryOtherControlCharacter.
  • Sibling renames: PASS (not applicable). Nothing is renamed.
  • Docs: PASS. The behaviour pinned here is already implied by the README ("written with the invariant culture" / UTF-8 body) and by the Json comment. No table needs a change. The Stage A sweep before this PR found no drift.
  • Issue resolution: PASS (not applicable). No Closes, because the gap was found during triage.
  • CI: PASS. Run 43547778798 is green on ubuntu-latest (net8.0) and windows-latest (net8.0 + net48). Each leg reports Passed: 123, Total: 123, compared with 120 on main's last run 43354995774, so all three new tests executed on every target framework.
  • No dependencies / Single file / Vendoring floor: PASS. src/ and both csproj files are untouched.
  • Never throws / Non-blocking & bounded / Environment seam / Version agreement / Opt-out contract: PASS (not applicable). No production code is changed.

Local run: UNVERIFIED. dotnet is not permitted in the dispatch sandbox, so the CI matrix on the exact head SHA served as the anchor.

Observation: Report_SendsTheNameAndTagsUntrimmed pins that names and tag keys/values are not trimmed. Whether that matches the Java/Python clients was not checked. If parity later requires trimming, this test should change on purpose.

Do-not-auto-merge check: the only path touched is tests/TraceClient.Tests/TraceClientTest.cs. It does not match any listed path; the test csproj is untouched.

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 d30178d into main Nov 14, 2026
2 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/test-escaping-and-untrimmed-fields branch November 14, 2026 02:45
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