Store the usage data opt-out as a single global setting - #238
Merged
Merged
Conversation
The preferences panel's "Share anonymous usage data" checkbox kept its state in the front end and re-deployed every configured built-in toolset on each toggle, which was far too slow. It is now a machine-wide setting on disk that every built-in server reads when it starts: - Kernel/Files.wl: a general store for global settings, $rootPath/GlobalSettings.wxf (readGlobalSettings, getGlobalSetting, setGlobalSetting), meant to hold other settings in the future - Kernel/Server/UsageData.wl: getGlobalUsageDataSetting and setGlobalUsageDataSetting wrap its "SubmitUsageData" entry (only an explicit False opts out); usageDataEnabledQ falls back to it when SUBMIT_USAGE_DATA is not set, which still takes precedence - Kernel/PreferencesContent.wl: the checkbox is a DynamicModule that reads the setting when displayed and writes it when toggled; the re-deployment helpers are gone and deployments made from the panel no longer pass "SubmitUsageData". CreatePreferencesContent wraps its result in UsingFrontEnd so the panel (whose subtitle comes from a front end resource) can be built in a headless kernel - Tests: withTemporaryRoot helper in Tests/Common.wl; new tests in Files.wlt, UsageData.wlt, and PreferencesContent.wlt - Docs: usage-data.md, preferences-content.md, mcp-clients.md, servers.md, Specs/UsageData.md, AGENTS.md Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MKdo7zY8D9SN5oYaBFvJ4k
Contributor
There was a problem hiding this comment.
Pull request overview
This PR changes the anonymous usage-data opt-out from a front-end/private setting that triggered slow re-deployments into a single machine-wide on-disk setting ($rootPath/GlobalSettings.wxf) that each built-in server reads at startup, making the preferences checkbox toggle effectively instant and independent of client configuration.
Changes:
- Added a global settings store (
readGlobalSettings/getGlobalSetting/setGlobalSetting) backed by$rootPath/GlobalSettings.wxf. - Updated usage-data enablement to also honor a global opt-out (
getGlobalUsageDataSetting/setGlobalUsageDataSetting) whenSUBMIT_USAGE_DATAis unset. - Reworked the preferences checkbox to read/write the global setting via a
DynamicModule, removed re-deploy logic, and added/updated tests + docs accordingly.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Kernel/Files.wl | Introduces the machine-wide global settings file and read/get/set helpers. |
| Kernel/CommonSymbols.wl | Exposes the new global settings / usage-data-setting symbols for cross-file use. |
| Kernel/Server/UsageData.wl | Adds global-opt-out wrappers and integrates them into usageDataEnabledQ. |
| Kernel/PreferencesContent.wl | Switches the checkbox to a DynamicModule that reads/writes the global setting; stops passing "SubmitUsageData" into deployments; wraps panel build in UsingFrontEnd. |
| Tests/Common.wl | Adds withTemporaryRoot to isolate tests from developer-machine settings. |
| Tests/Files.wlt | Adds coverage for global settings file behavior (missing, read, merge, unreadable, overwrite-on-write). |
| Tests/UsageData.wlt | Adds tests for global opt-out/in behavior and environment precedence; ensures startup reads global setting. |
| Tests/PreferencesContent.wlt | Updates tests to validate checkbox structure/setter and absence of redeploy / submit logic. |
| Specs/UsageData.md | Updates spec to reflect the new global-setting-based opt-out behavior. |
| docs/usage-data.md | Documents the global settings file and updated opt-out/in semantics and precedence. |
| docs/preferences-content.md | Updates checkbox documentation and notes UsingFrontEnd behavior for headless kernels. |
| docs/mcp-clients.md | Clarifies "SubmitUsageData" -> Automatic behavior with global opt-out. |
| docs/servers.md | Updates server docs to describe global checkbox behavior for built-in servers. |
| AGENTS.md | Updates repo guidance to mention the global settings store and usage-data opt-out location. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
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
The Share anonymous usage data checkbox in the preferences panel (from #237) stored its state in the front end and re-deployed every configured built-in toolset whenever it was toggled — far too slow for a checkbox. This replaces that with a single machine-wide setting on disk that every built-in server reads when it starts, so toggling it is instant and never touches any client configuration.
Kernel/Files.wl):$rootPath/GlobalSettings.wxfholds a WXF association read and written byreadGlobalSettings,getGlobalSetting, andsetGlobalSetting(a missing or unreadable file counts as no settings; writes merge into the existing settings). It currently has one entry,"SubmitUsageData", but is meant to take other global settings later.Kernel/Server/UsageData.wl):getGlobalUsageDataSetting/setGlobalUsageDataSettingwrap that entry (only an explicitFalseopts out), andusageDataEnabledQnow requires"EnableUsageData" -> Trueand no global opt-out whenSUBMIT_USAGE_DATAis unset. An explicitSUBMIT_USAGE_DATAin a client configuration still wins in both directions, so the"SubmitUsageData"option ofInstallMCPServeris unchanged.Kernel/PreferencesContent.wl): now aDynamicModulewhoseInitializationreads the stored value when the panel is displayed and whoseDynamicsetter writes it (throughcatchAlways, so a failed write can't surface as an uncaughtThrowin the front end). TheusageDataOptOutQ/usageDataDeployOptions/applyUsageDataSetting/redeployForUsageDatahelpers are gone, and deployments made from the panel no longer pass"SubmitUsageData".CreatePreferencesContentwraps its result inUsingFrontEnd: its subtitle is aStringTemplatebuilt from a front-end string resource, so the panel can now be built (and smoke-tested) in a headless kernel withoutFrontEndObject::notavail.withTemporaryRoothelper inTests/Common.wl(Blocks$rootPathto a temporary directory); new tests inFiles.wlt,UsageData.wlt, andPreferencesContent.wlt.usage-data.md,preferences-content.md,mcp-clients.md,servers.md,Specs/UsageData.md,AGENTS.md.No migration of the old front-end setting is needed: the previous checkbox never shipped in a tagged release.
Test plan
Tests/Files.wlt: settings file location; unset ⇒<||>/Missing/ default with nothing created; set/get round trip; merging keeps other keys; unreadable and non-association files count as no settings and are replaced by the next writeTests/UsageData.wlt:getGlobalUsageDataSettingdefault / opt-out / opt-in, other settings preserved, only an explicitFalseopts out, non-boolean values rejected;usageDataEnabledQhonors the global opt-out, the environment variable still takes precedence, opting back in restores the default;initializeUsageDatareads the opt-out at startup (the existing property-dependent tests now run under a temporary root so a developer's own opt-out can't affect them) — 59/59 including the subprocess integration testsTests/PreferencesContent.wlt: checkbox structure (DynamicModulewhoseInitializationreads the setting), the setter writes the file and updates the module variable, the checkbox contains no deploy/SessionSubmitlogic;CreatePreferencesContent-SmokeTestnow passes headlessly — 7/7InstallMCPServer.wlt,DeployAgentTools.wlt,MCPServerObject.wlt— 689/689; CodeInspector clean on every changed file🤖 Generated with Claude Code
https://claude.ai/code/session_01MKdo7zY8D9SN5oYaBFvJ4k