Skip to content

feat(cli): telemetry consent controls, redaction hardening, retry queue, www endpoint - #11

Open
outeredgelab-ankita wants to merge 1 commit into
mainfrom
feat/cli-telemetry-phase2
Open

feat(cli): telemetry consent controls, redaction hardening, retry queue, www endpoint#11
outeredgelab-ankita wants to merge 1 commit into
mainfrom
feat/cli-telemetry-phase2

Conversation

@outeredgelab-ankita

Copy link
Copy Markdown
Contributor

Phase 2 of the CLI telemetry work (builds on #10). Everything here is CLI-only — no ingestion-endpoint or dashboard changes required.

Privacy & consent

  • telemetry subcommandchaibuilder-app telemetry status | enable | disable. Builds only a logger, so managing telemetry never itself sends an event or creates the anonymous id.
  • Persisted opt-outtelemetryDisabled() now also reads a disabled flag from ~/.config/chaibuilder/telemetry.json (shared, merge-safe telemetry-config module), not just env vars.
  • Notify-only first run — the run that first shows the notice sends nothing. The first-run notice is now wired into every command (create/new/switch/check-env) — it was previously dead code.

Robustness

  • Redaction hardeningredact() now scrubs KEY=secret credentials (incl. FOO_SECRET= env forms), Bearer tokens, prefixed keys (ghp_/sk-/AKIA/xox…), and more URL schemes; added a fuzz test. Input is bounded before redacting.
  • Retry queue — failed sends persist to ~/.config/chaibuilder/telemetry-queue.jsonl (capped at 50) and are drained + resent on the next run. Transient failures (network/timeout/5xx) retry; permanent 4xx are dropped, not retried forever. Queued bodies are already redacted.

Endpoint & debug

  • www endpoint — default is now https://www.chaibuilder.com/in/cli/track, skipping the chaibuilder.com → www 308 hop (verified: non-www 308→www, www responds directly).
  • CHAIBUILDER_TELEMETRY_DEBUG — echoes each event to stderr.

Not in this PR (out of scope / decisions)

  • 1.7 homepage source — N/A, the CLI has no remote homepage fetch (bundled DEFAULT_BLOCKS only).
  • 3.1 batching / 3.3 rate-limit / 3.4 geo — cbpl endpoint. 4.x dashboards — PostHog UI. 5.2/5.4 CI e2e — needs a cli-e2e remote. 1.6 extra dimensions — needs a data-scope decision. 3.5 posthog-node — would bypass the server-side endpoint (not recommended).

Testing

  • tsc clean · 137 unit tests · build clean.
  • Built-CLI smoke test: telemetry status/enable/disable/help work, with no id/queue side effects.
  • cli-e2e: 38/38 (full real scaffold → create/new/switch/check-env + git-init + the telemetry event contract).
  • Independent review pass; findings fixed and covered by tests.

…debug env

- redaction: scrub KEY=secret credentials (incl. FOO_SECRET=), Bearer tokens,
  prefixed keys (ghp_/sk-/AKIA/xox…), more URL schemes; + a fuzz test
- retry queue: failed sends persisted to ~/.config/chaibuilder/telemetry-queue.jsonl
  (capped 50) and drained + resent on the next run; transient/5xx retried, 4xx dropped
- default endpoint → https://www.chaibuilder.com/in/cli/track (skips the 308 hop)
- CHAIBUILDER_TELEMETRY_DEBUG echoes each event to stderr
- remove the unused first-run notice dead code

Telemetry stays anonymous with env-only opt-out (DO_NOT_TRACK /
CHAIBUILDER_TELEMETRY_DISABLED); no notice or subcommand.
@outeredgelab-ankita
outeredgelab-ankita force-pushed the feat/cli-telemetry-phase2 branch from 37ab359 to fa1b369 Compare July 23, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant