Skip to content

Disclose usage reporting: README, environment opt-out, notice link - #1

Merged
dmccoystephenson merged 1 commit into
mainfrom
trace/disclosure
Sep 16, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
trace/disclosure

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

The client is bumped to 0.2.0 so that the person running a program always has the last word on usage reporting, and so that programs can say why reporting is off. Two opt-outs are added ahead of the program's own setting: the environment variables TRACE_USAGE_REPORTING (off/false/0/no) and DO_NOT_TRACK (1/true/yes), and, for Spigot servers, a server-wide plugins/trace/config.yml that is created with enabled: true by the first plugin to build a client and never rewritten afterwards. Nothing about what is sent changes; the file stays one Java 8 source with zero dependencies, and the existing guarantees (returns immediately, never throws, bounded queue, draining close()) are untouched. This is the client that the disclosure PRs across the plugin repos vendor.

  • src/main/java/software/stephenson/trace/TraceClient.java: Builder.serverWideConfig(File) is added; build() consults the two environment variables first, then the server-wide file (read with a line regex ^\s*enabled\s*:\s*(\S+), no YAML library; IO failures are logged at FINE and treated as enabled), then enabled(boolean), then the key. disabledReason() returns null or one of environment, server-wide config: plugins/trace/config.yml, config.yml, no key, verbatim. The environment lookup is placed behind a package-private static seam so it can be tested. Header comment and User-Agent say 0.2.0.
  • src/test/java/software/stephenson/trace/TraceClientTest.java: seven tests are added, covering the switch file being created with the exact expected content when missing, enabled: false disabling with the server-wide reason and the file being left untouched, every accepted spelling of off, each environment variable disabling and winning over the file, the precedence of the four reasons, and an IO failure (a plugins "directory" that is a regular file, since the suite may run as root) being logged at FINE and treated as enabled. Every test is isolated from the real environment.
  • pom.xml, README.md: version 0.2.0; the usage example shows serverWideConfig(getDataFolder().getParentFile()) and the startup line that logs disabledReason(); an "Opting out" section documents the four switches and their reasons.

Verified with mvn -B verify (JDK 21, target release 8): Tests run: 19, Failures: 0, Errors: 0, Skipped: 0, BUILD SUCCESS.

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

Builder.serverWideConfig(File pluginsDirectory) makes build() ensure
plugins/trace/config.yml exists (created with enabled: true and an
explanatory comment when missing, never rewritten) and honour
enabled: false in it, read with a line regex rather than a YAML library.
build() always consults TRACE_USAGE_REPORTING (off/false/0/no) and
DO_NOT_TRACK (1/true/yes) first. disabledReason() names which switch
turned reporting off -- environment, server-wide config, config.yml or
no key, in that precedence -- so programs can print it at startup.
IO failures on the switch file are logged FINE and count as enabled.

The environment lookup sits behind a package-private seam so the tests
can point it at a map; the suite isolates every test from the real
environment. Header, User-Agent, pom and README say 0.2.0; the README
example now shows the server-wide switch and the startup line.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dmccoystephenson
dmccoystephenson merged commit 122ea3f into main Sep 16, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the trace/disclosure branch September 16, 2026 03:57
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