Repository navigation
Test which thread the log callback runs on - #39
Merged
Merged
Conversation
The README tells programs which thread the log callback runs on, so a Unity program knows when it may touch a main-thread-only API, but no test checked it. Pin the current behaviour: a report dropped in Report and an installation ID file that fails in the constructor are logged on the caller's thread; a rejected or undelivered report is logged on the client's own named background thread, not the caller's and not a pool thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sending thread has exited by the time the asserts run, and reading IsBackground on a dead thread throws ThreadStateException. Record the thread's ID, name and flags inside the callback instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (head
Judgment calls flagged:
Local This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stage B (unit-test expansion) cycle. The README's paragraph on the
logcallback ("runs on whichever thread hit the problem: the caller's for a report dropped inReportand for an installation ID file that fails in the constructor, and the client's background thread for a failed delivery…") is a promise Unity programs rely on, but no test checked it. Two characterization tests are added; production code is unchanged.Log_RunsOnTheCallersThreadForADropInReportAndOnTheClientsThreadForADelivery(TraceClientTest.cs): records the thread each message is logged on. An overlong name dropped inReportis logged on the calling thread. A401answer and an unreachable server are logged on a background, non-pool thread namedtrace-client/MyGame(the client's own sending thread), never on the caller's.Client_LogsAnIdFileFailureOnTheThreadThatConstructsIt(InstallIdTest.cs): an unreadable installation ID file is logged on the thread running the constructor.The README's fourth case, the
close timed outcount, is not re-covered here. It needs a server that hangs past the 5 s timeout, and the existingClose_LogsHowManyReportsItGaveUpOnalready waits that out, so adding another 5 s test only to check its thread was judged not worth the CI time. That log line comes from thecatchinDrain, which runs on the same thread as the deliveries checked above.A documentation sweep (Stage A) was also performed against
TraceClient.cs, both csproj files andbuild.yml. No drift was found in the README tables, the wire-format section, the "Building" section or the XML docs.Test plan
Buildworkflow green on ubuntu-latest (net8.0)Buildworkflow green on windows-latest (net8.0 + net48)tests/files toucheddotnetcould not be run in the dispatch sandbox, so local verification is UNVERIFIED. The CI matrix on the PR head is the anchor.Deferred issues
User-Agent), Repeated events are not coalesced, unlike trace-client-java 0.7.0 #28 (coalescing for parity with trace-client-java 0.7.0), A repeated tag key is sent twice and counted twice #31 (repeated tag keys): each changes the wire format or the behaviour contract and is waiting on a maintainer decision, so none was picked up autonomously.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