fix(cli): use bundle compatibility endpoint#2421
Conversation
|
Warning Review limit reached
More reviews will be available in 24 minutes and 22 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds optional backend-driven compatibility checking for native bundle uploads. The CLI now calls a Supabase Edge Function to compare baseline and candidate bundle compatibility; on success it maps and returns the backend-derived results, otherwise it falls back to the existing client-side compatibility logic. ChangesBackend Bundle Compatibility
Possibly related PRs
Suggested labels
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81a8fb0a0e
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@cli/src/utils.ts`:
- Around line 2066-2097: The function checkCompatibilityWithBackend should
short-circuit when nativePackages is empty to avoid the backend round trip: add
an early check at the top of checkCompatibilityWithBackend (using
nativePackages.length === 0) and return an empty Compatibility[] immediately,
before calling getChannelBaselineBundleId or supabase.functions.invoke, so
callers get an empty comparisons array without performing the network request.
- Around line 2066-2097: The checkCompatibilityWithBackend function currently
swallows all errors and backend error responses and returns null; add optional
debug logging to surface failures: when supabase.functions.invoke returns an
error or no data, call a logger/debug method (e.g., console.debug or a passed-in
logger) with contextual info (appId, channel, baselineBundleId, and the returned
error) before returning null, and in the catch block log the caught exception
similarly; reference the function checkCompatibilityWithBackend, the
supabase.functions.invoke call, and mapBackendCompatibilityResponse to locate
where to insert these logs.
- Line 2062: Replace the unsafe cast used to get the version id: instead of
(data.version as any)?.id, introduce a proper Version type or a runtime type
guard and use that to access id (e.g., declare an interface Version { id?:
string } and narrow data.version to Version, or check typeof/data.version !==
null and 'id' in data.version). Update the expression that sets bundleId to use
the narrowed type (or guarded access) so TypeScript can validate the property
access and avoid using any; target symbols: bundleId and data.version.
🪄 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: 59afc811-ed3b-4016-a447-dff76c0e0898
📒 Files selected for processing (2)
cli/src/utils.tstests/cli-backend-compatibility-map.unit.test.ts
|



Summary (AI generated)
/private/bundle_compatibility/compareendpoint when available.Motivation (AI generated)
The dashboard compatibility alert now uses the backend compatibility service, but the CLI still duplicated the comparison locally. The CLI should use the same backend logic so uploads, explicit
bundle compatibility, build-needed checks, and channel compatibility checks stay aligned with the dashboard.Business Impact (AI generated)
This reduces inconsistent compatibility verdicts between CLI and dashboard, which lowers support risk around OTA safety and makes the new backend endpoint the shared source of truth for compatibility decisions.
Test Plan (AI generated)
bunx vitest run tests/cli-backend-compatibility-map.unit.test.ts tests/upload-compatibility-summary.unit.test.ts tests/backend-bundle-compatibility.unit.test.ts tests/bundle-compatibility.unit.test.tsbun run cli:lintbun run cli:typecheckbun run cli:checkwas started and passed lint/typecheck/build plus most CLI tests, then stopped to avoid blocking the session; CI will run the full suite on this PR.Summary by CodeRabbit
New Features
Tests