Repository navigation
[MVP] Windows installer funnel telemetry (off by default) - #141
Draft
IliaMManolov wants to merge 6 commits into
Draft
IliaMManolov wants to merge 6 commits into
IliaMManolov wants to merge 6 commits into
Conversation
The installer now reports anonymous funnel events (installer_started, installer_step, installer_finished with outcome and exit code) to a PostHog capture endpoint, and the app sends app_first_launch with the same random install_id. It is compiled in only when SG_INSTALL_TELEMETRY_URL and SG_INSTALL_TELEMETRY_KEY are set at build time, so release builds are unchanged until the compliance review. - build/installerTelemetry.nsh: WinHTTP sender with short timeouts, NSIS hooks, /NOTELEMETRY and DO_NOT_TRACK opt-outs - scripts/installer-telemetry-config.mjs: writes the git-ignored switch file - scripts/mock-capture-server.mjs: local stand-in for PostHog in tests - src/main/infra/installTelemetry.ts: first-launch event via net.fetch - docs/installer-telemetry.md: funnel, privacy notes, Windows VM test plan Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WiFcRTVRzq2KVKYAgvKyNK
- installer_previous_run_incomplete: the run id and last step stay in HKCU\Software\SealGate\InstallTelemetry until the run reports its end, so the hard Quit paths (locked files, app cannot be closed, killed process) show up on the next attempt - cap WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT (90 s by default) and set timeouts on the request handle; an endpoint that never answers hung the installer before this - stop sending for the rest of the run after the first failed request - use the user's proxy settings (WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY) - blocking_dialog on a silent run whose old uninstaller failed - real uninstall removes the telemetry registry key and marker - mock server: MOCK_CAPTURE_HANG=1 black-hole mode - docs: per-build PostHog plan, more VM test cases Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WiFcRUnhb9PzJb7nDzwNL9
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WiFcRTVRzq2KVKYAgvKyNK
- build:win scripts run the config script first, so a stale test config can never ship in a later local build - seconds_since_install keeps the install time across retries - one owner for electron-builder hooks: installer.nsh defines customInstall/customPageAfterChangeDir and calls sgIt* macros that are empty when telemetry is off; drop the SG_IT_HOOK_INIT indirection - pin electron-builder's handleUninstallResult in a test, since customUnInstallCheck reproduces its default by hand - circuit breaker also trips on a send slower than 1 s (slow proxy discovery) - upgrade comes from the registry folders, not the /currentuser flags - no run record in the elevated inner instance - rename old_version_checked to old_version_handled (fires on fresh installs) - simpler app send: typed PostFn, no Promise.race, one log line Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WiFcRTVRzq2KVKYAgvKyNK
The installer and first-launch events never use the dashboard key. The docs list the project settings to create (Discard client IP data on, no autocapture or replay, short retention) and how a workflow turns it on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WiFcRTVRzq2KVKYAgvKyNK
4 of 5 tasks
The dashboard can serve the installer as SealGate-<ver>-<arch>-setup_dl-<16 hex>.exe. The installer reads the id from its file name (Zone.Identifier HostUrl/ReferrerUrl as a fallback) and sends download_id on every event; the marker passes it to app_first_launch. No id, or a malformed one, sends no field and changes nothing else. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WiFcRTVRzq2KVKYAgvKyNK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MVP for Ilia's review. Do not merge. It needs a GDPR/compliance review before any release build turns it on.
Summary
Users log in on the dashboard but drop off before the desktop app is installed and running. This PR adds anonymous funnel events so that we can see where a Windows install stops.
desktop_installer_download_clickedinstaller_started.onInitinstaller_stepinstall_clickedinstaller_stepold_version_handled+exit_codeinstaller_stepfiles_installedinstaller_finishedsuccess/failed/cancelled(+exit_code/error_level/blocking_dialog)installer_previous_run_incompleteQuitpaths, killed process)app_first_launchinstall_idSG_INSTALL_TELEMETRY_URLandSG_INSTALL_TELEMETRY_KEYare set at build time (scripts/installer-telemetry-config.mjswrites a git-ignored include; thebuild:win*scripts run it first). Without them, the installer logic is unchanged. No CI workflow sets them, so dev, demo and release all stay off until the review.install_idis a random GUID for each installer run. Events set$process_person_profile: falseand$geoip_disable: true. No user, machine, path or account data is sent.net.fetchwith a 3 s timeout and does not block startup./NOTELEMETRY,DO_NOT_TRACK=1orSEALGATE_NO_TELEMETRY=1. The app also sends nothing forcustom,localanddevbackends.The full design, privacy notes, known gaps and a manual Windows VM test plan (cases A to N) are in
packages/desktop/docs/installer-telemetry.md.Per-download id
The edison-watch side (being built on #1846) serves the installer as
SealGate-<ver>-<arch>-setup_dl-<16 hex>.exe, with a random id per download. The id is not stored and not linked to the user.(1)suffix does not matter._dl-<id>token in theHostUrlorReferrerUrlline of its Zone.Identifier stream.download_idanddownload_id_source, and the marker passes both toapp_first_launch.Dashboard side
This is Edison-Watch/edison-watch#1846. It instruments the shared
downloadClienthelper, with the propertiesplatform,found,app_versionandasset. The per-download id joins the download to the install for each download. The dashboard event that is linked to the logged-in user does not carry the id.Findings
Quitpaths ("SealGate cannot be closed", locked files, decompression failed) skip all NSIS callbacks. They are now reported on the next attempt asinstaller_previous_run_incomplete.MessageBoxwith no/SDdefault, so a silent auto-update can wait on a dialog. The event carriesblocking_dialog=true. The fix is the separate PR Stop silent updates from waiting on the "Failed to uninstall" dialog #142. Both PRs definecustomUnInstallCheck, so the second to merge gets a small conflict, which I will resolve.customUnInstallCheckreplaces electron-builder's default handling of the uninstaller result. The macro reproduces the app-builder-lib 26.x default, andnsisUninstallCheck.test.tspins the upstream function.Code review
A strict maintainability review ran on the diff. Fixed in f76282d:
build:win*scripts now regenerate the config, so a stale test endpoint cannot ship.seconds_since_installis now correct on retries.installer.nshis now the one owner of the electron-builder hooks.upgradeno longer depends on the/currentuserflag.old_version_handled.Not taken: the app does not move to the env-config PostHog key. The marker keeps the installer's endpoint, so that the installer and the app always report to the same project.
Test plan
npm run typecheck,npx vitest run: 230 tests pass, 20 of them new.-WX), with telemetry on and off.scripts/mock-capture-server.mjs), never the production PostHog or Sentry:success. The upgrade sendsupgrade=true. The cancel sendscancelled.failedwithexit_code=1./NOTELEMETRYandDO_NOT_TRACKall send 0 events._dl-<16 hex>: found.(1)suffix: found.app_first_launch: Electron's main loop hangs under wine, so this step ran on the Linux build of the same app, reading the marker that the wine install wrote.🤖 Generated with Claude Code
https://claude.ai/code/session_01WiFcRTVRzq2KVKYAgvKyNK