363 fix(shop): use atomic RPC to prevent concurrent points data loss#369
363 fix(shop): use atomic RPC to prevent concurrent points data loss#369Logesh-Pro wants to merge 36 commits into
Conversation
|
@Logesh-Pro is attempting to deploy a commit to the ixotic27-8245's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
👋 Hey @Logesh-Pro, it looks like you didn't use our PR template! The section Please update your PR description to include all required sections so we can review this properly:
You can find the full template in CONTRIBUTING.md. Just edit your PR description and the |
|
Hi @Ixotic27 , thank you for the feedback. I've looked into the CI failure. It appears the CI Pipeline / Production Build is failing due to a Node.js version deprecation/environment issue (Node.js 20 is deprecated... forced to run on Node.js 24). My code changes are limited to the shop's point-deduction logic and an atomic SQL migration, which pass the Lint and Security checks successfully. Could someone please check if the environment configuration needs an update to support the newer Node.js runner? Thank you! |
|
Hi @Logesh-Pro! 👋 I've reviewed your PR code for resolving issue #363: It looks like your PR has a couple of bugs preventing it from building and running correctly:
Please fix these bugs so we can review it again! Thank you! |
use node js 24 |
…ogesh-Pro/The-Leetcode-City into 363-fix-atomic-points-rollback
|
Hi @Logesh-Pro! 👋 I've reviewed your PR code for resolving issue #363. There are a couple of bugs in the point purchase flow:
Please address these points so we can review your PR again! Thank you! |
…ogesh-Pro/The-Leetcode-City into 363-fix-atomic-points-rollback
|
Hi @Ixotic27, thank you for the feedback! I have updated the point purchase flow to address those points: Dynamic RPC Status: The process_purchase RPC now accepts an optional p_status parameter. I updated the route to dynamically set this to 'completed' for unique, non-consumable items and 'delivered' for consumables, ensuring compatibility with the database index constraints. Consumable Support: I added logic to grant battle consumables to the user_inventory table during the purchase flow, ensuring they are correctly supported alongside streak_freeze. The code is ready for another review. Thank you! |
|
🚨 Hey @Logesh-Pro, the CI Pipeline is failing on this PR and it has been marked as 🔍 What failed:
📋 Error Details (first 2):
Please fix the issues before this can be reviewed. Here's how: 1. Run checks locally before pushing: npm run lint # Run ESLint
npm run build # Verify production build passes2. Auto-fix common issues: npm run lint -- --fix # Auto-fix lint errors where possible3. Check the full failure log here: Once you push a fix and the CI passes, the |
|
Hi @Ixotic27, I've resolved the CI/CD environment issues and ensured all build and linting checks are passing. The PR is now clean and ready for your final review. The Vercel authorization check is pending, which I understand is just waiting for team approval. Thank you for your guidance throughout this process! |
What does this PR do?
This PR fixes the non-atomic points deduction issue by replacing manual point updates and purchase insertions with a single, atomic PostgreSQL RPC function (
process_purchase).Related issue
Fixes #363
Checklist
Summary of Changes
process_purchase).process_purchasefunction in a new migration file.Testing Performed