Repository navigation
Test the install ID file's length limit, its failure logs and an explicit ID's character set - #23
Merged
Conversation
…icit ID's character set Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (Phase 4), scored against the diff and CI on head
Judgment calls:
Summary: tests-only, additive, CI green on all three interpreters, and no do-not-auto-merge path is touched. 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) of the per-installation ID code in
TraceClient.install_id_from_fileand the constructor'sinstall_id=handling. These are characterization tests only. No production code is changed.test_install_id_from_file_takes_an_id_of_exactly_the_tag_length_limit: a line of exactlyMAX_TAG_LENGTHcharacters is accepted as the ID. Until now only the over-limit side (256) was tested. Lines with characters outside[A-Za-z0-9_.-](a slash, an inner space) are skipped, and a file that already holds an ID is not rewritten.test_install_id_file_failures_are_logged_at_debug_only: both failure branches (could not read, could not write) log one[trace]-prefixed record each, and nothing aboveDEBUG. To reach the write branch,os.makedirsis made to fail with a mock for a file that does not exist.test_explicit_install_id_is_sent_as_given_without_the_files_character_rule: an ID passed asinstall_id=is only trimmed and length-checked. It is not held to the file's character rule, which matches the constructor docstring and the README.Observation (not changed here)
test_unwritable_install_id_file_yields_an_in_memory_id_and_never_raisesputs the ID path under a regular file. That path fails on the read (NotADirectoryError), not the write, so the "could not write" branch is not what it exercises. The outcome it asserts (an in-memory ID, nothing created) holds either way, and the new log test now covers the write branch directly. The test's name could be tightened in a later cycle.Deferred
tags"always holds at leastversion" holds at theMAX_TAGScap, and the change needs to land in step with trace-client-java (see the comments on the issue).Java parity
No Java-visible behavior changed (tests only).
Test plan
python3 -m unittest -von Python 3.8.10 locally:Ran 67 tests,OKBuild:test (3.8),test (3.10),test (3.12)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