Skip to content

Conversation

@TobiTenno
Copy link
Member

@TobiTenno TobiTenno commented Mar 30, 2025

What did you fix?

closes #600


Reproduction steps


Evidence/screenshot/link to line

Considerations

  • Does this contain a new dependency? [Yes] but for dev only
  • Does this introduce opinionated data formatting or manual data entry? [No]
  • Does this pr include updated data files in a separate commit that can be reverted for a clean code-only pr? [Yes]
  • Have I run the linter? [Yes]
  • Is is a bug fix, feature request, or enhancement? [Feature]

Summary by CodeRabbit

  • New Features

    • Enhanced item metadata processing now uses unique identifiers for improved matching and clearly flags when wiki data is available.
  • Chores

    • Introduced a JSON diffing library to support internal data comparisons.
  • Tests

    • Updated test logging now provides clearer comparisons for verifying item data consistency.
  • Documentation

    • Updated interfaces to include a new property indicating wiki availability and adjusted related properties accordingly.

@TobiTenno TobiTenno requested a review from a team as a code owner March 30, 2025 21:43
@coderabbitai
Copy link

coderabbitai bot commented Mar 30, 2025

Walkthrough

This pull request refines how Wikia data is processed by switching the matching criteria from the name to the uniqueName property. The Parser class now sets a wikiAvailable flag when a match is found. Several transformer modules have been updated to extract an InternalName from their source objects and assign it as a new uniqueName property. In addition, interface definitions have been adjusted to reflect these changes, a new dependency (json-diff) has been introduced, and test logic has been updated to use the diff functionality.

Changes

File(s) Change Summary
build/parser.mjs Updated Wikia item matching to use uniqueName instead of name and sets wikiAvailable flag when available.
build/wikia/transformers/transform{Arcanes, Companion, Mod, Warframe, Weapon, Archwing}.mjs Modified destructuring to include InternalName from old objects and added a uniqueName property to the new objects.
index.d.ts Updated interfaces: added optional wikiAvailable to WikiaItem, extended Component from WikiaItem, and removed wikiaThumbnail and wikiaUrl from Component.
package.json Added a new devDependency: "json-diff": "^1.0.6".
test/lookup.mjs Introduced json-diff for outputting differences, updated import and error logging, and modified lookup criteria.

Assessment against linked issues

