Skip to content

fix: count a near-miss usage-reporting opt-out as off - #264

Merged
dmccoystephenson merged 1 commit into
mainfrom
fix/usage-reporting-near-miss-opt-out
Nov 19, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
fix/usage-reporting-near-miss-opt-out

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

What

A usage-reporting opt-out that is not spelled exactly GARDENER_USAGE_REPORTING_ENABLED is now counted as off (has_near_miss_opt_out in gardener/usage.py). Any name that normalises (lower case, letters and digits only) to something containing "usagereport" is checked:

  • spelling "enabled" another way (GARDENER_USAGE_REPORTING_ENABLE, gardener_usage_reporting_enabled, Gardener-Usage-Reporting-Enabled) or the bare name (GARDENER_USAGE_REPORTING, USAGE_REPORTING) with a value that is not clearly on;
  • spelling "disabled" (GARDENER_USAGE_REPORTING_DISABLED) with a value that is on.

It is applied to notify.env and to the environment (there only to names that mention gardener, so another program's FISHE_USAGE_REPORTING_ENABLED=false or ROAM_USAGE_REPORTING=0 does not switch gardener off). A near-miss wins over the real setting saying on. ..._ENDPOINT and ..._KEY are never read as a switch. gardener never writes notify.env, so there is no save path to change.

One existing test pinned TRACE_USAGE_REPORTING=off written in notify.env as "on" (the client-wide variables are environment-only). Under the near-miss rule that line now counts as an opt-out; the test was updated (DO_NOT_TRACK=1 in notify.env is still not read). An unreadable notify.env still leaves an explicit GARDENER_USAGE_REPORTING_ENABLED=true in the environment in charge, as before.

Why

A real-server repro showed that an opt-out written under another spelling was not recognised: it was treated as missing, reporting stayed on by default, and the program reported. Reference fix (Java): Dans-Plugins/Medieval-Roleplay-Engine#418

Tests

New tests cover eight near-miss opt-outs in notify.env (each off, also over the real switch saying on in the file or the environment, and in the environment for gardener-named ones), six lines that must stay on (including endpoint/key), and other programs' switches in the environment being ignored. README updated.

Python 3.12, PYTHONPATH=. python -m unittest discover -s tests: 1395 tests, OK (2 skipped).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LYNeupL3KtraCJoZMADVQE


drafted by Claude on behalf of Daniel Stephenson

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYNeupL3KtraCJoZMADVQE
@dmccoystephenson
dmccoystephenson merged commit 3817789 into main Nov 19, 2026
5 checks passed
@dmccoystephenson
dmccoystephenson deleted the fix/usage-reporting-near-miss-opt-out branch November 19, 2026 14:54
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>
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