From bc9499e762d2a7584d594bf30a3d623e3d80182f Mon Sep 17 00:00:00 2001 From: Jakob Heuser Date: Thu, 10 Sep 2026 15:14:52 -0700 Subject: [PATCH] chore: opt the repository out of its own CLI telemetry Test suites spawn the built CLI with the production PostHog token and an inherited environment, so every `init`/`check` they launch was recorded as adoption. Disable telemetry in the vitest env, the `pnpm cli` script, and the workflows that run the CLI directly. --- .github/workflows/demo-rule.yml | 6 ++++++ .github/workflows/validate.yml | 6 ++++++ package.json | 2 +- packages/cli/vite.config.ts | 13 +++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/demo-rule.yml b/.github/workflows/demo-rule.yml index 821d4c1a..85c909e3 100644 --- a/.github/workflows/demo-rule.yml +++ b/.github/workflows/demo-rule.yml @@ -36,6 +36,12 @@ on: permissions: contents: read +# This workflow runs the CLI this repository builds. Its telemetry is the same +# production client a user's install has, so every invocation here would count +# as adoption. Opting out is the CLI's own switch, read by the built binary. +env: + TASKLESS_TELEMETRY_DISABLED: "1" + jobs: demo-rules: name: Demo rules diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index a5901680..bc9d1b03 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -30,6 +30,12 @@ on: permissions: contents: read +# This workflow runs the CLI this repository builds. Its telemetry is the same +# production client a user's install has, so every invocation here would count +# as adoption. Opting out is the CLI's own switch, read by the built binary. +env: + TASKLESS_TELEMETRY_DISABLED: "1" + jobs: validate: name: Validate diff --git a/package.json b/package.json index 6e7b8ed2..e0d930d7 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "bump:version": "changeset version", "changeset": "changeset", "check:style": "pnpm build && pnpm cli check", - "cli": "./packages/cli/dist/index.js", + "cli": "TASKLESS_TELEMETRY_DISABLED=1 ./packages/cli/dist/index.js", "dotagents": "dotagents --project", "generate:api": "pnpm --filter @taskless/cli generate:api", "husky": "husky", diff --git a/packages/cli/vite.config.ts b/packages/cli/vite.config.ts index d83be301..20000b5a 100644 --- a/packages/cli/vite.config.ts +++ b/packages/cli/vite.config.ts @@ -505,6 +505,19 @@ export default defineConfig({ test: { testTimeout: 20_000, hookTimeout: 20_000, + // Most suites spawn the BUILT CLI, which carries the production PostHog + // token and opts out only on these env vars. A child inherits the worker's + // process.env, so without this every `init`/`check` a test spawns posts a + // real `cli_run`, stamped with the package version and indistinguishable + // from a user's. Measured on 2026-09-08: `init` outnumbered `check` in + // production (8,673 to 8,415), which no shipped code path can do — `check` + // never launches `init` — and the daily shape tracked the Validate run + // count. Tests that exercise the opt-out itself clear these with + // `vi.stubEnv` first, so the default costs them nothing. + env: { + TASKLESS_TELEMETRY_DISABLED: "1", + DO_NOT_TRACK: "1", + }, // Two projects, because `__TASKLESS_CLI__` is a compile-time define rather // than a value a test can stub: whatever this config resolves is what every // test in the run sees. The suite therefore only ever exercised a prod