Repository navigation
fix(cli): make the telemetry opt-out hold on every path - #7811
pamelachia wants to merge 4 commits into
Conversation
|
Manual verification on a build of this branch (re-run at
|
…tate to the resolved home
CLI benchmark (Lightweight Commands): no changes foundCommit
API calls: unchanged for all 9 commands. Binary size: 135.7 MB, up 4.0 KB from 135.7 MB. Details: timing ranges, API calls per command, slowest phasesTiming ranges
API calls per command
Slowest phasesNo command moved beyond noise, so there are no phase deltas. Comment |
There was a problem hiding this comment.
🤖 AI Review
CLI reference prose guidance: snapshot supabase/supabase@6a305cd supplied to reviewers (advisory, not a style pass).
The PR closes several telemetry opt-out gaps, but an existence-check failure can still let a run send with a saved opt-out, and an interrupted state write can erase that opt-out. The consent reader and state writer also disagree on which files are valid. Two regression tests can pass without proving the intended behavior, two code comments are stale, and first-run suppression makes the config conversion reference inaccurate. The reference guidance snapshot was available, and the diff contains no changed CLI reference prose. Findings were verified by reading the code. The CLI test suite was not run because dependencies were absent.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟠 MAJOR | apps/cli/src/shared/telemetry/consent.ts:94 |
privacy |
codex | A transient failure in the existence check can let the CLI send telemetry even when a subsequent read finds a saved opt-out. |
| 🟠 MAJOR | apps/cli/src/shared/telemetry/consent.ts:97 |
privacy |
codex | A state file with granted consent and an empty device ID can let the current command send telemetry, then be rewritten as opted out for later commands. |
| 🟠 MAJOR | apps/cli/src/telemetry/telemetry-state.layer.ts:465 |
persistence |
codex | An interrupted identity update can erase a saved opt-out and cause a later non-interactive invocation to send telemetry. |
| 🟡 MINOR | apps/cli/src/commands/telemetry/telemetry.integration.test.ts:290 |
test-coverage |
codex | The home-resolution regression test passes if both disable and status use the wrong home. |
| 🟡 MINOR | apps/cli/src/telemetry/telemetry-state.layer.unit.test.ts:232 |
test-coverage |
codex | The malformed-file login test can pass without exercising the rewrite that must preserve the opt-out. |
| 🟡 MINOR | apps/cli/docs/supabase/config/convert.md:29 |
docs-drift |
codex | The config conversion reference promises that the optional reason is recorded with command telemetry, but the first interactive conversion can still ask for a reason and then discard it. |
| ⚪ NIT | apps/cli/src/telemetry/telemetry-state.layer.ts:489 |
documentation |
claude | The layer comment still says every command writes state and fresh state is always enabled. |
| ⚪ NIT | apps/cli/src/telemetry/telemetry-state.service.ts:10 |
documentation |
claude | The stitchLogin contract says distinct_id is always written, although the service can stamp it only in memory. |
Findings outside the diff
- 🟡 MINOR
apps/cli/docs/supabase/config/convert.md:29— The config conversion reference promises that the optional reason is recorded with command telemetry, but the first interactive conversion can still ask for a reason and then discard it. - ⚪ NIT
apps/cli/src/telemetry/telemetry-state.service.ts:10— ThestitchLogincontract saysdistinct_idis always written, although the service can stamp it only in memory.
Stats
Claude findings: 2 · Codex findings: 5 · Confirmed: 8 · Refuted: 0 · Uncertain: 0
Models: claude-opus-5-5 + gpt-6.2-sol · Trigger: auto · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
|
On the two AI review findings outside the diff, and the failed e2e shard:
|
The three documented telemetry opt-outs (
supabase telemetry disable,SUPABASE_TELEMETRY_DISABLED=1,DO_NOT_TRACK=1) stop events on the normal path, but five paths still sent or re-enabled after a user had opted out. I closed those paths, removed the user-chosen project name from the project group, and corrected the notice and docs.Changed:
telemetry disablereported the opt-out, and could write it to the wrong place: consent is read before the handler writes the file, so the command sent its owncli_command_executed. It now sends nothing (this reverses fix(cli): telemetry enable/disable fire cli_command_executed on pre-toggle consent #5798 fordisableonly; the Go CLI behaviour it matched no longer exists).telemetry enableanddisablealso resolvedSUPABASE_HOMEfrom the shell alone while the CLI reads consent from the settings, so withSUPABASE_HOMEin a project.envthe opt-out landed in a directory nothing read. All state reads and writes now use the runtime's resolved directory.telemetry.jsonre-enabled telemetry: a file that could not be read or decoded counted as "no file", and the next write regenerated it as enabled. It now reads as an opt-out, and undecodable content is rewritten as one. Only a missing or empty file is a first run. A home directory that cannot be searched and a file with an empty device or session id read as an opt-out too. State writes used to overwrite the file in place, so a run killed mid-write left an empty file that read as a first run. They now go through a temporary file and a rename.telemetry statusignored them: every command wrote an enabledtelemetry.jsonunderDO_NOT_TRACK=1, which later suppressed the first-run notice. While opted out the CLI now updates an existing file but creates none, andstatusprintsTelemetry is disabled (DO_NOT_TRACK=1).Note: several existing tests asserted the old behaviour as intended (regenerate a malformed file as enabled,
disableemits its event,statuscreates the file or repairs a corrupted one). I changed those assertions on purpose, and I changed the e2e status tests to run without the harness's env opt-out so they read the file's consent. Two measurement effects for opted-in users follow from the first-run change:is_first_run = trueno longer appears together withis_tty = true, and a first interactivesupabase loginpersists the account id without sending the alias, which loses nothing because that device has no earlier events to merge.Linear