Skip to content

Test an unreadable install ID file through the constructor - #20

Merged
dmccoystephenson merged 2 commits into
mainfrom
feature/install-id-read-failure-tests
Oct 29, 2026
Merged

dmccoystephenson merged 2 commits into
mainfrom
feature/install-id-read-failure-tests

Conversation

@dmccoystephenson

@dmccoystephenson dmccoystephenson commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle on the install-ID failure paths, plus one doc-comment fix found on the way.

  • Client_WithAnUnreadableFileLogsWhyAndLeavesItAlone: the "could not read" branch of ReadOrCreateInstallId was covered only through the static InstallIdFromFile (no log). It is now driven through the constructor. The test checks that the log message reads using an in-memory install ID for this process: could not read <path>: , that no "could not write" message follows (an unreadable file is not overwritten), that the directory in the way is left alone, and that the event still carries the in-memory ID.
  • Client_WhoseIdFileFailsStillConstructsWhenTheLoggerThrows: on the same path, a logger that throws is still called, but it cannot break the constructor, and the event is still delivered.
  • Report XML doc: it named only the version tag that Report adds. It now also names install (from InstallId), along with the cases where install is left off: when the event's own tags already have one, or when adding it would pass MaxTags. This matches WithInstall and the class <remarks>. Only the comment changed; behaviour is the same.

These are characterization tests only, and no production code was changed. No tracking issue exists; the gap was found during triage.

Bug found and pinned, not fixed: the first CI run showed that these messages reach the log callback as [trace] [trace] using an in-memory install ID ..., with the prefix doubled. The cause is that the constructor passes the already-prefixing Log into ReadOrCreateInstallId. Per the characterization rule, the test pins the current doubled prefix (with a comment) and the fix is tracked in #21. When #21 is fixed, that assertion should change to a single prefix.

Deferred

Test plan

  • Build workflow green on ubuntu-latest (net8.0: 91/91 passed)
  • Build workflow green on windows-latest (net8.0: 91/91, net48: 91/91 passed)

Local dotnet test could not run because the dotnet SDK is not available in this dispatch sandbox (UNVERIFIED locally). The CI matrix on the PR head (run 40801191296) is the gate.

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

Drive the "could not read" install-ID branch through a client with a log
callback: the message names the path, the directory in the way is left
alone, and the event still carries an in-memory ID. A second test pins
that a throwing logger on that path cannot break the constructor.

Also mention the install tag in Report's XML doc, which only named version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI showed the constructor's install-ID log messages carry the prefix twice.
This is a characterization cycle, so the test records current behaviour and
the bug is tracked in #21.

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

Copy link
Copy Markdown
Member Author

Self-review rubric (anchored on CI run 40801191296 on head 061a9fa):

  • Scope: PASS. Two files: InstallIdTest.cs (the two new tests plus a using) and a comment-only edit in TraceClient.cs. No reformatting or renames.
  • Tests-new: PASS (N/A). No new public member was added.
  • Tests-fix: N/A. This is a characterization cycle with no production behaviour change. The doubled-prefix bug it surfaced is pinned, not fixed (Install ID file failures are logged with a doubled [trace] prefix #21).
  • Sibling structure: PASS. The new tests follow the Client_... naming, use a _directory scratch path and the _server fixture, and close the client before asserting, like their neighbours in InstallIdTest.cs.
  • Sibling renames: N/A. Nothing was renamed.
  • Docs: PASS. The Report XML doc now names install next to version, matching WithInstall (skipped when the tags already carry one, or when adding it would pass MaxTags) and the class <remarks>. The README "Every event carries a random installation ID" section already says the same.
  • Issue resolution: N/A. No Closes; there is no tracking issue for this coverage gap.
  • CI: PASS. ubuntu-latest net8.0 ran 91/91; windows-latest ran net8.0 91/91 and net48 91/91. Both new tests ran on every target.
  • No dependencies: PASS. The csproj is untouched and the usings in TraceClient.cs are unchanged.
  • Single file: PASS. src/TraceClient still holds only TraceClient.cs and TraceClient.csproj.
  • Vendoring floor: PASS. The csproj is untouched and the net48 leg is green.
  • Never throws / non-blocking & bounded / environment seam / version / opt-out contract: PASS (N/A). There is no code change in TraceClient.cs.

Observations:

  • tests/TraceClient.Tests/InstallIdTest.cs:177 — the assertion intentionally expects [trace] [trace] .... This pins a real bug (the constructor passes the prefixing Log into ReadOrCreateInstallId, and Note prefixes it again). It was surfaced by the first CI run of this PR and filed as Install ID file failures are logged with a doubled [trace] prefix #21. The fix there should change this assertion to a single prefix, which also gives that fix its FAIL→PASS evidence.
  • src/TraceClient/TraceClient.cs:373 — the new doc sentence is long. It was kept as one sentence to match how the existing summary describes version.
  • Local dotnet test was UNVERIFIED (no SDK in the dispatch sandbox). The CI matrix on the exact head SHA served as the anchor.

Do-not-auto-merge paths: none matched. TraceClient.cs changed only in an XML comment, with no wire-format, constant, opt-out or signature change.

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 61cf14b into main Oct 29, 2026
2 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/install-id-read-failure-tests branch October 29, 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