Skip to content

CLI-1575 Track CI onboarding PR and MR creations - #1333

Merged
zglicz merged 5 commits into
codex/CLI-1557-github-commandfrom
codex/CLI-1575-onboarding-telemetry
Nov 26, 2026
Merged

zglicz merged 5 commits into
codex/CLI-1557-github-commandfrom
codex/CLI-1575-onboarding-telemetry

Conversation

@zglicz

@zglicz zglicz commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Emits one CliCiOnboarding event per live GitHub/GitLab onboarding invocation, with the platform, confirmed PR/MR creations and repository failures (CLI-1575).

  • Keep partial counts when the command fails, using the existing consent and post-action telemetry pipeline. Dry runs emit no onboarding event.
  • Count confirmed creations; exclude existing or recovered requests. The payload contains no repository names, request URLs, tokens or workflow contents.

Covered by onboarding integration tests for counts, partial failures, reruns, dry runs, consent and recovered PRs. Merge, analysis and retention metrics remain follow-up work.

Stacked on #1318.

@zglicz
zglicz added this pull request to stack #1297 November 20, 2026 14:13
@netlify

netlify Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for sonarqube-cli canceled.

Name Link
🔨 Latest commit 28484c0
🔍 Latest deploy log https://app.netlify.com/projects/sonarqube-cli/deploys/6b0801d92ee55fea03790ca1

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

CLI-1575

Comment thread src/commands/command-tree.ts Resolved
@datadog-sonarsource

datadog-sonarsource Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Pipelines

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 28484c0 | Docs | Give us feedback!

@zglicz
zglicz force-pushed the codex/CLI-1575-onboarding-telemetry branch from 5ce913e to 58aa8ac Compare November 23, 2026 10:13
@zglicz
zglicz marked this pull request as ready for review November 23, 2026 10:36
@zglicz
zglicz requested review from a team as code owners November 23, 2026 10:36

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason why we are not tracking skipped count in telemetry?

@zglicz
zglicz force-pushed the codex/CLI-1575-onboarding-telemetry branch 3 times, most recently from 6366fbc to 602863f Compare November 24, 2026 15:12
@zglicz
zglicz force-pushed the codex/CLI-1575-onboarding-telemetry branch from 602863f to 89da4ac Compare November 25, 2026 09:43
@zglicz
zglicz force-pushed the codex/CLI-1575-onboarding-telemetry branch from 89da4ac to 92cf0cf Compare November 25, 2026 15:01
@zglicz
zglicz force-pushed the codex/CLI-1575-onboarding-telemetry branch from 92cf0cf to 70219f6 Compare November 25, 2026 17:14
@zglicz
zglicz force-pushed the codex/CLI-1575-onboarding-telemetry branch from 70219f6 to 28484c0 Compare November 26, 2026 09:54
@zglicz

zglicz commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Is there a reason why we are not tracking skipped count in telemetry?

From my POV, I think that skipped can be a very inflated metric. The PR creation count will give much more signal. If you re-run the same command for the entire org, the skip count would keep on rising.

@gitar-bot

gitar-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 2 closed / 2 findings

Adding consent-gated onboarding telemetry for platform and PR/MR counts could increase collection of aggregate usage activity.

Adds a CliCiOnboarding telemetry event for each live GitHub/GitLab onboarding run, reporting the platform and counts of confirmed PR/MR creations and repository failures, with partial counts kept on failure and no event for dry runs. Two issues were resolved: dry-run telemetry assertions now check the real behavior rather than only the test helper's branch, and server-side GitLab onboarding no longer reports zero creations. No open issues found.

✅ 2 closed
✅ Quality: Dry-run telemetry assertions only check the test helper's own branch

📄 tests/integration/specs/admin/onboard-ci-github.test.ts:135-142 📄 tests/integration/specs/admin/onboard-ci-github.test.ts:197 📄 tests/integration/specs/admin/onboard-ci-github.test.ts:268-269 📄 src/commands/command-tree.ts:1403-1407
The setup().run helper in onboard-ci-github.test.ts copies the production dry-run gate (if (!options.dryRun) { telemetry = new OnboardingTelemetry(...); telemetryEvents.push(telemetry) }). That means expect(telemetryEvents).toHaveLength(0) after a dry run (line 197), and toHaveLength(2) after the extra dry run (lines 268-269), only confirm that the helper skipped its own push. They never run the command-tree code at command-tree.ts:1403-1407 that decides whether the fact gets recorded, so they would still pass if production started emitting CliCiOnboarding on dry runs. The CLI-level checks (github test line 361, gitlab test line 719) do cover this path. Drop these helper-level assertions, or route them through harness.run(... --dry-run) with telemetry enabled and read the event queue.

✅ Cross-PR: Server-side GitLab onboarding would always report zero creations

📄 src/commands/command-tree.ts:1379-1388 📄 src/commands/admin/onboard-ci/gitlab/index.ts
Breaks when this PR and #1325 both merge, and a live admin onboard-ci gitlab run takes #1325's server-side path. That path is the default when the capability probe reports GitLab support, or it can be forced with --server-side.

How

  1. src/commands/command-tree.ts:1379-1388 registers an OnboardingTelemetry('GitLab') fact for live runs and passes it into onboardCiGitlab.
  2. In this PR, the counters change only inside runRepos in src/commands/admin/onboard-ci/shared.ts (addCreated on opened with created, addFailed in the catch).
  3. GROW-703 Run onboard-ci gitlab on the server when available #1325 adds a branch at src/commands/admin/onboard-ci/gitlab/index.ts:449 that returns through onboardCiGitlabServerSide and writes results from the server's run items. It never calls runRepos and never touches the telemetry fact.
  4. postAction still sends the fact, so the event goes out as created_count: 0, failed_count: 0 even when MRs were opened or repositories failed.

Fix

Compared b60f763 with #1325 at b8c1171

Verification Rules 3/3 met PRs 3 inspected

Functional validation No results

Rules 3 passed 2 not applicable

✅ Internal artifact registries
✅ Release secrets usage
✅ Repository license compliance

Broader impact PRs 3 inspected
Cross-PR 3 PRs inspected 0 open impacts

PR 1383: Share DevOps write pacing and rate-limit cooldowns Inspected
PR 1318: CLI-1557 Add bulk GitHub CI onboarding command Inspected
PR 1311: CLI-1556 Assess GitHub repositories and create onboarding PRs Inspected

Auto-approval Withheld

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

Copy link
Copy Markdown

@zglicz
zglicz merged commit a019a4e into master Nov 26, 2026
29 of 41 checks passed
@zglicz
zglicz deleted the codex/CLI-1575-onboarding-telemetry branch November 26, 2026 10:35
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