Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Telemetry and Update Check
Status: Design finalized — nothing built yet
Target: Spree 6.0
Depends on: 6.0-admin-spa.md (the banner lives in the dashboard shell), 6.0-beta-release.md (one version line per surface)
Author: Damian Legawiec (design driven with Claude)
Last updated: 2026-09-16
Tracking: Linear V-3650 · GitHub spree/spree#14660
Summary
Spree 5.x told admins when a newer release existed: Spree::Admin::Updater
asked spreecloud.io once a day, and the Rails admin showed a banner. That
class left with the spree_admin engine, and nothing in 6.0 replaces it —
the Admin API, the React dashboard and the CLI neither check for updates nor
report anything about the installations they run on. This plan brings the
update check back as an Admin API endpoint the dashboard renders a banner
from, and turns the same daily request into an anonymous usage heartbeat
(which Spree gems and versions are in use, on what stack, at what rough
size). A second, independent channel reports CLI command usage from
@spree/cli and create-spree-app, the way Mercur, Next.js and Gatsby do.
Both channels honour one opt-out, send nothing that identifies a person, and
are documented field by field.
The spreecloud.io backend is ours. It keeps answering the 5.x query string unchanged and grows to store the new fields, so a 5.6 install and a 6.0 install can hit the same endpoint.
Key Decisions (do not deviate without discussion)
- The update check is the heartbeat. One daily request per installation
carries the running version and the usage fields, and its response is the
list of newer releases. There is no separate "phone home" from the server.
Rationale: 5.x already worked this way (version, environment, storefront
URL and
install_idon the query string), so the backend and the privacy story already exist; a second channel would double the surface to document and to opt out of. - The four 5.x query keys are frozen:
version,environment,url,install_id. New fields are added beside them, never renamed, so payloads from 5.x installs keep working against the same backend (2026-09-16, backend owner). - The check runs server-side and never inside an admin request. The
Admin API endpoint reads a cached result; a cache miss enqueues
Spree::UpdateCheckJoband answers "not checked yet". The 5.x class did the HTTP call inline with one-second timeouts, which made the first admin page after cache expiry hang for up to two seconds on every worker. - The Spree version reaches only signed-in admins who can manage the
store. The Admin API deliberately does not expose the running version
anywhere else (see
Admin::ImportsController#example: it would fingerprint deployments for anyone matching CVEs). The endpoint is JWT-only — a secret API key gets a 404, likeGET /admin/me— and requiresmanageon the store, matching the 5.xcan?(:manage, current_store)gate. - The dashboard owns the banner,
dashboard-coreowns the hook. The seller panel mounts the sameAppShellbut has no updates endpoint, so the banner is passed into the shell by the dashboard, never rendered by the shell itself. - Two switches, both environment variables, both honoured by Rails and
the CLI.
SPREE_TELEMETRY_DISABLED=1(or the cross-toolDO_NOT_TRACK=1) strips the heartbeat down toversionalone and turns CLI events off;SPREE_UPDATE_CHECK_DISABLED=1stops the daily request entirely and hides the banner. An operator who wants to know about releases but share nothing has a way to say so. The Ruby equivalents areSpree::Config.telemetry_enabledandSpree::Config.update_check_enabled. - Nothing that identifies a person. No emails, no admin names, no IP retention beyond the request log, no store names, no product or order counts — only order-of-magnitude buckets. The CLI hashes the git remote for its project id and never sends error messages, only exit codes.
- On by default, for both channels (2026-09-16). The heartbeat and the CLI events run unless the operator opts out, as the 5.x updater did and as Mercur, Next.js and Gatsby do. Accepted trade-off: some operators object to any default reporting, so the opt-out has to be one line, documented on the deployment pages and printed by the CLI on first run — this is not optional polish.
- Stack fields plus size buckets, never exact counts (2026-09-16). The heartbeat carries Ruby, Rails, database, installed Spree gems, whether a dashboard is mounted, and order-of-magnitude buckets for stores, products, completed orders and sellers. Exact counts were rejected: paired with the storefront URL they are business data and hard to defend under GDPR questions from enterprise buyers. Stack-only was rejected because it cannot tell a hobby install from a large merchant.
- A dedicated
GET /api/v3/admin/updates(2026-09-16). Folding the status intoGET /admin/mewas rejected:/meis fetched by every admin, so the version would reach admins who cannot manage the store, and the seller panel's/mewould have to diverge. Accepted trade-off: one more request on dashboard boot, cached for an hour. - Both
@spree/cliandcreate-spree-appsend events (2026-09-16). The scaffold-to-first-spree devfunnel is where new users are lost, andcreate-spree-appfailures are invisible otherwise. Accepted trade-off: the telemetry module is copied intocreate-spree-app, which deliberately has no dependency on@spree/cli; the two copies must stay identical and a Vitest fixture shared through the workspace asserts it. - Only lifecycle commands send CLI events, and only from a terminal
(2026-09-16). Per-command reporting is the Next.js model, but
spree apiandspree execare called from scripts in loops, andspree completionruns on every tab press; each would send an event per invocation. The allowlist iscreate,init,add,dev,update,upgrade,eject,build,plugin,generate, plus a standard-output terminal check. Accepted trade-off: no data on API and scripting usage, which is by design — that is machine use, not the funnel. - Mobile-app and headless installs count. The heartbeat runs from Rails whether or not a dashboard is mounted, so an installation with no admin UI still reports and still gets the release list (readable through the API).
Design Details
Server heartbeat (spree_core)
Spree::UpdateCheck replaces Spree::Admin::Updater. It lives in
spree/core/app/services/spree/update_check.rb and keeps the 5.x public
shape:
Spree::UpdateCheck.update_available? # => true
Spree::UpdateCheck.latest_release # => { "tag_name" => "v6.0.1", "url" => ..., "published_at" => ... }
Spree::UpdateCheck.newer_releases # newest first, [] when unknown or disabled
Spree::UpdateCheck.checked_at # Time or nil
Spree::UpdateCheck.enabled? # false under SPREE_UPDATE_CHECK_DISABLED
The result is cached under spree/update_check/<version> for one day.
Reads never perform HTTP. Spree::UpdateCheck.refresh does the request
(1 s open, 2 s read timeouts) and writes the cache; a failure caches an empty
list with checked_at so an unreachable endpoint costs one timed-out request
per day. Spree::UpdateCheckJob calls refresh and is enqueued by the
endpoint on a cache miss and by Spree::UpdateCheck.enqueue_if_stale, which
the engine calls once per boot in production (after_initialize, guarded so
console and rake processes do not enqueue).
The request stays a GET https://spreecloud.io/updates.json with a query
string. Legacy keys are sent exactly as 5.x sent them; new keys sit beside
them:
| Key | 5.x | 6.0 | Value |
|---|---|---|---|
version |
✓ | ✓ | Spree.version |
environment |
✓ | ✓ | Rails.env |
url |
✓ | ✓ | default store's storefront URL, as 5.x |
install_id |
✓ | ✓ | Spree.install_id (UUID, already in core) |
ruby |
new | RUBY_VERSION |
|
rails |
new | Rails.version |
|
database |
new | adapter name (postgresql, mysql2, sqlite3) |
|
gems |
new | comma-separated installed Spree gems (spree_api,spree_emails,spree_stripe,…), from Gem.loaded_specs |
|
dashboard |
new | true when spree_dashboard serves a built dashboard |
|
stores |
new | store count bucket | |
products |
new | product count bucket | |
orders |
new | completed-order count bucket | |
sellers |
new | seller count bucket, absent when marketplace is off |
Buckets are 0, 1-9, 10-99, 100-999, 1k-9k, 10k-99k, 100k+,
computed with count on the base scope (no per-store loop). With telemetry
disabled the query string is version only — no install_id, so the backend
answers the request and stores nothing.
Spree::Config gains two preferences with defaults true:
telemetry_enabled and update_check_enabled. The env variables are read by
Spree::UpdateCheck itself and cast as booleans — the env: option on
preference returns the raw string, so SPREE_TELEMETRY_DISABLED=false
would otherwise read as truthy. DO_NOT_TRACK=1 counts as telemetry
disabled, as it does for Homebrew, Gatsby and Next.js.
Admin API
GET /api/v3/admin/updates on Spree::Api::V3::Admin::UpdatesController
(a singleton resource; skip_scope_check!, JWT only, authorize! :manage, current_store):
{
"current_version": "6.0.0",
"update_available": true,
"latest_release": { "version": "6.0.1", "url": "https://github.com/spree/spree/releases/tag/v6.0.1", "published_at": "2026-10-02T10:51:38Z" },
"checked_at": "2026-10-03T04:00:00Z",
"enabled": true
}
checked_at: null means the job has been enqueued and the client should not
show anything. enabled: false (update check switched off) tells the
dashboard to render nothing without polling again. The response is a plain
Spree::UpdateStatus value object (ActiveModel::Model +
ActiveModel::Attributes) rendered by Admin::UpdateStatusSerializer, so
Typelizer emits AdminUpdateStatus and @spree/admin-sdk gets
adminClient.updates.show(). An rswag integration spec documents it and
stubs the outbound request.
Dashboard banner
useUpdateStatus()in@spree/dashboard-core/hookswrapsadminClient.updates.show(), store-scoped query key,staleTimeof one hour, no refetch on focus, disabled unless the current user hasmanageon the store (permission keys from/me).<UpdateNotice>in@spree/dashboard/components/spree/renders anAlertabove the page content with the two versions, a link to the release notes and a dismiss button. Dismissal is per browser and per release (localStorage["spree-update-dismissed"] = "v6.0.1"), so the banner comes back for the next release and never for the same one. The 5.x seven-day session dismissal is gone; per-release is what merchants asked for.AppShellgains abanner?: ReactNodeprop rendered between the mobile top bar and the page. The dashboard passes<UpdateNotice />; the seller panel passes nothing.- Copy in every locale (
admin.updates.available,admin.updates.dismiss,admin.updates.release_notes).
Dashboard package versions are not compared in 6.0: the npm surface has its
own 1.x line, and the release list is the gem list. A later release can add
dashboard_version to the endpoint response and compare it against the
build-time @spree/dashboard version.
CLI events (@spree/cli, create-spree-app)
A small shared module (packages/cli/src/telemetry.ts, copied verbatim into
create-spree-app since that package deliberately has no @spree/cli
dependency) sends one POST https://spreecloud.io/cli-events per command as
JSON:
{
"event": "command",
"command": "dev",
"status": "ok",
"exit_code": 0,
"duration_ms": 8421,
"cli": "@spree/cli",
"cli_version": "1.0.0-beta.2",
"node_version": "24.4.0",
"package_manager": "pnpm",
"os": "darwin",
"arch": "arm64",
"ci": false,
"docker": false,
"machine_id": "3f1c…",
"project_id": "sha256(git remote url) | null"
}
create-spree-app sends event: "create" with status and the chosen
options (storefront: true, package_manager, start: true) and nothing
typed by the person. machine_id is a UUID generated once into
~/.config/spree/config.json; project_id is the SHA-256 of the first git
remote URL, or null outside a repository.
Delivery never blocks or fails a command: fetch with a 1.5 s abort
signal, errors swallowed, awaited only at process exit. The first run prints
a one-paragraph notice (what is sent, the docs link, how to opt out) and
records that it was shown, the way Next.js does. spree telemetry status,
spree telemetry disable and spree telemetry enable write
telemetry: false into the same config file; SPREE_TELEMETRY_DISABLED=1
and DO_NOT_TRACK=1 win over the file. No CLI event is sent under CI=true
either — those runs are not people.
Only lifecycle commands report: create (from create-spree-app), init,
add, dev, update, upgrade, eject, build, plugin, generate.
The scripted surfaces — api, exec, rails, rake, task, rspec,
completion and the rest — never do, and no command reports when its
standard output is not a terminal, the cheapest test for "a script, not a
person". The gate sits in the CLI, before anything else happens: a command
outside the list, or one running without a terminal, never builds a payload,
never resolves the machine id and never opens a connection — there is no
HTTP call to swallow. A developer working by hand sends a few events a day,
never one per loop iteration. The command list lives in one exported
constant in telemetry.ts; the receiver keeps a copy only as a backstop
against a forked client.
spreecloud.io (outside this repository)
GET /updates.jsonkeeps its contract: the four 5.x keys, the same response array. It stores the new keys when present.POST /cli-eventsis new, accepts the JSON above, rejects anything over 4 KB.- The receiving side is designed in the spree_cloud repository,
docs/plans/spree-6.0-telemetry.md: column list, allowlists, rate limits, retention and dashboard cards.
Documentation
- New page
docs/developer/deployment/usage-data.mdx("Update checks and usage data"): both channels, every field, both switches, what is never sent. The old/developer/deployment/telemetrypath redirects to the OpenTelemetry page and stays that way, so this page must not reuse it. docs/developer/cli/links to the page from the command reference and documentsspree telemetry.- Upgrade guide entry:
Spree::Admin::Updater→Spree::UpdateCheck,Spree::Admin::RuntimeConfig.admin_updater_enabled→SPREE_UPDATE_CHECK_DISABLED/Spree::Config.update_check_enabled.
Migration Path
- Core.
Spree::UpdateCheck,Spree::UpdateCheckJob, the twoSpree::Configpreferences, payload buckets, boot-timeenqueue_if_stale. Specs stub the request with WebMock (already in the core lock file) and cover: legacy keys unchanged, reduced payload under the opt-out, no request under the update-check switch, failure cached withchecked_at. - Admin API.
UpdatesController,Spree::UpdateStatus, serializer, route, controller spec (JWT admin with manage → 200, secret key → 404, admin without manage → 403), rswag spec, Typelizer + Zod + OpenAPI regeneration,adminClient.updatesin@spree/admin-sdk. - Dashboard.
useUpdateStatus,<UpdateNotice>,AppShellbannerprop, locale keys in all six languages, one Playwright spec that seeds the cache with a newer release and asserts the banner and its dismissal. - CLI.
telemetry.tsin both packages, the command wrapper that times and reports every registered command,spree telemetrysubcommand, first-run notice, Vitest coverage for the opt-out precedence and the payload shape. - Docs and backend. The usage-data page, CLI reference, upgrade guide
entry; spreecloud.io stores the new keys and gains
POST /cli-eventsbefore the 6.0 release so the first 6.0 installs are not dropped on the floor.
Constraints on Current Work
- Do not add a version, gem list or environment field to any Admin API
serializer or
/meresponse; the updates endpoint is the only place the running version is exposed, and only to admins who can manage the store. - Do not rename or drop the four 5.x query keys on the heartbeat, and do not send a new key that identifies a person or a store by name.
- A new outbound call from core follows the same shape: cached, run from a job, short timeouts, failure cached — never inline in a request.
- An env-backed boolean read through
Spree::Configmust be cast; theenv:option onpreferencereturns the raw string. - The
AppShellbannerslot is the only place a cross-page notice goes; do not hang another banner off the sidebar or a route layout.
Open Questions
None left. The four questions the draft raised (default posture, payload richness, endpoint shape, CLI scope) were settled on 2026-09-16 and moved to Key Decisions.
References
- 5.6.1
Spree::Admin::Updater: https://github.com/spree/spree/blob/v5.6.1/spree/admin/app/models/spree/admin/updater.rb - Mercur telemetry page (the model for the CLI channel): https://docs.mercurjs.com/telemetry
Spree.install_idinspree/core/lib/spree/core.rbdocs/plans/6.0-opentelemetry.md— tracing, a different kind of telemetry; this plan does not touch itdocs/plans/6.0-beta-release.md— version lines per surface