Skip to content

feat(046-us3): onboarding-funnel telemetry — payload fields + privacy guards - #434

Merged
Dumbris merged 1 commit into
mainfrom
046-us3-telemetry
Apr 30, 2026
Merged

Dumbris merged 1 commit into
mainfrom
046-us3-telemetry

Conversation

@Dumbris

@Dumbris Dumbris commented Apr 28, 2026

Copy link
Copy Markdown
Member

Summary

Adds five anonymous, fixed-enum heartbeat fields (Spec 046 US3) so we can measure whether the new onboarding wizard moves day-2 retention from the current 11.8% baseline. Bumps schema_version 3 → 4. v3 consumers ignore the new fields; v1/v2/v3 clients keep sending the same payload they did before.

Stacked on top of #433 (the wizard PR). Merge that first; this PR rebases naturally.

Companion changes (separate repos / separate PRs):

Fields added to HeartbeatPayload

Field Type Source Example
connected_client_count int connect.Service.GetConnectedCount() 2
connected_client_ids []string (fixed-enum adapter IDs) connect.Service.GetConnectedIDs() ["claude-code","cursor"]
wizard_engaged bool OnboardingState.Engaged true
wizard_connect_step string ("" / "completed" / "skipped") OnboardingState.ConnectStepStatus "completed"
wizard_server_step string ("" / "completed" / "skipped") OnboardingState.ServerStepStatus "skipped"

The provider closes over connect.Service and the BBolt-backed OnboardingState, wired in internal/server/server.go alongside the existing connect-service wire-up so a single consultation returns fresh data each heartbeat.

Privacy posture

Inherits Spec 042 / Spec 044: opt-out, anonymous, off-by-default in CI/test, no transmission when telemetry is disabled. The new fields cannot carry user-entered values:

  • connected_client_count is a non-negative integer
  • connected_client_ids comes strictly from connect.Service.GetConnectedIDs(), which iterates the fixed per-client adapter table — paths, names, and arbitrary strings cannot reach this field
  • wizard_engaged is a boolean
  • wizard_connect_step and wizard_server_step are tri-state strings sourced from BBolt

Two new privacy regression tests assert this in code:

  • TestPayloadV4_OnboardingFieldsArePresent — verifies the five fields reach the wire when the provider is wired
  • TestPayloadV4_OnboardingDoesNotLeakUserStrings — asserts /Users/, /home/, http://, localhost, Bearer , apikey=, etc. never appear in a v4 payload

The companion worker validates the wire shape before INSERT — a regression on either side trips a test.

Test plan

  • internal/telemetry: full suite passes (privacy, schema, payload v2, v4)
  • internal/connect, internal/storage, internal/httpapi: unchanged + still pass
  • go build ./...: ok
  • Manual end-to-end via GET /api/v1/telemetry/payload — schema_version=4 with all five fields populated correctly:
    schema_version: 4
    connected_client_count: 3
    connected_client_ids: ['claude-code', 'codex', 'gemini']
    wizard_engaged: True
    wizard_connect_step: 'skipped'
    wizard_server_step: 'skipped'
    
  • Reviewer to test: install on a fresh machine, complete the wizard, confirm next heartbeat at the production endpoint contains the expected values

Out of scope

  • US2 tier-2 client adapters (Antigravity, Zed, OpenCode, …). Each tier-2 adapter that lands later automatically appears in connected_client_ids once it's added to internal/connect/clients.go's adapter table — no further telemetry plumbing needed.

Related #46

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 28, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6e97d6a
Status:⚡️  Build in progress...

View logs

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 47.36842% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/server/server.go 0.00% 10 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: 046-us3-telemetry

