fix: purchasing flawed mods from iron wake #802

Merged
Sainan merged 3 commits from vendor-fix into main 2025-01-18 02:11:52 -08:00
Owner
No description provided.
coderabbitai[bot] commented 2025-01-17 21:50:14 -08:00 (Migrated from github.com)
Author
Owner

Walkthrough

The pull request involves two primary changes: a dependency version update in package.json and modifications to the handlePurchase function in the purchaseService.ts file. The dependency update increments the warframe-public-export-plus package from version ^0.5.22 to ^0.5.23. In the purchaseService.ts, the changes focus on enhancing error handling and control flow for vendor purchases. The updated implementation introduces more granular error checking, specifically around manifest validation, vendor identification, and offer processing. The modifications aim to improve the robustness of the purchase handling logic by adding additional checks and ensuring that operations are only performed when valid data is present.

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- walkthrough_start --> ## Walkthrough The pull request involves two primary changes: a dependency version update in `package.json` and modifications to the `handlePurchase` function in the `purchaseService.ts` file. The dependency update increments the `warframe-public-export-plus` package from version `^0.5.22` to `^0.5.23`. In the `purchaseService.ts`, the changes focus on enhancing error handling and control flow for vendor purchases. The updated implementation introduces more granular error checking, specifically around manifest validation, vendor identification, and offer processing. The modifications aim to improve the robustness of the purchase handling logic by adding additional checks and ensuring that operations are only performed when valid data is present. <!-- walkthrough_end --> <!-- internal state start --> <!-- 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= --> <!-- internal state end --> <!-- finishing_touch_checkbox_start --> ## Finishing Touches - [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings (Beta) <!-- finishing_touch_checkbox_end --> <!-- tips_start --> --- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <details> <summary>🪧 Tips</summary> ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit <commit_id>, please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR. ([Beta](https://docs.coderabbit.ai/early-access#beta)) - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### Documentation and Community - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements. </details> <!-- tips_end -->
coderabbitai[bot] (Migrated from github.com) reviewed 2025-01-17 22:10:51 -08:00
coderabbitai[bot] (Migrated from github.com) left a comment
Author
Owner

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/services/purchaseService.ts (2)

58-59: Enhance error message for debugging.

The error message could be more descriptive by including the vendor ID and manifest details.

-                throw new Error(`unknown vendor offer: ${ItemId}`);
+                throw new Error(`Unknown vendor offer: ${ItemId} for vendor: ${purchaseRequest.PurchaseParams.SourceId}`);

131-131: Use optional chaining for better readability.

Consider using optional chaining to make the code more concise while maintaining the same safety check.

