Repository navigation
CLI-981 Import telemetry: emit UserOnboardingStarted / Completed / Exited - #698
bjorn-vonubisch-sonarsource wants to merge 4 commits into
Conversation
…d events Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
✅ Deploy Preview for sonarqube-cli canceled.
|
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Inline resolveOrgAndRepos into importHandler so almKey is assigned before assertSupportedAlm; UserOnboardingExited now carries the real devops_platform even when the ALM is unsupported - Add unit tests for emitUserOnboardingStarted/Completed/Exited covering envelope shape, lean payload (no CLI identity fields), and telemetry- disabled no-ops Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code Review ✅ Approved 4 closed / 4 findingsAdds import telemetry events for onboarding started, completed, and exited states with unit test coverage. Consider refining how null onboarding fields and unauthenticated ALM keys are handled during serialization. ✅ 4 closed✅ Edge Case: Exited event reports null ALM for unsupported-ALM errors
✅ Quality: New telemetry emit functions have no unit tests
Closed: Edge Case: Always-null onboarding fields are stripped before transmit
Closed: Edge Case: Exited event reports null ALM if entitlement check rejects
Review coverageFunctional validation No results OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
…ctions Extract `appendLeanOnboardingEvent` private helper shared by `emitUserOnboardingStarted` and `emitUserOnboardingExited`, which had identical bodies differing only in event type. Also fix Prettier formatting on import/index.ts to pass the lint check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|



Summary
Adds three Gessie telemetry events to
sonar importthat mirror the sonarcloud-webapp's onboarding event schema, withsource: 'cli'instead of'ui'.Events
Analytics.Cli.UserOnboardingStartedFired at the very start of
importHandler, immediately after the intro banner, before any org or repo resolution happens.devops_platformstring | nullnullat start (ALM not yet resolved)planstring | nullnull(not available in CLI context)source'cli'user_uuidstring | nullversionstring1.2.3)Analytics.Cli.UserOnboardingCompletedFired after the import job finishes (whether all repos succeeded or some failed), before
reportOutcomerenders the result. Fires for both the streaming (--all/--regex) and batch (--repo) flows.devops_platformstring | nullgithub,azure), ornullif unavailableimport_method'bulk' | 'single''bulk'for streaming (--all/--regex),'single'for batch (--repo)organization_uuid_v4string | nullplanstring | nullnull(not available in CLI context)project_countnumbersource'cli'user_uuidstring | nullversionstringAnalytics.Cli.UserOnboardingExitedFired when the flow is aborted before
UserOnboardingCompleted— i.e. any error that prevents the import from finishing (org not found, unsupported ALM, page-fetch failure mid-stream, etc.). Not fired whenreportOutcomethrows due to partial repo failures, becauseUserOnboardingCompletedhas already been emitted by then.destinationstring'error'(type of cancellation)devops_platformstring | nullnullplanstring | nullnullsource'cli'user_uuidstring | nullversionstringImplementation notes
TelemetryEventIdentityPayload— they carry onlyuser_uuid/organization_uuid_v4drawn from the identity base, matching the lean webapp schema.event_version: '0'is set in metadata on all three events (matching webapp convention)..catch(() => {})), so a telemetry failure never affects the import result.completedEmittedflag gatesUserOnboardingExited: set totrueafter eachemitUserOnboardingCompletedcall, checked in the catch block to avoid double-firing.Test plan
sonar importagainst a real org and verify the three events land intelemetry-events.ndjsonUserOnboardingExitedfires withdevops_platform: nullUserOnboardingExitedfires with the correctdevops_platformUserOnboardingCompletedfires (notUserOnboardingExited)🤖 Generated with Claude Code