3.5 KiB
Runbook 06 — Remove Amplitude and Product Analytics
Goal: dashboard emits no user/account/page/event data to Amplitude or another analytics provider. Existing callers may keep a stable no-op adapter to reduce upstream conflicts.
SM-06.01 — Convert analytics specs to a no-egress contract
Modify: app/javascript/dashboard/helper/AnalyticsHelper/specs/helper.spec.js
Replace provider-behavior assertions with:
- importing helper does not import/initialize Amplitude;
init,identify,track, andpagereturn without network/provider calls;- methods accept existing signatures so callsites need no bulk rewrite;
- passing a token cannot enable analytics.
Do not delete all tests. The no-op contract is the regression guard.
RED:
pnpm test app/javascript/dashboard/helper/AnalyticsHelper/specs/helper.spec.js
SM-06.02 — Make AnalyticsHelper provider-free no-op
Modify: app/javascript/dashboard/helper/AnalyticsHelper/index.js
Rules:
- remove
@amplitude/analytics-browserimport; - retain exported class and default object for compatibility;
- no dynamic import, fetch, beacon, image pixel, local queue, user/email/account serialization;
- each public method is an explicit no-op.
GREEN:
pnpm test app/javascript/dashboard/helper/AnalyticsHelper/specs/helper.spec.js
pnpm eslint app/javascript/dashboard/helper/AnalyticsHelper/index.js app/javascript/dashboard/helper/AnalyticsHelper/specs/helper.spec.js
SM-06.03 — Remove dashboard token delivery
Modify:
app/controllers/dashboard_controller.rbapp/views/layouts/vueapp.html.erbspec/controllers/dashboard_controller_spec.rb
Remove CLOUD_ANALYTICS_TOKEN from GLOBAL_CONFIG_KEYS and remove window.analyticsConfig serialization. Add response assertion that the rendered dashboard contains neither analyticsConfig nor configured test token.
Do not alter other global config keys.
Run:
bundle exec rspec spec/controllers/dashboard_controller_spec.rb
bundle exec rubocop app/controllers/dashboard_controller.rb spec/controllers/dashboard_controller_spec.rb
SM-06.04 — Remove SDK and installation config
Modify:
package.jsonpnpm-lock.yamlviapnpm remove @amplitude/analytics-browserconfig/installation_config.yml
Remove the CLOUD_ANALYTICS_TOKEN entry. Do not hand-edit unrelated lockfile entries.
GREEN:
pnpm install --frozen-lockfile
pnpm test app/javascript/dashboard/helper/AnalyticsHelper/specs/helper.spec.js
rg -n '@amplitude/analytics-browser|CLOUD_ANALYTICS_TOKEN|analyticsConfig' app config package.json pnpm-lock.yaml --glob '!enterprise/**'
git diff --check
Expected runtime/config matches: zero; compatibility helper filenames may remain.
Verified checkpoint status — 2026-08-16
a96b977removed the Amplitude SDK, analytics token delivery, andwindow.analyticsConfig, but its controller regression exposed that an unrelatedCLOUD_ANALYTICS_TOKENreturned by a config stub/source could still be serialized throughwindow.globalConfig.ced77affixes the root cause by applying.slice(*GLOBAL_CONFIG_KEYS)before merging explicitapp_configvalues.- Fresh pre-commit review
deleg_f9644984and exact post-commit reviewdeleg_9b0a2f63both passed withsecurity_concerns=[]andlogic_errors=[]. - Ruby syntax,
git diff --check, and the added-line security scan passed. Rails RSpec/RuboCop are blocked until the pinned Ruby 3.4.4/Bundler 2.5.16 toolchain is available.
Checkpoint commit: privacy: disable product analytics by construction