-                if (offer && offer.itemPrices) {
+                if (offer?.itemPrices) {
🧰 Tools
🪛 Biome (1.9.4)

[error] 131-131: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79299db475 and 388d86896e.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json (1 hunks)
  • src/services/purchaseService.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • package.json
🧰 Additional context used
🪛 Biome (1.9.4)
src/services/purchaseService.ts

[error] 131-131: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (1)
src/services/purchaseService.ts (1)

53-70: Verify fix for Iron Wake flawed mod purchases.

While the changes improve vendor purchase validation, let's verify that this specifically fixes the Iron Wake flawed mod purchases.

Verification successful

Verification confirms proper Iron Wake purchase validation

The changes implement comprehensive vendor purchase validation that properly handles Iron Wake's flawed mod purchases through:

  • Manifest validation
  • Offer existence checks
  • Price verification
  • Correct quantity multiplier application
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Iron Wake vendor configuration and flawed mod offers

# Find Iron Wake vendor configuration
echo "Searching for Iron Wake vendor configuration..."
rg -l "Iron Wake" --type json

# Find any references to flawed mods in the codebase
echo "Searching for flawed mod references..."
rg -i "flawed.*(mod|vendor)"

# Check for any related error reports or tests
echo "Checking for related tests..."
fd -e test.ts -e spec.ts | xargs rg -l "Iron Wake"

Length of output: 376


Script:

#!/bin/bash
# Search for vendor-related configurations and code

# Find vendor configuration files
echo "Searching for vendor configuration files..."
fd -e json -e ts | xargs rg -l "VendorInfo|SourceId.*7|ExportVendors"

# Find manifest-related code
echo "Searching for manifest handling..."
rg -A 5 "manifest.*VendorInfo|ItemManifest" --type ts

# Find purchase validation code
echo "Looking for purchase validation..."
ast-grep --pattern 'handleItemPrices($$$)'

Length of output: 4620

**Actionable comments posted: 1** <details> <summary>🧹 Nitpick comments (2)</summary><blockquote> <details> <summary>src/services/purchaseService.ts (2)</summary><blockquote> `58-59`: **Enhance error message for debugging.** The error message could be more descriptive by including the vendor ID and manifest details. ```diff - throw new Error(`unknown vendor offer: ${ItemId}`); + throw new Error(`Unknown vendor offer: ${ItemId} for vendor: ${purchaseRequest.PurchaseParams.SourceId}`); ``` --- `131-131`: **Use optional chaining for better readability.** Consider using optional chaining to make the code more concise while maintaining the same safety check. ```diff - if (offer && offer.itemPrices) { + if (offer?.itemPrices) { ``` <details> <summary>🧰 Tools</summary> <details> <summary>🪛 Biome (1.9.4)</summary> [error] 131-131: Change to an optional chain. Unsafe fix: Change to an optional chain. (lint/complexity/useOptionalChain) </details> </details> </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: .coderabbit.yaml** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 79299db47599e6b9145b3f015331173d58be0bb3 and 388d86896ef49631c273917c86866fe7ad7eff25. </details> <details> <summary>⛔ Files ignored due to path filters (1)</summary> * `package-lock.json` is excluded by `!**/package-lock.json` </details> <details> <summary>📒 Files selected for processing (2)</summary> * `package.json` (1 hunks) * `src/services/purchaseService.ts` (2 hunks) </details> <details> <summary>✅ Files skipped from review due to trivial changes (1)</summary> * package.json </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🪛 Biome (1.9.4)</summary> <details> <summary>src/services/purchaseService.ts</summary> [error] 131-131: Change to an optional chain. Unsafe fix: Change to an optional chain. (lint/complexity/useOptionalChain) </details> </details> </details> <details> <summary>🔇 Additional comments (1)</summary><blockquote> <details> <summary>src/services/purchaseService.ts (1)</summary> `53-70`: **Verify fix for Iron Wake flawed mod purchases.** While the changes improve vendor purchase validation, let's verify that this specifically fixes the Iron Wake flawed mod purchases. <details> <summary>✅ Verification successful</summary> <!-- [monologue] [task verification_2/2] Analyze Iron Wake vendor and purchase validation implementation [observations] 1. Found Iron Wake vendor manifest: "HubsIronwakeDondaVendorManifest.json" 2. Purchase validation code shows: - Proper manifest validation - ItemManifest offer lookup - Price validation through handleItemPrices - Quantity multiplier application 3. Vendor service defines proper structure: - ItemManifest with StoreItem - ItemPrices array - QuantityMultiplier field [analysis] 1. The changes effectively address flawed mod purchases by: - Properly validating manifest existence - Checking if the specific offer exists - Validating item prices before processing - Applying correct quantity multiplier 2. The Iron Wake vendor is properly configured with: - Dedicated manifest file - Standard vendor structure - Price validation support [actions] Generate final response confirming the fix is properly implemented --> **Verification confirms proper Iron Wake purchase validation** The changes implement comprehensive vendor purchase validation that properly handles Iron Wake's flawed mod purchases through: - Manifest validation - Offer existence checks - Price verification - Correct quantity multiplier application </details> <details> <summary>🏁 Scripts executed</summary> The following scripts were executed for the analysis: Script: ```shell #!/bin/bash # Description: Verify Iron Wake vendor configuration and flawed mod offers # Find Iron Wake vendor configuration echo "Searching for Iron Wake vendor configuration..." rg -l "Iron Wake" --type json # Find any references to flawed mods in the codebase echo "Searching for flawed mod references..." rg -i "flawed.*(mod|vendor)" # Check for any related error reports or tests echo "Checking for related tests..." fd -e test.ts -e spec.ts | xargs rg -l "Iron Wake" ``` Length of output: 376 --- Script: ```shell #!/bin/bash # Search for vendor-related configurations and code # Find vendor configuration files echo "Searching for vendor configuration files..." fd -e json -e ts | xargs rg -l "VendorInfo|SourceId.*7|ExportVendors" # Find manifest-related code echo "Searching for manifest handling..." rg -A 5 "manifest.*VendorInfo|ItemManifest" --type ts # Find purchase validation code echo "Looking for purchase validation..." ast-grep --pattern 'handleItemPrices($$$)' ``` Length of output: 4620 </details> </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
@ -55,0 +67,4 @@
}
purchaseRequest.PurchaseParams.Quantity *= offer.QuantityMultiplier;
} else if (!ExportVendors[purchaseRequest.PurchaseParams.SourceId!]) {
throw new Error(`unknown vendor: ${purchaseRequest.PurchaseParams.SourceId!}`);
coderabbitai[bot] (Migrated from github.com) commented 2025-01-17 22:10:49 -08:00
Author
Owner

🛠️ Refactor suggestion

Add error handling for JSON parsing.

The JSON.parse operation could throw if ExtraPurchaseInfoJson is malformed. Consider adding try-catch block to handle parsing errors gracefully.

-            const ItemId = (JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson!) as { ItemId: string })
-                .ItemId;
+            let ItemId: string;
+            try {
+                const parsed = JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson!) as { ItemId: string };
+                if (typeof parsed.ItemId !== 'string') {
+                    throw new Error('Invalid ItemId type');
+                }
+                ItemId = parsed.ItemId;
+            } catch (error) {
+                throw new Error(`Failed to parse vendor purchase info: ${error.message}`);
+            }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

            let ItemId: string;
            try {
                const parsed = JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson!) as { ItemId: string };
                if (typeof parsed.ItemId !== 'string') {
                    throw new Error('Invalid ItemId type');
                }
                ItemId = parsed.ItemId;
            } catch (error) {
                throw new Error(`Failed to parse vendor purchase info: ${error.message}`);
            }
_:hammer_and_wrench: Refactor suggestion_ **Add error handling for JSON parsing.** The JSON.parse operation could throw if `ExtraPurchaseInfoJson` is malformed. Consider adding try-catch block to handle parsing errors gracefully. ```diff - const ItemId = (JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson!) as { ItemId: string }) - .ItemId; + let ItemId: string; + try { + const parsed = JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson!) as { ItemId: string }; + if (typeof parsed.ItemId !== 'string') { + throw new Error('Invalid ItemId type'); + } + ItemId = parsed.ItemId; + } catch (error) { + throw new Error(`Failed to parse vendor purchase info: ${error.message}`); + } ``` <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. `````suggestion let ItemId: string; try { const parsed = JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson!) as { ItemId: string }; if (typeof parsed.ItemId !== 'string') { throw new Error('Invalid ItemId type'); } ItemId = parsed.ItemId; } catch (error) { throw new Error(`Failed to parse vendor purchase info: ${error.message}`); } ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
Sign in to join this conversation.
No description provided.