Skip to content

Test that a None install tag does not suppress the installation ID - #44

Merged
dmccoystephenson merged 1 commit into
mainfrom
trace/install-tag-none-characterization
Nov 16, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
trace/install-tag-none-characterization

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle: one characterization test for how an event's own install tag interacts with the client's installation ID.

  • report() runs _with_version (which drops None-valued tags and stringifies the rest) before _with_install. As a result, an event passing tags={"install": None} still carries the client's ID, the same way {"version": None} still carries the program version (already covered by test_report_drops_none_tags_and_stringifies_the_rest_before_adding_the_version).
  • No test guarded that order for install. If the two merges were swapped, install would be seen as present, no ID would be added, and the None would then be dropped, so the event would carry no install tag and no test would fail. That breaks the README promise that tags holds install whenever the client has an ID.
  • The new test also confirms that a non-None value of another type (7) is the event's own tag, sent as "7", and wins over the client's ID.

No production code is changed, and no Java-visible behavior changed.

Skipped issues

Test plan

  • python3 -m unittest locally: Ran 80 tests, OK
  • Regression proof: with the merge order in report() temporarily swapped, the new test failed ({'version': '1.2.3'} sent, no install). With the source restored, it passed.
  • CI test (3.8), test (3.10), test (3.12) green

No tracking issue. The gap was found during the Stage B coverage comparison.

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

report() drops None-valued tags before adding install, so an event passing
install=None still carries the client's ID, as one passing version=None
still carries the program version. Nothing guarded that order: merging
install before dropping None tags would silently send no install tag.

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

Copy link
Copy Markdown
Member Author

Self-review rubric (CI anchor green on a2fce70: test (3.8), test (3.10), test (3.12) all pass):

  • Scope: PASS — the diff touches only tests/test_trace_client.py (+9 lines, one new test). No production, docs, or config change.
  • Tests-new: PASS (n/a) — no new public names. The test exercises report() through the loopback server via _sent_tags.
  • Tests-fix: PASS (characterization) — with report()'s merge order temporarily swapped (_with_install before _with_version), the new test failed with {'version': '1.2.3'} sent and no install. With the source restored, it passed. The production file is unchanged on the branch.
  • Sibling structure: PASS — placed next to test_an_events_own_install_tag_wins. It uses _sent_tags, clears capture.arrived between clients (as test_install_tag_never_pushes_an_event_past_the_tag_cap does), and every client is closed by _sent_tags.
  • Sibling renames: PASS (n/a) — nothing renamed.
  • Docs: PASS — the README ("An event that passes its own install tag keeps it"; "A tag whose key or value is None is left out") already describes the asserted behavior. No doc change needed.
  • Issue resolution: PASS (n/a) — no Closes. The gap was found during the Stage B coverage comparison.
  • CI: PASS — all three matrix jobs green on the head SHA.
  • Stdlib-only: PASS — no new imports.
  • Py3.8 floor: PASS — test (3.8) green.
  • Never-raises / never-blocks, Log level, Version agreement, Exports: PASS (n/a) — no production code touched.
  • Java parity noted: PASS — the PR body states that no Java-visible behavior changed.

Observation outside the diff: the test pins current behavior only. The open question in #16 (version and the MAX_TAGS cap) is not touched.

This 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 0049ea5 into main Nov 16, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the trace/install-tag-none-characterization branch November 16, 2026 09:15
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