Skip to content

Stop overwriting IDs on scan #2077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 14, 2025
Merged

Stop overwriting IDs on scan #2077

merged 5 commits into from
Jul 14, 2025

Conversation

gantoine
Copy link
Member

@gantoine gantoine commented Jul 14, 2025

Description
Explain the changes or enhancements you are proposing with this pull request.

Checklist
Please check all that apply.

  • I've tested the changes locally
  • I've updated relevant comments
  • I've assigned reviewers for this PR
  • I've added unit tests that cover the changes

Screenshots

@gantoine gantoine requested a review from Copilot July 14, 2025 14:53
Copy link

trunk-io bot commented Jul 14, 2025

Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances ID handling during scans, standardizes metadata structures, and updates UI chip styling for better readability.

  • Prevents unintentional overwrites by merging ID fields in scan_handler.py
  • Introduces a shared BaseRom TypedDict and refactors metadata handlers to extend it
  • Updates platform slug mapping with numeric IDs and adds filters for new IDs in the database handler

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/src/components/common/Game/Table.vue Added text-white class to chips for improved contrast
frontend/src/components/common/Game/Card/Base.vue Added text-white class to chips for improved contrast
backend/handler/scan_handler.py Added prioritized ID merge logic to avoid overwriting existing IDs
backend/handler/metadata/ss_handler.py Refactored SSRom to extend BaseRom for consistent optional fields
backend/handler/metadata/ra_handler.py Refactored RAGameRom to extend BaseRom, added first_release_date
backend/handler/metadata/moby_handler.py Refactored MobyGamesRom to extend BaseRom
backend/handler/metadata/launchbox_handler.py Refactored LaunchboxRom to extend BaseRom
backend/handler/metadata/igdb_handler.py Refactored IGDBRom to extend BaseRom
backend/handler/metadata/hasheous_handler.py Refactored HasheousRom to extend BaseRom and expanded slug mapping
backend/handler/metadata/base_hander.py Introduced shared BaseRom TypedDict
backend/handler/database/roms_handler.py Updated filter_by_matched to include ra_id and hasheous_id
Comments suppressed due to low confidence (3)

backend/handler/metadata/base_hander.py:60

  • [nitpick] The name BaseRom is generic; consider a more descriptive name (e.g., CommonRomFields) to clarify its purpose and avoid ambiguity.
class BaseRom(TypedDict):

backend/handler/database/roms_handler.py:195

  • Since you’ve extended the filter to include ra_id and hasheous_id, consider updating the method docstring to explain the new behavior.
            Rom.ra_id.isnot(None),

backend/handler/scan_handler.py:518

  • The new ID merge logic in rom_attrs.update introduces complex precedence; consider adding targeted unit tests to cover scenarios where existing IDs should be preserved.
    rom_attrs.update(

Copy link

github-actions bot commented Jul 14, 2025

Test Results

168 tests  ±0   168 ✅ ±0   39s ⏱️ -1s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 8049e47. ± Comparison against base commit d9808a9.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 14, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
7871 4977 63% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
backend/handler/database/roms_handler.py 51% 🟢
backend/handler/metadata/base_hander.py 57% 🟢
backend/handler/metadata/hasheous_handler.py 41% 🟢
backend/handler/metadata/igdb_handler.py 70% 🟢
backend/handler/metadata/launchbox_handler.py 43% 🟢
backend/handler/metadata/moby_handler.py 39% 🟢
backend/handler/metadata/ra_handler.py 56% 🟢
backend/handler/metadata/ss_handler.py 31% 🟢
backend/handler/scan_handler.py 67% 🟢
backend/models/rom.py 91% 🟢
TOTAL 54% 🟢

updated for commit: 8049e47 by action🐍

@gantoine gantoine merged commit 396d639 into master Jul 14, 2025
10 checks passed
@gantoine gantoine deleted the 4-metadata-fixes-7 branch July 14, 2025 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant