Skip to content

Send a random installation ID with usage reports (trace-client-python 0.4.0) - #34

Merged
dmccoystephenson merged 1 commit into
mainfrom
trace/install-id
Oct 3, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
trace/install-id

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

The vendored trace client is re-vendored at trace-client-python 0.4.0 (the released file, with the repo's existing vendoring note and import path kept; its upstream test suite is re-vendored with it). The program now passes a per-installation ID, so trace can count installations instead of raw events.

  • What is sent: every event also carries the tag install, a random UUID. It is not derived from the machine, the user or an address; it only says "these events came from the same installation".
  • Where it lives: trace-install-id under the user data directory: $XDG_DATA_HOME/patchwork/ (or ~/.local/share/patchwork/) on Linux, ~/Library/Application Support/patchwork/ on macOS, %APPDATA%\patchwork\ on Windows. Patchwork has no per-user data directory of its own (settings.json and environments.json are in the working directory), so the shared convention is used. Deleting the file resets the ID. Setting the environment variable TRACE_INSTALL_ID (non-blank) sends that value instead, which lets an operator pin an ID.
  • Opt-outs first: the ID and the file path are handed to the client, which resolves them only after its own opt-out checks; a disabled client (settings switch, TRACE_USAGE_REPORTING=off, DO_NOT_TRACK=1) never creates, reads or sends it. The standalone install_id_from_file helper is not called.
  • Wiring: installIdFile() in usage_reporting.py computes the path; buildClient passes install_id=os.environ.get("TRACE_INSTALL_ID") and install_id_file=installIdFile(). The first-run notice now mentions the ID.
  • README: the Usage reporting section now says an installation ID is sent, where it is stored, that deleting the file resets it, and that the opt-outs stop it.
  • Tests: The CI steps (py_compile of the listed modules, then python -m unittest discover -s tests) pass locally on Python 3.12: 122 tests OK. tests/test_usage_reporting.py now points the user data dir into a temp dir for every test, expects the install tag, and covers the file being created and reused, TRACE_INSTALL_ID winning, the per-platform paths, and no file under the settings and environment opt-outs.

🤖 Generated with Claude Code

https://claude.ai/code/session_014ztkfamsbEqQfcu76me5SL


drafted by Claude on behalf of Daniel Stephenson

… 0.4.0)

Re-vendors trace-client-python at 0.4.0 and passes it a per-installation
ID: TRACE_INSTALL_ID when set, otherwise a trace-install-id file the
client creates (only when reporting is on). The README says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014ztkfamsbEqQfcu76me5SL
@dmccoystephenson
dmccoystephenson merged commit fa58b5c into main Oct 3, 2026
1 check passed
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