Skip to content

Add telemetry consent prompt to bootstrap wizard - #90

Merged
ernestrc merged 9 commits into
unstablebuild:mainfrom
Spandan-Mishra:feat/bootstrap-telemetry-consent-prompt
Sep 21, 2026
Merged

ernestrc merged 9 commits into
unstablebuild:mainfrom
Spandan-Mishra:feat/bootstrap-telemetry-consent-prompt

Conversation

@Spandan-Mishra

Copy link
Copy Markdown
Contributor

Summary

Addresses #86 by introducing an explicit telemetry consent prompt to the first-run bootstrap wizard. Previously, telemetry was enabled by default on fresh installs without an interactive prompt. Users can now choose whether to share anonymous usage reports during initial onboarding.

Telemetry consent prompt:
screenshot-2026-09-18_01-50-36

Implementation Details

  1. Payload Example Generator without Drift (cmd/rune/ide/apiclient/telemetry.go):

    • Added ExampleUsagePayloadJSON() returning a formatted JSON representation of a representative telemetryUsagePayload.
    • Added TestExampleUsagePayloadJSONFieldCoverage using reflection to ensure 100% field coverage between the struct and the example output.
  2. Preset Generation & Config Migration (cmd/rune/presets.go, cmd/rune/config_migrate.go):

    • Updated renderPreset(editor string, telemetry bool) to append the explicit telemetry: block with documentation comments to config.yaml.
    • Updated config migration callers and unit tests.
  3. Bootstrap Wizard Wiring (cmd/rune/bootstrap_handler.go):

    • Added bootstrapPrompter interface to decouple headless prompt testing from the GUI engine.
    • Chained openVimPrompt -> openTelemetryPrompt -> performSwap.
    • Options: " sure " (bound to y) and " no thanks " (bound to n).
    • Protected prompt with promptGuard() so closing without a choice (e.g. Esc) safely re-prompts the user.
    • Injected consent into performSwap's rootCfg ensuring the live API client on the first session respects the decision immediately.
  4. Documentation (cmd/rune/docs/docs/learn/telemetry.md):

    • Updated the documentation to note that fresh installs prompt for consent during onboarding and write the selection to config.yaml.

Verification

  • Automated Tests:
    • cmd/rune/bootstrap_test.go: Verified prompt progression, choice mapping, config persistence round-trip, and Esc dismissal re-opening.
    • cmd/rune/ide/apiclient/telemetry_test.go: Verified payload struct reflection coverage.
    • Full race verification: go test -race -count=1 ./cmd/rune ./cmd/rune/ide/apiclient (all pass).
  • Manual Verification:
    • Created fresh test directories to test out both y and n and verified their corresponding results in the respective config.yaml of the directories

when sure is selected:
screenshot-2026-09-18_02-00-38

when no thanks is selected:
screenshot-2026-09-18_02-00-21

Comment thread cmd/rune/docs/docs/learn/telemetry.md Resolved
Comment thread cmd/rune/bootstrap_handler.go Resolved
Comment thread cmd/rune/bootstrap_handler.go Resolved
Comment thread cmd/rune/bootstrap_handler.go Resolved
Comment thread cmd/rune/bootstrap_handler.go Resolved
Comment thread cmd/rune/bootstrap_handler.go Resolved
First-time users running the onboarding bootstrap wizard are now presented with
an explicit telemetry consent prompt before transitioning to the configured
editor environment.

Key changes:
- Export apiclient.ExampleUsagePayloadJSON() with reflection-based test
  coverage (TestExampleUsagePayloadJSONFieldCoverage) to prevent documentation
  and prompt drift as the usage payload evolves.
- Update renderPreset to accept a telemetry boolean and append an explicit
  telemetry block with explanatory commentary to generated config.yaml files.
- Wire openTelemetryPrompt into bootstrapHandler between keymap selection
  and the final IDE swap, offering " sure " ('y') and " no thanks " ('n')
  choices with re-opening guards against unselected dismissals (Esc).
- Inject the chosen telemetry preference into performSwap's rootCfg so the
  live API client immediately respects the choice on first launch.
- Update telemetry documentation in cmd/rune/docs to reflect the onboarding
  consent prompt and config persistence behavior.

Closes unstablebuild#86

Signed-off-by: Spandan Mishra <[email protected]>
Turn the Telemetry documentation reference in the bootstrap consent
prompt into a clickable markdown link so users can inspect the full
specification directly in their browser.

Signed-off-by: Spandan Mishra <[email protected]>
Remove dead fallback branches in b.prompt since b.prompter is guaranteed
to be non-nil across all prompt paths. Additionally, update performSwap
to rebind b.prompter to the swapped IDE instance so it does not retain a
reference to the closed pre-IDE.

Signed-off-by: Spandan Mishra <[email protected]>
Streamline the bootstrap wizard telemetry prompt by removing the partial
in-prompt payload example and directing users to the documentation for
the complete specification. Add realistic real-world JSON examples for
both the startup system report and the periodic usage report to the
Telemetry documentation page.

Signed-off-by: Spandan Mishra <[email protected]>
@Spandan-Mishra
Spandan-Mishra force-pushed the feat/bootstrap-telemetry-consent-prompt branch from 9365abb to cb5e169 Compare September 20, 2026 05:52
Comment thread cmd/rune/ide/apiclient/telemetry.go Resolved
Comment thread cmd/rune/docs/docs/learn/telemetry.md Resolved
Comment thread cmd/rune/docs/docs/learn/telemetry.md Outdated
"EditorMode": "standard",
"OS": "linux",
"Arch": "amd64",
"NumCPU": 8,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not collected or sent at all. Can you double check all of these fields. We should show exactly what we're collecting, otherwise what's the point of showing a payload that's not real?

Comment thread cmd/rune/bootstrap_handler.go Outdated
"We never send file names, paths, file contents, terminal output, or " +
"anything you type.\n\n" +
"You can change this any time in ~/.rune/config.yaml. A complete report " +
"and sample payloads are on the [Telemetry](https://docs.rune.build/learn/telemetry/) page in the docs."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this markdown link is not clickable, so it's not a great experience for the user if they try to click it and it doesn't lead anywhere. Drop the link for now, I don't want to refactor how all of the prompts are installed; currently they're not wrapped in a markdown.Handler, only a markdown.Component, so there's no mouse event handling.

Comment thread cmd/rune/bootstrap_test.go Resolved
Comment thread cmd/rune/bootstrap_handler.go Resolved
Comment thread cmd/rune/presets.go Resolved
Comment thread cmd/rune/bootstrap_handler.go Resolved
Spandan-Mishra and others added 3 commits September 21, 2026 11:33
…cleanups

- Remove unused ExampleUsagePayloadJSON and its reflection test.
- Remove duplicate require.NoError in TestRenderPreset.
- Drop unused b.prompter assignment in performSwap.
- Wrap renderPreset format template to stay within line width limits.
- Update telemetry prompt text to refer to "your config" and drop unclickable markdown link.

Signed-off-by: Spandan Mishra <[email protected]>
Replace sample JSON payloads in telemetry.md with verified real-world
examples matching telemetrySystemPayload and telemetryUsagePayload,
correcting the system event type to ClientSystem, removing fabricated
fields like NumCPU, and using the exact wire field names.

Signed-off-by: Spandan Mishra <[email protected]>
@ernestrc
ernestrc enabled auto-merge (squash) September 21, 2026 19:08
@ernestrc
ernestrc merged commit 56c5b6b into unstablebuild:main Sep 21, 2026
8 checks passed
@codecov

codecov Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.68293% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/rune/bootstrap_handler.go 89.65% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

2 participants