Skip to content

fix: keep usage reporting off once it is turned off - #657

Merged
dmccoystephenson merged 1 commit into
mainfrom
fix/opt-out-fails-closed
Nov 19, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
fix/opt-out-fails-closed

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Usage reporting is made to stay off once it has been turned off, in the vendored client and in Roam's own config handling.

Changes

  • src/lib/trace_client.py is updated from trace-client-python 0.4.1 to 0.5.0 (Make every opt-out fail closed (0.5.0) Stephenson-Software/trace-client-python#45), in which every opt-out fails closed: TRACE_USAGE_REPORTING set to anything but blank/true/on/yes/1, or DO_NOT_TRACK set to anything but blank/0/false/off/no, turns reporting off. The vendored test suite is updated to match (the two package-layout tests, which read pyproject.toml and the package __init__, are left out because a single vendored module has neither).
  • Fail-open paths fixed:
    • usageReportingEnabled was read with getBoolValue, so anything but a bare true/false (off, no, 0, "false", a blank value) fell back to the default and reported, silently, because the line's presence also suppressed the first-run notice. It is now read with the client's allows_reporting(): only true, on, yes or "true" reports.
    • A config.yml that could not be read in full (e.g. a byte that is not UTF-8) was read as the defaults (on), and the first-run notice then rewrote the file from nothing, leaving only usageReportingEnabled: true. Reporting is now off in that case, and _writeKeyValues (also used for window-size saves) no longer writes over a file it could not read.
    • ROAM_USAGE_REPORTING only turned reporting off for 0/false/off/no, so a value such as disabled left it on. It now fails closed like TRACE_USAGE_REPORTING.
  • README opt-out section and CHANGELOG updated.

Tests

  • New tests for each path above (config values, an unreadable config file, the environment override).
  • python -m black --check src tests (black 23.1.0): clean. python -m pytest (Python 3.12): 2212 passed.

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

Re-vendor trace-client-python 0.5.0 (every opt-out fails closed) and make
Roam's own switches fail closed too:
- usageReportingEnabled is read with allows_reporting(): off/no/0/"false"/blank
  no longer fall back to the default (on)
- a config.yml that cannot be read in full is off, and _writeKeyValues no
  longer replaces a file it could not read
- ROAM_USAGE_REPORTING fails closed like TRACE_USAGE_REPORTING

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dmccoystephenson
dmccoystephenson merged commit c76eec2 into main Nov 19, 2026
6 checks passed
@dmccoystephenson
dmccoystephenson deleted the fix/opt-out-fails-closed branch November 19, 2026 05:53
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