Skip to content

Test install_id_file with a Path object and an existing empty file - #19

Merged
dmccoystephenson merged 1 commit into
mainfrom
trace/test-pathlike-install-id-file
Oct 19, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
trace/test-pathlike-install-id-file

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle, scoped to the installation-ID file path. Characterization tests only; no production code changed.

  • test_install_id_file_accepts_a_path_object — install_id_file= and TraceClient.install_id_from_file are both annotated Union[str, os.PathLike[str]], but every existing test passed a str. The new test passes a pathlib.Path (with a parent directory that does not exist yet) and checks that the ID is written, read back, used by the constructor, and sent as the install tag.
  • test_install_id_from_file_writes_an_id_into_an_existing_empty_file — the branch where the file exists but holds no lines had no test. The test checks that a fresh UUID is written into it.

No tracking issue — gap found during triage.

Skipped issues

Java parity

No Java-visible behavior changed (tests only).

Test plan

  • python3 -m unittest -v locally on Python 3.8.10: Ran 56 tests, OK
  • CI test (3.8), test (3.10), test (3.12) green

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

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

Copy link
Copy Markdown
Member Author

Self-review rubric (PR #19):

  • Scope: PASS — only tests/test_trace_client.py is modified (one import pathlib plus two tests); no production, doc or config file touched.
  • Tests-new: PASS — no new public names; the two tests cover the os.PathLike half of the install_id_file/install_id_from_file signature and the existing-but-empty-file branch, neither of which had a test before.
  • Tests-fix: N/A — characterization tests only, no bug fix in scope.
  • Sibling structure: PASS — both tests sit in the per-installation-ID section of TraceClientTest, use _tmpdir()/_sent_tags(), and close the enabled client they build (via _sent_tags).
  • Sibling renames: N/A — nothing renamed.
  • Docs: PASS — tests only; README and docstrings already describe this behavior (Union[str, os.PathLike[str]], "does not exist or holds no such line").
  • Issue resolution: N/A — no Closes; gap found during triage. The version tag is added even when it pushes an event past MAX_TAGS #16 deferred (needs a coordinated decision with trace-client-java).
  • CI: PASS — test (3.8), test (3.10), test (3.12) all green on the PR head.
  • Stdlib-only: PASS — the only added import is pathlib.
  • Py3.8 floor: PASS — test (3.8) green; Path.read_text(encoding=) exists in 3.8. Ran locally on 3.8.10 as well: Ran 56 tests, OK.
  • Never-raises / never-blocks, Log level, Version agreement, Exports: N/A — no production code changed.
  • Java parity noted: PASS — the PR body says no Java-visible behavior changed.

Judgment note: tests/test_trace_client.py — open(path, "w", encoding="utf-8").close() creates the empty file without a with block. It is a one-line touch-and-close, so it was left as is. Neither test exercises the Pyodide path, which CI never runs anyway.

Summary: tests-only PR, anchor green, no do-not-auto-merge path touched — ready to merge.

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 e94d956 into main Oct 19, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the trace/test-pathlike-install-id-file branch October 19, 2026 09:47
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