Repository navigation
Report usage to trace - #29
Merged
Merged
Conversation
Reporting only happened when PATCHWORK_USAGE_REPORTING_KEY was set, so in practice patchwork never reported. The program key now ships in usage_reporting.py and in the settings.json block written on first run; the environment variable still overrides it. The first-run notice says reporting is on, and creating a new environment reports environment-created. The settings.json opt-out and the TRACE_USAGE_REPORTING / DO_NOT_TRACK opt-outs are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012tRTngcEmZUaiHKcX2ErSS
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.
Patchwork was wired to trace in #26, but no program key was shipped: an event was only sent when
PATCHWORK_USAGE_REPORTING_KEYwas set, so no installation ever reported. The program's key is now shipped by default (keys identify a program and are not secrets, per trace's ADR 0001), the environment variable is kept as an override, and the first-run notice now says reporting is on instead of "available when ... is set". Anenvironment-createdevent is also reported when a new environment is created through Viron. The opt-outs are unchanged:"usage_reporting": {"enabled": false}insettings.json,TRACE_USAGE_REPORTING=offandDO_NOT_TRACK=1.usage_reporting.py:DEFAULT_KEYadded and written into the first-runsettings.jsonblock; the key is taken fromPATCHWORK_USAGE_REPORTING_KEY, then the settings block, then the shipped key, so asettings.jsonwritten before this change still reports; the notice uses the on-by-default wording used by apex.main.py: the client returned bystartUsageReportingreportsenvironment-createdafter a new environment is recorded. Directmain()calls still report nothing.tests/: the first-run block, the notice wording, the key precedence and the new event are covered; every test runs against a loopback stub or reports nothing.README.md: the## Usage reportingsection describes reporting as on by default and lists both events and every opt-out.Verified:
python3 -m unittest discover -s testspasses (87 tests, Python 3.8). A local run against a loopback stub receivedstartup(tagversion) andenvironment-createdforpatchworkwith the shipped key. One event taggedci=trueandverify=truewas sent to production with the shipped key and was accepted with HTTP 201.🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson