Skip to content

feat: track Bundle Upload Compatibility Checked event#2364

Merged
WcaleNieWolny merged 3 commits into
mainfrom
feat/track-bundle-upload-compatibility
May 30, 2026
Merged

feat: track Bundle Upload Compatibility Checked event#2364
WcaleNieWolny merged 3 commits into
mainfrom
feat/track-bundle-upload-compatibility

Conversation

@WcaleNieWolny
Copy link
Copy Markdown
Contributor

@WcaleNieWolny WcaleNieWolny commented May 30, 2026

Why

bundle upload runs the native-compatibility check internally (verifyCompatibilitycheckCompatibilityCloud) but has never emitted an analytics event for the result. The only emitter of Bundle Compatibility Checked is the standalone bundle compatibility command, which few people run.

PostHog (project 22029) confirms the gap over the period since CLI-usage tracking shipped:

Signal Count
bundle upload invocations 320
bundle compatibility command invocations 8
Bundle Compatibility Checked events 8 (exact match → standalone command is the sole source)

So upload-time compatibility outcomes are invisible in PostHog/LogSnag.

What

Emit a new Bundle Upload Compatibility Checked event from verifyCompatibility, via the existing trackEvent pipeline (→ /private/events → PostHog + LogSnag, with global props + org group).

Tags:

  • result: compatible | incompatible | skipped
  • incompatible_count: number
  • reasons: distinct incompatibility reasons (e.g. new_plugin,version_mismatch), when any
  • channel
  • skip_reason: no_remote_metadata | ignore_metadata_check, when skipped

skipped matters: the internal check doesn't run for new channels / channels without remote native_packages / --ignore-metadata-check. Reporting those as skipped keeps the funnel honest instead of silently counting a skip as compatible.

The classification is extracted to a pure, unit-tested helper summarizeUploadCompatibility() in cli/src/bundle/compatibility.ts.

This also unblocks the day-by-day compatible-vs-incompatible PostHog graphs (previously fed only by the standalone command) and is the first slice of the planned "native build needed → try Capgo Builder" CTA.

Notes

  • Fire-and-forget (void trackEvent), consistent with existing CLI telemetry; respects CAPGO_DISABLE_TELEMETRY / CAPGO_DISABLE_POSTHOG.
  • No behavior change to uploads — the compatibility verdict remains non-fatal.

Test plan

  • New unit test tests/upload-compatibility-summary.unit.test.ts (6 cases: skipped/undefined, empty, compatible, new-plugin incompatible, multi-reason aggregation, reason de-dup) — passing.
  • tsc --noEmit clean.
  • CI: oxlint + full CLI suite (oxlint binary not available locally).
  • Manual: run capgo bundle upload against a channel with incompatible native deps and confirm the event appears in PostHog with the expected result/reasons.

Summary by CodeRabbit

  • New Features

    • Bundle uploads now emit analytics with a compact compatibility summary (result: compatible/incompatible/skipped, incompatible count, and distinct reasons) and correctly indicate when remote compatibility checks are skipped.
  • Tests

    • Added unit tests validating classification, incompatible counting, reason aggregation and de-duplication, and skipped-check behavior for compatibility summaries.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d5f9b429-9344-463c-ae92-e635cfecea44

📥 Commits

Reviewing files that changed from the base of the PR and between 8d95972 and 9bfb611.

📒 Files selected for processing (2)
  • cli/src/bundle/upload.ts
  • tests/upload-compatibility-summary.unit.test.ts

📝 Walkthrough

Walkthrough

Bundle compatibility checks now emit analytics events. A new summarization contract in compatibility.ts converts compatibility data into result states (compatible, incompatible, or skipped) with deduplicated reasons and incompatible counts; the upload flow uses this summary and emits a Bundle Upload Compatibility Checked analytics event with optional skip reason.

Changes

Bundle Compatibility Analytics