Available Artifacts

  • archive-darwin-amd64 (26 MB)
  • archive-darwin-arm64 (23 MB)
  • archive-linux-amd64 (15 MB)
  • archive-linux-arm64 (13 MB)
  • archive-windows-amd64 (26 MB)
  • archive-windows-arm64 (23 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (19 MB)
  • installer-dmg-darwin-arm64 (18 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 25069895619 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@Dumbris
Dumbris force-pushed the 046-local-first-onboarding branch from cd981ea to 4729cc1 Compare April 28, 2026 18:12
@Dumbris
Dumbris force-pushed the 046-us3-telemetry branch from dba68cf to 867b4c1 Compare April 28, 2026 18:12
@Dumbris
Dumbris changed the base branch from 046-local-first-onboarding to main April 30, 2026 15:13
… guards

Adds five anonymous, fixed-enum heartbeat fields per Spec 046 US3 so we can
measure whether the new onboarding wizard moves day-2 retention from the
current 11.8% baseline. Bumps the heartbeat schema_version to 4. Existing
v3 consumers ignore the new fields; v1/v2/v3 clients continue to send the
exact same payload they did before.

The provider closes over connect.Service (for connected-client count + fixed-
enum IDs) and the BBolt-backed OnboardingState (for wizard engagement +
per-step status). Wired in internal/server/server.go alongside the existing
connect-service wire-up so a single consultation returns fresh data each
heartbeat.

## Changes

- internal/telemetry/telemetry.go:
  - SchemaVersion bumped 3 -> 4 with a doc comment summarising the v4 delta
  - HeartbeatPayload gains connected_client_count, connected_client_ids,
    wizard_engaged, wizard_connect_step, wizard_server_step (all omitempty)
  - New OnboardingSnapshot struct + SetOnboardingProvider setter, populated
    in buildHeartbeat with the standard nil-safe pattern
- internal/server/server.go: wires the onboarding provider on the telemetry
  service inside the existing "if cfg := s.runtime.Config()" block so the
  closure captures the just-built connect.Service
- internal/telemetry/payload_privacy_test.go: extends the canary test to
  v4 (schema_version 4) and adds two new tests —
  TestPayloadV4_OnboardingFieldsArePresent and
  TestPayloadV4_OnboardingDoesNotLeakUserStrings — that assert the wire
  shape carries no paths/URLs/free-text, only fixed-enum adapter IDs
- internal/telemetry/payload_v2_test.go + telemetry_test.go: tripwire
  schema_version assertions updated 3 -> 4

## Privacy posture

Inherits Spec 042 / Spec 044: opt-out, anonymous, off-by-default in CI/test,
no transmission when telemetry is disabled. The new fields cannot carry
user-entered values:

  - connected_client_count is a non-negative integer
  - connected_client_ids comes strictly from connect.Service.GetConnectedIDs()
    which iterates the fixed per-client adapter table — paths, names, and
    arbitrary strings cannot reach this field
  - wizard_engaged is a boolean
  - wizard_connect_step and wizard_server_step are tri-state strings
    (""/completed/skipped) sourced from the OnboardingState bucket

The Cloudflare Worker (companion change in mcpproxy-telemetry) re-validates
all five fields shape-side before INSERT, so a regression on either side
gets caught.

## Tests

- internal/telemetry: full suite passes (privacy, schema, payload v2, v4)
- internal/connect, internal/storage, internal/httpapi: unchanged + still pass
- Build: ok ./...
- Manual end-to-end against /api/v1/telemetry/payload — schema_version=4
  with all five fields populated correctly from BBolt + connect.Service

Companion changes:
  - mcpproxy-telemetry: D1 migration 0005_add_onboarding_funnel.sql,
    validateV4Payload, INSERT/UPDATE bindings, 29 new validation tests
    (74 -> 103 passing)
  - mcpproxy.app-website: /telemetry page documents the five new fields
    with the same level of detail as existing fields

Related #46
@Dumbris
Dumbris force-pushed the 046-us3-telemetry branch from 867b4c1 to 6e97d6a Compare April 30, 2026 15:15
@Dumbris
Dumbris merged commit 738c90a into main Apr 30, 2026
9 of 10 checks passed
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.

3 participants