You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A malformed enabled option fails open: only the literal false opts out #37
The constructor treats only the literal false as the program's opt-out: options.enabled === false (trace-client.ts:255). Everything else from untyped code leaves reporting on, so enabled: 0, enabled: null, enabled: "" and enabled: "false" (a value read straight from a settings file or an environment variable) all send events.
The documented behavior is matched literally: the option is typed boolean, and "false yields a client that does nothing. Default true." The concern is the direction of the failure. A malformed opt-out fails open, in the one option that exists to stop reporting. The neighbouring key option went the other way in an earlier fix: a non-string key counts as missing, so the client sends nothing.
The README's own usage example is not affected, because it passes a real boolean (process.env.USAGE_REPORTING_ENABLED !== "false").
Why it was not fixed directly
Which values count as an opt-out, and the resulting disabledReason, are behavior that the three clients are meant to share. How trace-client-python and trace-client-java treat a non-boolean could not be checked, because their repositories could not be read from this run. A Java boolean cannot be malformed, while a Python truthiness check would already disagree with the code above.
Decision needed from the owner
Keep the current rule and say so in the TSDoc and README.
Or treat any value other than true and undefined as off, with disabledReason"config". This is the safer failure, and it would stop sending for any program that passes a truthy non-boolean today, so it needs a CHANGELOG entry and a check against the Python client.
Resolved in PR #46 (0.5.0): when given, enabled is now read through TraceClient.allowsReporting() (trace-client.ts:287), so 0, null, "" and "false" turn reporting off with disabledReason"config".
Activity
dmccoystephenson commentedon Nov 20, 2026
Resolved in PR #46 (0.5.0): when given,
enabledis now read throughTraceClient.allowsReporting()(trace-client.ts:287), so0,null,""and"false"turn reporting off withdisabledReason"config".This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).