Skip to content

Log install ID file failures with a single [trace] prefix - #22

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/single-trace-prefix-install-id
Oct 30, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/single-trace-prefix-install-id

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • TraceClient.cs: the constructor now passes the program's raw log callback (_log) to ReadOrCreateInstallId instead of the instance Log method. Log wraps Note, which adds the [trace] prefix, so install ID file failures were logged as [trace] [trace] using an in-memory install ID .... Note already guards against a null or throwing logger, so no protection is lost.
  • InstallIdTest.Client_WithAnUnreadableFileLogsWhyAndLeavesItAlone: the assertion that pinned the doubled prefix (added in Test an unreadable install ID file through the constructor #20) now expects a single prefix.
  • InstallIdTest.Client_WithAnUnwritableFileStillReportsWithAnInMemoryId: the loose Contains("in-memory install ID") check is tightened to StartsWith("[trace] using an in-memory install ID for this process: could not write "), so the write path is covered as well.

No change to the wire format, the opt-outs, the public API or the README. The log message wording stays the same; only the duplicate prefix is removed.

Test plan

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

dotnet is not available in the dispatch sandbox, so nothing was run locally. CI on the PR head is the anchor.

Deferred

Closes #21

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 constructor handed the instance Log method to ReadOrCreateInstallId,
which reports through Note, so the prefix was added twice. Pass the raw
callback instead; Note already guards against a null or throwing logger.

The read-path test that pinned the doubled prefix now expects one, and
the write-path test checks the full single-prefixed message.

Fixes #21

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

Copy link
Copy Markdown
Member Author

Self-review rubric (one pass, anchored on CI run 40985877536):

  • Scope: PASS — two files: the one-line call-site change in src/TraceClient/TraceClient.cs and the two assertions in tests/TraceClient.Tests/InstallIdTest.cs that cover it.
  • Tests-new: PASS (n/a) — no public member added.
  • Tests-fix: PASS, via fallback-ladder rung 2. dotnet is unavailable in the dispatch sandbox, so the stash-and-run could not be performed locally. The pre-existing test Client_WithAnUnreadableFileLogsWhyAndLeavesItAlone asserted the old behaviour, StartsWith("[trace] [trace] using an in-memory install ID ..."), and was green on main (run 40801406690). This diff changes it to StartsWith("[trace] using ..."), which the doubled string cannot satisfy. That is a recorded FAIL→PASS for the read path. The tightened write-path assertion has no before/after evidence of its own, but it exercises the same call-site change.
  • Sibling structure / renames: PASS (n/a) — no new files and no renames.
  • Docs: PASS — README has no mention of the [trace] prefix or the install-ID log messages. The XML docs for InstallIdFromFile / InstallId do not describe log output.
  • Issue resolution: PASS — Install ID file failures are logged with a doubled [trace] prefix #21's suggested fix (ReadOrCreateInstallId(installIdFile, _log)) and its suggested test change are both applied.
  • CI: PASS — ubuntu-latest net8.0 91/91, windows-latest net8.0 91/91 and net48 91/91.
  • No dependencies / single file / vendoring floor: PASS — the csproj is untouched and no using was added.
  • Never throws: PASS — Note still null-checks and swallows a throwing logger. Client_WhoseIdFileFailsStillConstructsWhenTheLoggerThrows stays green.
  • Non-blocking & bounded, environment seam, version, opt-out contract: PASS (n/a) — none of these were touched.

Observation outside the diff: _log is assigned at src/TraceClient/TraceClient.cs:189, before the call at line 217, so it is never read uninitialized.

No judgment calls remain, so no inline findings were raised.

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


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit d5460c8 into main Oct 30, 2026
2 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/single-trace-prefix-install-id branch October 30, 2026 01:28
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.

Install ID file failures are logged with a doubled [trace] prefix

1 participant