Layer / File(s) Summary
Compatibility summary contract and tests
cli/src/bundle/compatibility.ts, tests/upload-compatibility-summary.unit.test.ts
New UploadCompatibilityResult union type, UploadCompatibilitySummary interface, and summarizeUploadCompatibility() function classify compatibility outcomes and aggregate/deduplicate incompatibility reasons. Tests validate skipped/compatible/incompatible classification, incompatible counting, multi-package reason aggregation, and reason de-duplication.
Analytics event emission in upload
cli/src/bundle/upload.ts
Imports trackEvent and summarizeUploadCompatibility, updates verifyCompatibility signature to accept orgId, allows finalCompatibility to be undefined, constructs compatibility summary with optional skip_reason, and emits Bundle Upload Compatibility Checked analytics event with tags including result, incompatible_count, reasons, and skip_reason. Also updates call site in uploadBundleInternal to pass orgId.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

codex

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding telemetry event tracking for bundle upload compatibility checks.
Description check ✅ Passed The PR description covers Why, What, Notes, and Test plan sections comprehensively, explaining the motivation, implementation details, and testing approach.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added the codex label May 30, 2026
@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented May 30, 2026

Merging this PR will improve performance by ×2

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 42 untouched benchmarks
⏩ 2 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
/updates manifest response with metadata 235.1 µs 115.6 µs ×2

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing feat/track-bundle-upload-compatibility (8de7275) with main (e9321fb)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52149eca35

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cli/src/bundle/upload.ts
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/upload-compatibility-summary.unit.test.ts`:
- Around line 38-90: Update the test cases in the describe block for
summarizeUploadCompatibility to use it.concurrent() instead of it() so they run
in parallel; change each test call (the ones invoking
summarizeUploadCompatibility, e.g., the tests for undefined input, empty array,
compatibleSameVersion/removedRemoteOnly, newPlugin, aggregation of
versionMismatch and iosCodeChanged, and de-duplication of versionMismatch) to
it.concurrent(...) while keeping test bodies and expectations unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b1060e4a-2dfe-4319-b963-0770f8e2cdc8

📥 Commits

Reviewing files that changed from the base of the PR and between fe0a674 and 52149ec.

📒 Files selected for processing (3)
  • cli/src/bundle/compatibility.ts
  • cli/src/bundle/upload.ts
  • tests/upload-compatibility-summary.unit.test.ts

Comment thread tests/upload-compatibility-summary.unit.test.ts
bundle upload runs the native-compatibility check internally but never emitted an analytics event for it — only the standalone `bundle compatibility` command did. PostHog confirmed the gap (8 events, all from the standalone command, vs 320 `bundle upload` invocations).

Emit `Bundle Upload Compatibility Checked` from verifyCompatibility with a three-valued result (compatible | incompatible | skipped), incompatible count, distinct reasons, channel, and a skip_reason. The "skipped" result covers new channels / no remote metadata / --ignore-metadata-check so a skip is never miscounted as compatible.

Logic extracted to a pure, unit-tested summarizeUploadCompatibility helper.
@WcaleNieWolny WcaleNieWolny force-pushed the feat/track-bundle-upload-compatibility branch from 52149ec to 8d95972 Compare May 30, 2026 05:26
…rrently

- Thread the already-resolved orgId through verifyCompatibility into the `Bundle Upload Compatibility Checked` event. trackEvent() only auto-resolves the org when both appId and orgId are omitted, so passing appId alone would have sent the event without the PostHog organization group (breaking per-org grouping). (Codex P2)
- Use it.concurrent() for the pure summarizeUploadCompatibility tests. (CodeRabbit)
@sonarqubecloud
Copy link
Copy Markdown

@WcaleNieWolny WcaleNieWolny merged commit c643fd1 into main May 30, 2026
44 checks passed
@WcaleNieWolny WcaleNieWolny deleted the feat/track-bundle-upload-compatibility branch May 30, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant