fix(kit): sync store products end to end - #208
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces upstream product deletion capabilities for both App Store Connect and Google Play Console, allowing kit-authored 'Removed' products to be deleted from upstream stores during sync. It also adds support for individual App Store Connect API keys that omit an issuer ID, preserves kit-authored removals during pull-sync, and updates the UI and MCP tools to reflect these deletion flows. The review feedback identifies two critical issues in the Google Play sync implementation: the 'googleErrorStatus' helper fails to correctly extract HTTP status codes from 'gaxios' errors, which prevents proper detection of 404 errors, and the sync process incorrectly attempts to activate purchase options on legacy in-app products, which is unnecessary and likely to cause sync failures.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Warning Review limit reached
Next review available in: 40 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR adds kit-authored product removal handling across sync flows, updates App Store Connect and Google Play product sync behavior, refreshes product UI/MCP wording, and adds a Codex Petgu E2E skill with agent config. ChangesProduct removal and store sync changes
Codex E2E skill documentation
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces upstream product and subscription deletion capabilities for both App Store Connect (iOS) and Google Play Console (Android) during push/both sync directions, while preserving kit-authored 'Removed' rows during pull-sync to prevent premature resurrection. It also adds support for individual App Store Connect API keys (which omit the issuer ID), moves edited products back to 'Draft' state to queue them for a sync push, and introduces a Codex skill for Petgu E2E testing. The review feedback highlights several critical issues: a potential failure in the Google Play legacy fallback path due to an unnecessary purchase option activation, an incorrect HTTP status check for Google API errors that breaks 404 detection, a redundant conditional check in the App Store Connect credential resolver, and an N+1 query pattern in the Android pull-sync loop that should be optimized to avoid sequential database round-trips.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/kit/convex/products/asc.ts (1)
566-644: 🗄️ Data Integrity & Integration | 🔴 Critical | 🏗️ Heavy liftUse the subscription price change endpoint here, not
PATCHon the subscription. Apple’s pricing flow is per-territory; sending a single USApricesentry through the subscription relationship risks replacing the full schedule and dropping the other territories. Switch this path back to per-territoryPOST /v1/subscriptionPricesupdates.🤖 Prompt for 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. In `@packages/kit/convex/products/asc.ts` around lines 566 - 644, The pricing update in setSubPriceSchedule is using a PATCH to the subscription with a single USA prices relationship, which can overwrite the full schedule. Update this flow to use the per-territory subscription price change path by routing through createSubPriceChange and posting to /v1/subscriptionPrices, keeping the existing attributes, subscriptionPricePoint, and territory wiring intact.
🧹 Nitpick comments (2)
.codex/skills/iapkit-e2e-petgu/SKILL.md (1)
14-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake the default paths portable.
These references are pinned to one home directory, so anyone with a different checkout layout will need to edit the skill. Prefer repo-relative paths or environment variables for the repo, Petgu checkout, and rule files.
Also applies to: 41-43
🤖 Prompt for 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. In @.codex/skills/iapkit-e2e-petgu/SKILL.md around lines 14 - 24, The hardcoded absolute paths and local-only URLs in SKILL.md make the default setup non-portable. Update the IAPKit E2E skill references to use repo-relative paths or environment-based placeholders for the OpenIAP repo, Kit package, Petgu checkout, and rule files, and keep the identifying labels like "OpenIAP repo", "Kit package", and "Petgu app" so the targets remain clear without a specific home directory.packages/kit/convex/products/sync.ts (1)
454-533: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low value
deleteRemovedProductRowdoesn't re-checkorigin/storeRef, relying entirely on callers pre-filtering.The delete guard only checks
existing.state === "Removed"— it doesn't re-verify theorigin === "kit" || storeRef === undefinedcondition thatremovedProductsForPushuses to select candidates. In the current wiring this is safe because the only callers are expected to pass ids sourced fromlistRemovedIosProducts/listRemovedAndroidProducts, but as a standalone internal mutation it would happily delete a store-authoredRemovedrow (e.g. one pulled withorigin: "store") if ever invoked with such an id directly.🛡️ Optional defensive check
- if (!existing || existing.state !== "Removed") return false; + if ( + !existing || + existing.state !== "Removed" || + !(existing.origin === "kit" || existing.storeRef === undefined) + ) { + return false; + }🤖 Prompt for 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. In `@packages/kit/convex/products/sync.ts` around lines 454 - 533, The delete guard in deleteRemovedProductRow only checks that the row is Removed, so it can still delete store-authored removed rows if called directly. Update the handler to re-apply the same eligibility check used by removedProductsForPush, namely origin === "kit" || storeRef === undefined, before deleting. Keep the logic aligned with listRemovedIosProducts and listRemovedAndroidProducts so the mutation remains safe even when invoked outside those query paths.
🤖 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 `@packages/kit/convex/products/play.ts`:
- Around line 1116-1153: The delete flow in play.ts is swallowing failures from
the modern one-time product endpoint. In the
deleteModernAndroidOneTimeProduct/onetime.delete path, keep the existing 404
handling for Google not-found errors, but re-throw any other error instead of
falling back to androidpublisher.inappproducts.delete; only use the legacy
fallback when the modern endpoint is truly unavailable or returns not-found.
This preserves errors from monetization.onetimeproducts.delete and prevents
masking auth/transient failures.
---
Outside diff comments:
In `@packages/kit/convex/products/asc.ts`:
- Around line 566-644: The pricing update in setSubPriceSchedule is using a
PATCH to the subscription with a single USA prices relationship, which can
overwrite the full schedule. Update this flow to use the per-territory
subscription price change path by routing through createSubPriceChange and
posting to /v1/subscriptionPrices, keeping the existing attributes,
subscriptionPricePoint, and territory wiring intact.
---
Nitpick comments:
In @.codex/skills/iapkit-e2e-petgu/SKILL.md:
- Around line 14-24: The hardcoded absolute paths and local-only URLs in
SKILL.md make the default setup non-portable. Update the IAPKit E2E skill
references to use repo-relative paths or environment-based placeholders for the
OpenIAP repo, Kit package, Petgu checkout, and rule files, and keep the
identifying labels like "OpenIAP repo", "Kit package", and "Petgu app" so the
targets remain clear without a specific home directory.
In `@packages/kit/convex/products/sync.ts`:
- Around line 454-533: The delete guard in deleteRemovedProductRow only checks
that the row is Removed, so it can still delete store-authored removed rows if
called directly. Update the handler to re-apply the same eligibility check used
by removedProductsForPush, namely origin === "kit" || storeRef === undefined,
before deleting. Keep the logic aligned with listRemovedIosProducts and
listRemovedAndroidProducts so the mutation remains safe even when invoked
outside those query paths.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 273479a5-418f-43be-a844-0cd134046a69
📒 Files selected for processing (13)
.codex/skills/iapkit-e2e-petgu/SKILL.md.codex/skills/iapkit-e2e-petgu/agents/openai.yamlpackages/kit/convex/products/asc.tspackages/kit/convex/products/jwt.test.tspackages/kit/convex/products/jwt.tspackages/kit/convex/products/mutation.test.tspackages/kit/convex/products/mutation.tspackages/kit/convex/products/play.tspackages/kit/convex/products/sync.test.tspackages/kit/convex/products/sync.tspackages/kit/convex/schema.tspackages/kit/src/pages/auth/organization/project/products.tsxpackages/mcp-server/src/mcp.ts
There was a problem hiding this comment.
Code Review
This pull request introduces support for upstream product and subscription deletion in both App Store Connect (iOS) and Google Play Console (Android) during product sync. Key changes include updating App Store Connect API integrations to use v2 endpoints, supporting individual API keys (omitting issuer ID) in JWT generation, and implementing robust deletion flows that prevent pull-sync from resurrecting kit-deleted products before they are deleted upstream. Additionally, it adds a new Codex skill for E2E testing with the Petgu app, introduces modern Google Play one-time product management with legacy fallbacks, and updates the dashboard UI to reflect deletion states and constraints. I have no feedback to provide on these changes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Addressed the latest CodeRabbit follow-ups in 87f445b.\n\nChanges:\n- setSubPriceSchedule now routes through /v1/subscriptionPrices.\n- modern Play one-time delete no longer masks non-404 errors.\n- deleteRemovedProductRow re-checks kit-authored removal eligibility.\n- IAPKit Petgu E2E skill paths now use environment placeholders. |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
Summary
Verification
Notes
Summary by CodeRabbit