Objective Addressed Explanation
Implement obtainable flag for items (#600) No changes related to an obtainable flag.

Possibly related PRs

  • feat: migrate all fandom links to the official wiki #700: The changes in the main PR are related to the modifications in the Parser class of the retrieved PR, as both involve updates to how Wikia data is processed, specifically regarding the handling of item identifiers.
  • fix: masterable check for modular parts and Pets #663: The changes in the main PR modify the Parser class to enhance item identification using the uniqueName property, while the retrieved PR also modifies the Parser class but focuses on the applyMasterable method, introducing logic for determining item masterability based on categories and unique names.
  • feat(scraper): add ArcaneScraper and transformer for arcanes #714: The changes in the main PR, which modify the Parser class to utilize the uniqueName property for item identification, are related to the retrieved PR that also introduces a transformer for arcanes, specifically adding a uniqueName property in the transformArcanes function.

Suggested labels

Scope: Data, released, Type: Bug

Suggested reviewers

  • Soundofdarkness

Poem

I’m a rabbit hopping through the code,
With tweaks and fixes in each node.
uniqueName leads the way so true,
Wiki data shines in a bright hue.
Leaping through changes with a joyful spree,
Celebrating updates from little ol’ me!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e98295 and c014128.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • build/parser.mjs (1 hunks)
  • build/wikia/transformers/transformArcanes.mjs (1 hunks)
  • build/wikia/transformers/transformCompanion.mjs (1 hunks)
  • build/wikia/transformers/transformMod.mjs (1 hunks)
  • build/wikia/transformers/transformWarframe.mjs (1 hunks)
  • build/wikia/transformers/transformWeapon.mjs (1 hunks)
  • build/wikia/transformers/transformerArchwing.mjs (1 hunks)
  • index.d.ts (2 hunks)
  • package.json (1 hunks)
  • test/lookup.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • package.json
  • build/wikia/transformers/transformArcanes.mjs
  • build/wikia/transformers/transformCompanion.mjs
  • build/wikia/transformers/transformerArchwing.mjs
  • build/wikia/transformers/transformWeapon.mjs
  • build/wikia/transformers/transformWarframe.mjs
  • test/lookup.mjs
  • build/wikia/transformers/transformMod.mjs
  • build/parser.mjs
  • index.d.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build

🪧 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link

@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: 0

🧹 Nitpick comments (1)
test/lookup.mjs (1)

7-7: Consider parameterizing the lookup value.

While hardcoding 'Acceltra' works for basic testing, consider making this configurable, perhaps through command-line arguments, to enable testing with different items without code changes.

-const lookup = 'Acceltra';
+const lookup = process.argv[2] || 'Acceltra';
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3f4bea3 and 1e98295.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • build/parser.mjs (1 hunks)
  • build/wikia/transformers/transformArcanes.mjs (1 hunks)
  • build/wikia/transformers/transformCompanion.mjs (1 hunks)
  • build/wikia/transformers/transformMod.mjs (1 hunks)
  • build/wikia/transformers/transformWarframe.mjs (1 hunks)
  • build/wikia/transformers/transformWeapon.mjs (1 hunks)
  • build/wikia/transformers/transformerArchwing.mjs (1 hunks)
  • index.d.ts (2 hunks)
  • package.json (1 hunks)
  • test/lookup.mjs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build
🔇 Additional comments (20)
package.json (1)

73-73: Good addition of json-diff dependency

Adding json-diff as a development dependency is appropriate. This will help with comparing JSON objects in tests, particularly for the weapon data comparison mentioned in the AI summary.

build/wikia/transformers/transformWeapon.mjs (2)

205-205: Consistently extracting InternalName property

Good addition of InternalName to the destructured properties, which supports the PR's goal of matching on uniqueName instead of name.


211-211: Adding uniqueName property to enable better matching

Excellent implementation. The uniqueName property is now set to the InternalName value, which will provide a more reliable identifier for matching items compared to the name property.

build/wikia/transformers/transformArcanes.mjs (2)

8-8: Consistent extraction of InternalName from source data

Good addition of InternalName to the destructured properties, maintaining consistency with the other transformer modules.


12-12: Adding uniqueName property for arcanes matches implementation in other transformers

The implementation is consistent with the other transformers and aligns with the PR's goal of matching on uniqueName instead of name.

build/wikia/transformers/transformMod.mjs (2)

8-8: Consistent extraction of InternalName across transformers

Good addition of InternalName to the destructured properties, maintaining consistency with the other transformer modules.


12-12:

Details

✅ Verification successful

Adding uniqueName property for mods completes the consistent pattern

The implementation is consistent with the other transformers and helps fulfill the PR objective of matching on uniqueName rather than name.

I'd like to verify that the Parser module (mentioned in the AI summary) has been properly updated to use this new uniqueName property for matching. Can you confirm this change has been made?


🏁 Script executed:

#!/bin/bash
# Check if Parser has been updated to use uniqueName instead of name
rg "uniqueName" -A 3 -B 3 build/parser.mjs

Length of output: 8706


Parser module update verified for uniqueName usage

I reviewed the Parser module (build/parser.mjs) and confirmed that it consistently uses the uniqueName property for matching (e.g., in blueprint filtering, item processing, and comparison logic). This aligns with the changes made in the mods transformer and fulfills the PR objective.

build/wikia/transformers/transformerArchwing.mjs (2)

16-16: Addition of InternalName extraction is appropriate.

The addition of InternalName to the destructuring assignment aligns perfectly with the PR objective of matching on uniqueName. This change enables access to the internal identifier from the source data.


21-21: Appropriate implementation of uniqueName property.

Adding the uniqueName property based on InternalName provides a consistent identifier for matching across the codebase, which is in line with the PR objective. This change enhances the identification mechanism for archwing items.

build/wikia/transformers/transformWarframe.mjs (2)

37-38: Good addition of InternalName to destructuring assignment.

The inclusion of InternalName in the destructuring maintains consistency with the other transformer modules and supports the PR objective of using uniqueName for matching.


43-43: Appropriate implementation of uniqueName property.

Adding the uniqueName property based on InternalName is consistent with other transformer modules and provides a reliable identifier for warframes.

test/lookup.mjs (4)

3-3: Good ESLint rule addition for development dependencies.

Adding the import/no-extraneous-dependencies disable rule is appropriate since the test file is importing development-only packages like json-diff.


5-5: Appropriate addition of json-diff library.

The import of json-diff aligns with the PR description mentioning a new development dependency and provides useful functionality for comparing JSON objects in testing.


10-11: Good implementation of API comparison logic.

The implementation to fetch the item from the API and find the corresponding item in the local data is well-structured and effective for testing the changes.


13-13: Effective use of json-diff for output.

Using json-diff to display differences between the API data and local data is an excellent way to visualize the impact of your changes and helps with debugging.

build/wikia/transformers/transformCompanion.mjs (2)

16-17: Good addition of InternalName to destructuring assignment.

The inclusion of InternalName in the destructuring maintains consistency with the other transformer modules and supports the PR objective.


22-22: Appropriate implementation of uniqueName property.

Adding the uniqueName property based on InternalName is consistent with other transformer modules and enhances item identification.

build/parser.mjs (1)

915-917: Good improvement to wiki data matching

Switching from matching on name to uniqueName is a good improvement that should make the matching more reliable, as unique names are guaranteed to be distinct. The addition of the wikiAvailable flag provides a clean way to check if wiki data exists for an item.

index.d.ts (2)

158-158: LGTM: New wikiAvailable property added

Adding this optional property to the WikiaItem interface aligns properly with the implementation in the parser.


401-401: Good interface extension

Making Component extend WikiaItem is appropriate since components can now have wiki-related properties, including the new wikiAvailable flag. The removal of redundant properties (wikiaThumbnail and wikiaUrl) that were previously defined directly on Component makes sense as they're now inherited from WikiaItem.

@TobiTenno
Copy link
Member Author

@coderabbitai see #600 (comment) for how this applies to #600

@coderabbitai
Copy link

coderabbitai bot commented Mar 30, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Fetch the referenced issue comment
gh issue view 600 --repo WFCD/warframe-items --comments --json comments,title,body > issue_600.json
# Display the issue title and body
jq -r '"\(.title)\n\n\(.body)"' issue_600.json
# Find and display the specific comment
jq -r '.comments[] | select(.url | contains("2764758648")) | .body' issue_600.json

Length of output: 1438


@TobiTenno I've reviewed the comment and understand how this PR addresses issue #600. Instead of adding a direct obtainable flag, you've implemented a wikiAvailable property that serves as a proxy indicator - items documented on the wiki (likely obtainable) will have this flag set to true, while internal-only unobtainable items typically won't have wiki entries.

The PR also enhances the matching mechanism by using uniqueName instead of name for more accurate connections between game data and wiki data, exactly as you suggested in your comment. This approach elegantly solves the original problem by leveraging existing wiki data to identify obtainable items.

@TobiTenno TobiTenno enabled auto-merge (squash) March 30, 2025 21:56
Copy link
Member

@SlayerOrnstein SlayerOrnstein left a comment

Choose a reason for hiding this comment

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

LGTM

@TobiTenno TobiTenno merged commit 1fea7d2 into master Mar 30, 2025
10 checks passed
@TobiTenno TobiTenno deleted the wiki-matching branch March 30, 2025 22:14
@Cypheriel
Copy link

Perhaps this goes without saying, but I'm not so sure that this really solves the original issue. As with anything Wiki-related, there's going to be a concern of reliability with the data we're working with. Depending on the use case, this could hamper external services relying on this API. However, in addition, there may be a case where a page exists for an item, an item technically exists, and is not obtainable nor tradable. Also, I worry some items may not directly translate well to a Wiki URL.
I would say there should be an analysis of the data before marking the original issue as completed.

TL; DR: The original issue and this solution may provide the same information at the moment or any given time, but technically represent two different ideas and uses.

@TobiTenno
Copy link
Member Author

TobiTenno commented Mar 30, 2025

I realize that, but there's literally no non-manual way of maintaining "is this obtainable" that isn't an inference based on data outside DE's manifest; and at best it would be cases of negative enforcement, and positive defaults

@wfcd-bot-boi
Copy link
Collaborator

🎉 This PR is included in version 1.1269.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

Feature Request: obtainable flag for items

5 participants