Files
Colby McHenry 4acdfeb625 feat(telemetry): cutover runbook + the end-to-end gate that de-risks it (CG-14)
The account-level steps of the PostHog cutover are the maintainer's to run, so
this lands the runbook they follow and the check that has to pass first.

The runbook (telemetry-worker/README.md) walks the six steps in the order that
keeps them reversible: Workers Paid → migrate → deploy → watch 24h → verify the
first rollup and the dashboard → only then delete POSTHOG_KEY and cancel the
subscription. Step 3 records the outgoing version id because `wrangler rollback`
is the escape hatch for the whole verification window, and that window is
precisely why the PostHog key is deleted last rather than first.

The new gate (scripts/smoke-cutover.sh, `npm run smoke:cutover`) covers the one
seam nothing else did. Both workers declare the same D1 database_id, so pointing
them at a single --persist-to directory runs the real chain: a client batch →
the ingest worker → D1 → the nightly rollup → the dashboard API reading the
numbers back. Every other suite stops at one link — smoke-ingest at the events
table, smoke-rollup at hand-checked SQL, smoke-api at a hand-written fixture
that the cron never touched. That left the dimension names the rollup WRITES
versus the ones the dashboard READS agreeing by convention across two branches,
where a mismatch is silent: no error, no failed request, just a panel reading
zero forever. 61 assertions, all 13 dimensions, and three deliberate traps — a
ci machine that is active but not a production user, usage_rollup counts that
must be summed rather than tallied, and an uninstall's `targets` that must not
leak into the install-scoped breakdown.

Writing it caught that the activation funnel's denominator is first-seen
machines, not install events (deliberate — a reinstall must not re-enter the
funnel), so the suite now pins that distinction rather than assuming it.

Also rewords the last PostHog reference in dashboard code: a comment justifying
the 14-day retention curve by pointing at a dashboard step 6 deletes. The
reasoning now stands on its own.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 22:02:51 -05:00

23 lines
911 B
JSON

{
"name": "codegraph-telemetry-worker",
"private": true,
"description": "First-party ingest endpoint for codegraph's anonymous usage telemetry (telemetry.getcodegraph.com)",
"scripts": {
"dev": "wrangler dev",
"deploy": "wrangler deploy",
"types": "wrangler types",
"check": "wrangler types && tsc --noEmit && wrangler deploy --dry-run",
"smoke": "./scripts/smoke-ingest.sh",
"smoke:rollup": "./scripts/smoke-rollup.sh",
"smoke:cutover": "./scripts/smoke-cutover.sh",
"db:migrate:local": "wrangler d1 migrations apply codegraph-telemetry --local",
"db:migrate": "wrangler d1 migrations apply codegraph-telemetry --remote",
"db:migrations": "wrangler d1 migrations list codegraph-telemetry --remote",
"db:sql": "wrangler d1 execute codegraph-telemetry --remote --command"
},
"devDependencies": {
"typescript": "^5.0.0",
"wrangler": "^4.36.0"
}
}