Repository navigation
fix: keep usage reporting off once it is turned off - #263
Merged
Merged
Conversation
GARDENER_USAGE_REPORTING_ENABLED was off only for 0/false/no/off: a typo or "disabled" left reporting on, and a notify.env that existed but could not be read was treated as empty - so a file holding the opt-out turned reporting back on. The setting is now read through the trace client's allows_reporting and fails closed: only true/on/yes/1 keeps reporting on, a value set blank everywhere is off, and an unreadable notify.env is off. Unset everywhere still means on. Re-vendors trace-client-python 0.5.0, whose TRACE_USAGE_REPORTING / DO_NOT_TRACK checks fail closed too; tests that pinned the old behaviour are updated. README and docs/TESTING.md updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 of 2 tasks
dmccoystephenson
added a commit
that referenced
this pull request
Nov 20, 2026
#265) docs/TESTING.md still said only an explicit 0/false/no/off opts out and an unreadable notify.env just warns, which #263 and #264 changed: the switch fails closed, an unreadable notify.env is off, and near-miss opt-out spellings count as off. README and usage.py's docstring now also say that an environment variable saying on wins over an unreadable notify.env, as tests/test_usage.py asserts. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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
A server operator reported usage reporting turning itself back on after being disabled. Two fail-open paths in gardener's own switch are fixed here, along with the vendored client.
notify.envread as on: whennotify.envexisted but could not be read, it was treated as empty, soGARDENER_USAGE_REPORTING_ENABLED=falsein it was ignored and reporting came back on (a unit test pinned this). A file that cannot be read (OSError, or a decode error) now turns reporting off, since it may hold the opt-out; endpoint and key still fall back to their defaults. An explicittruein the environment still wins, as an operator action.not in {0,false,no,off}, so a typo ordisabledleft reporting on. It is now read through the client'sallows_reporting: onlytrue/on/yes/1keeps reporting on. A blank env var still falls through tonotify.env(the documented precedence), but a value present-and-blank with nothing behind it is now off rather than on. Unset everywhere still means the default, on.TRACE_USAGE_REPORTINGset to anything but blank or an on-value,DO_NOT_TRACKset to anything but blank or0/false/off/no, or an unreadable environment, now turns reporting off.test_only_an_explicit_no_turns_it_offandtest_a_missing_or_unreadable_config_file_means_defaults(which pinned the old behaviour) are replaced by fail-closed tests for the env var,notify.env, unclear client-wide values and an unreadable file.tests/test_trace_client.pyupdated to the 0.5.0 rules with tests forallows_reporting, unclear environment values, an unreadable environment andenabled="false".Tests
PYTHONPATH=. python3.11 -m unittest discover -s tests: 1392 tests, OK (2 skipped).integration.test_offline_observability(includes the usage-reporting opt-out end to end): 12 tests, OK.🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson