Skip to content

feat(telemetry): feature-usage counting is opt-in, no station name - #4

Open
veteranop wants to merge 1 commit into
mainfrom
feat/telemetry-opt-in
Open

veteranop wants to merge 1 commit into
mainfrom
feat/telemetry-opt-in

Conversation

@veteranop

Copy link
Copy Markdown
Owner

What this does

Feature-usage telemetry becomes opt-in, and stops sending the station name.
No behaviour change anywhere near the playout path — services/engine/ is
untouched, nothing on the audio path has network code.

Before this PR: base.html rendered GA4 into every install, on by default, with
user_properties: {station: "<station name>"}. The product site is being
corrected to say telemetry is opt-in, so the code has to actually be opt-in
first.

Changes

  • core.telemetry_enabled is the only switch. A missing key means OFF,
    so an existing install sends nothing until a human ticks the box.
  • Asked once, on the setup wizard's Done step, unchecked by default. No
    answer (Skip / stale page) changes nothing — nobody is opted in by omission.
  • Settings -> About & updates has a switch for it, admin only, applied live
    (the Jinja globals are refreshed when it moves, so no restart is needed).
  • core.telemetry_install_id — 32 random hex chars, minted at opt-in,
    stored in config.json, kept if telemetry is later turned off. It is the
    only identifier sent.
  • The station name is gone from base.html, and is no longer exposed to
    the templates at all, so it cannot be attached to anything that leaves the
    box. No paths, IPs, user names or song data either.
  • Off means no tag at all — base.html is gated on ga_id, which is empty
    unless telemetry is enabled.
  • ga_measurement_id still works as an override, but only when telemetry is on.

Docs

CHANGELOG [Unreleased], config/CONFIG.md (key table + a "what is and is not
sent" section), the README telemetry section, config/config.example.json, and
the in-app Help page — new Privacy — what leaves the box section plus a
Settings table row.

Tests

tests/test_telemetry.py (28 checks) covers exactly the three claims:

Claim Check
default config sends nothing telemetry_enabled False, no measurement ID, no googletagmanager in the rendered page
opt-in payload has the install ID and no station name the GA block contains the 32-hex ID and not the station name; the page itself still renders the name normally
existing config without the key stays off a config with only bind_host/bind_port reads as OFF and renders no tag
plus ID minted once and survives off->on; admin-only switch; tag appears and disappears on the next render
TELEMETRY OPT-IN OK (28 checks)

Full local run: pytest tests/ -q -> 38 passed; all 23 standalone scripts in
the CI list -> exit 0, including test_setup_wizard (29 checks).

The test pins its own temp paths block and asserts cfg["db_path"] is inside
the sandbox — without that, a missing paths key falls back to the machine's
real data folder (found the hard way).

Not in this PR

  • No release, no VERSION bump, no install-side change.
  • Until a release ships this, the site keeps its current honest wording ("it is
    on by default ... we are moving it to opt-in").

The website is about to say telemetry is opt-in and carries no station name.
The code said otherwise: GA4 was on in every install, with the station name
attached as a user property. This makes the code match the claim.

- `core.telemetry_enabled` is the only switch, and a MISSING key means OFF —
  so an existing install sends nothing until a human opts in.
- Opt-in is asked once on the wizard's Done step (unchecked by default) and
  toggled in Settings -> About & updates (admin only, effective without a
  restart: the template globals are refreshed when the switch moves).
- The only identifier that reaches GA4 is `core.telemetry_install_id`: 32
  random hex characters minted at opt-in. The station-name user property is
  gone from base.html, and the station name is not exposed to the templates
  at all — so no path, IP, user name or song data can ride along either.
- With the switch off, base.html renders NO tag (not a disabled one).

Docs updated where the old behaviour was described: CHANGELOG [Unreleased],
config/CONFIG.md (+ a "what is and is not sent" section), the README
telemetry section, config.example.json, and the in-app Help page (new
"Privacy — what leaves the box" section, plus a Settings table row).

tests/test_telemetry.py covers the three claims — default config sends
nothing, opt-in payload carries the install ID and no station name, an
existing config without the key stays off — and the admin-only switch. It
pins its own temp paths so it can never write to a developer's real database,
and it is listed in .github/workflows/tests.yml (a new test file is invisible
to CI until it is).

No release. Ticket 987.
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