Skip to content

feat(tui): add first-run error reporting opt-in prompt#566

Merged
wizzomafizzo merged 12 commits intomainfrom
feat/error-reporting-prompt
Mar 20, 2026
Merged

feat(tui): add first-run error reporting opt-in prompt#566
wizzomafizzo merged 12 commits intomainfrom
feat/error-reporting-prompt

Conversation

@wizzomafizzo
Copy link
Member

Summary

  • Shows a modal dialog on first TUI launch asking users to opt in to anonymous error reporting
  • Three buttons: "Enable" (opts in via API), "Not Now" (re-asks next launch), "Don't Ask Again" (permanently suppresses)
  • Adds error_reporting_prompted field to tui.toml to persist permanent decisions
  • Only shows when the service is running and error reporting isn't already enabled
  • Existing users with a tui.toml will see the prompt since the new field defaults to false

Show a modal dialog on TUI launch asking users to opt in to anonymous
error reporting. Three options: "Enable" (turns on via API, marks as
prompted), "Not Now" (dismisses, re-shows next launch), and "Don't Ask
Again" (permanently suppresses the prompt).

Adds ErrorReportingPrompted field to TUIConfig in tui.toml to persist
the user's permanent decision. Only shows when the service is running
(required for API call) and error reporting isn't already enabled.
@sentry
Copy link

sentry bot commented Mar 18, 2026

Codecov Report

❌ Patch coverage is 39.18919% with 45 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/ui/tui/main.go 0.00% 32 Missing ⚠️
pkg/readers/testutils/testutils.go 0.00% 7 Missing ⚠️
pkg/service/service.go 0.00% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

…/Get/Set

Covers the new ErrorReportingPrompted field in applyTUIDefaults, plus
existing TUI config functions that had no test coverage.
…focus

SetRoot with enableFocus=true resets focus to the root widget, which
was overriding the modal's focus set by ShowErrorReportingPrompt.
…al config

The service daemon runs as a separate process with its own in-memory
config. When settings are updated via the API, the daemon's Save()
writes its entire in-memory config to disk, overwriting manual edits.
Checking the service's actual state prevents the prompt from showing
when the daemon already has error reporting enabled.

Also moves SetRoot before the prompt so focus isn't stolen.
The slug search cache build reads 129K entries on MiSTer and takes ~21
seconds on its hardware. This blocked the entire service startup
sequence, preventing the API server from binding until complete.

The cache is stored behind an atomic.Pointer and all consumers already
check for nil and fall back to SQL queries, so building it
asynchronously is safe.
Move the slug search cache build from OpenMediaDB to after the API
server starts in service.go. MediaDB uses SetMaxOpenConns(1), so the
cache's 129K row scan was monopolizing the single SQLite connection
and blocking migrations and all other DB access during startup.
The Connected() assert after max errors was racy — the reader
goroutine may not have called Close() yet when the test checks.
Use WaitForCondition polling instead of sleep.
@wizzomafizzo wizzomafizzo merged commit 67c8c20 into main Mar 20, 2026
9 checks passed
@wizzomafizzo wizzomafizzo deleted the feat/error-reporting-prompt branch March 20, 2026 03:51
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