Keep report() from raising on a non-string name and the sender alive on a scheme-less URL - #4
Open
dmccoystephenson wants to merge 1 commit into
Open
dmccoystephenson wants to merge 1 commit into
dmccoystephenson wants to merge 1 commit into
Conversation
…on a scheme-less URL report() checked the name before its try, so report(123) raised AttributeError into the host program. _send() built the Request before its try, so a base_url with no scheme killed the sender thread with a traceback on stderr. Both now fall inside the existing try and are logged at DEBUG like every other dropped report. Closes #2 Closes #3 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Member
Author
|
Self-review rubric (checked against CI run 35967784767 on the PR head):
Observations outside the diff:
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
report(): the blank-name check was moved inside the existingtry. A non-string name such asreport(123)used to raiseAttributeErrorinto the host program. Now it is dropped and logged at DEBUG (could not queue 123: ...), which is what the README's "Never raises" promise says happens._send(): theurllib.request.Requestis now built inside the existingtry. Abase_urlwith no scheme ("trace.example.org") used to makeRequest.__init__raiseValueErroron the sender thread, which killed the thread and printed a traceback to the host's stderr. Now each report is logged at DEBUG ascould not deliverand the thread keeps running.Closes #2
Closes #3
Test plan
python3 -m unittest -von Python 3.8.10: 23 tests ran, OKtrace_client.pychange stashed,test_report_does_not_raise_for_a_name_that_is_not_a_stringerrors (AttributeError) andtest_a_base_url_without_a_scheme_is_logged_not_a_dead_threadfails (threading.excepthookreceived theValueError). Both pass once the change is restored.Build:test (3.8),test (3.10),test (3.12)Java parity
No Java-visible behavior changed: the wire format, the opt-out values and the
disabled_reasonstrings are untouched. Both fixes cover inputs specific to Python (untypedname, and URL parsing that happens lazily on the sender thread). Nothing has to be done in trace-client-java.Notes
ubuntu-latestis covered by CI. Nothing in this diff depends on the platform or on Pyodide.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