Repository navigation
fix(telemetry): label auth add/switch events with the newly active site - #28
cb-muthiahm wants to merge 1 commit into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. WalkthroughAuth profile commands now record the resulting active site for telemetry events. The telemetry recorder consumes that site when finalizing an event, and tests cover command outcomes and slot reset behavior. ChangesActive site telemetry
Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Suggested reviewers: Merge Risk:
|
Test coverage✅ Gate passed — all 79 files are at or above the 95% floor.
|
Summary
Telemetry events for
auth addandauth switchcarried the site that was active before the command ran:unconfiguredfor a firstauth add, otherwise the previous profile's site. The recorder reads the site inpreAction, before the action saves the new active profile. These events now carry the site the command made active.preAction begin() pending.siteName = peekActiveSiteName() # before the action runs action (auth add / auth switch) writeConfig({ activeProfile }) + noteActiveSite(site) exit finalize() - site_name: pending.siteName + site_name: takeActiveSite() ?? pending.siteNamenoteActiveSitelives in a dependency-free module (telemetry/active-site.ts), followingerror.tsandinteractive.ts, so commands don't import the recorder. A failed command never reaches the call and keeps its previous label.Changes
src/lib/telemetry/active-site.ts: newnoteActiveSite/takeActiveSiteslot.src/lib/telemetry/index.ts:finalize()prefers the noted site; the test reset clears it.src/commands/auth.ts,src/lib/config/switch-profile.ts: note the site once the profile is saved as active.src/lib/test-support/_helpers.ts:runCliaccepts an optionalconfigurehook, so integration tests can install the recorder on the real program.auth add,auth addover an active profile,auth switch, a failedauth add, an ordinary command, and telemetry disabled.TELEMETRY.md: documentssite_nameforauth addandauth switch.New integration tests, run against
mainwithout the fix:auth addforacme-testunconfiguredacme-testauth addforglobex-testwhileacme-testis activeacme-testglobex-testauth switch dev(acme-test) fromglobex-testglobex-testacme-testauth addwith an invalid site whileacme-testis activeacme-testacme-testType of change
Checklist
bun testpassesbun run typecheckpassesbun run generate --refreshand committed the regeneratedsrc/commands/generated/*Related issues
auth addandauth switchnow record the site they make active. Telemetry uses that site for successful commands and falls back to the previously active site when no new site is recorded. Added unit and integration tests for site tracking and telemetry labels.