Disclose usage reporting: README, environment opt-out, notice link - #1
Merged
Merged
Conversation
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>
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.
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) andDO_NOT_TRACK(1/true/yes), and, for Spigot servers, a server-wideplugins/trace/config.ymlthat is created withenabled: trueby 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, drainingclose()) 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 atFINEand treated as enabled), thenenabled(boolean), then the key.disabledReason()returnsnullor one ofenvironment,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 andUser-Agentsay 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: falsedisabling 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 atFINEand treated as enabled. Every test is isolated from the real environment.pom.xml,README.md: version 0.2.0; the usage example showsserverWideConfig(getDataFolder().getParentFile())and the startup line that logsdisabledReason(); 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