Use parsed filename for unmatched ROM titles instead of raw filename#3681
Merged
Conversation
…name Generated-By: PostHog Code
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves how RomM titles ROMs that remain unmatched after a scan by using a cleaned, parsed filename (tags + extension stripped) instead of the raw filename, and updates the “placeholder name” detection so auto-generated names can be safely replaced while preserving user edits.
Changes:
- Use
fs_rom_handler.get_file_name_with_no_tags()as the initial name for newly-created ROM entries during socket scans. - Expand placeholder-name detection during
UNMATCHED/UPDATEscans to treat both raw and parsed filenames as placeholders and prefer the parsed name as the fallback. - Add a unit test ensuring legacy raw-filename placeholders are healed to the parsed filename when no metadata match is found.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| backend/tests/handler/test_fastapi.py | Adds a regression test verifying fallback title healing to parsed filename on unmatched/no-match scans. |
| backend/handler/scan_handler.py | Updates placeholder detection and fallback naming behavior during unmatched/update scans. |
| backend/endpoints/sockets/scan.py | Sets newly created ROM name to the parsed filename instead of the raw filename. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rom_attrs["name"] is seeded from rom.name earlier, so on the no-provider-match
path it still holds the raw filename placeholder. That made the
`or rom_attrs.get("name")` branch win over the fs_name_no_tags fallback,
retaining the raw filename as the title. Treat the seeded name as a placeholder
too, so the parsed filename fallback applies when no provider matched.
Generated-By: PostHog Code
Task-Id: 987bb9c1-1bfb-43f2-adc7-c26e69f06a39
name is NotRequired[str] on HasheousRom, so passing name=None fails mypy's typeddict-item check. Omit it to represent a no-match result. Generated-By: PostHog Code Task-Id: 987bb9c1-1bfb-43f2-adc7-c26e69f06a39
Generated-By: PostHog Code Task-Id: 987bb9c1-1bfb-43f2-adc7-c26e69f06a39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
When a ROM scan finds no metadata match, the title should fall back to the parsed filename (with tags and extension stripped) rather than keeping the raw filename as a placeholder. This ensures unmatched ROMs have clean, readable titles for subsequent searches.
Fixes #3665
What changed?
Updated ROM creation for unmatched matches (
scan.py): Changed thenamefield to usefs_rom_handler.get_file_name_with_no_tags()instead of the raw filename when creating an unmatched ROM entry.Improved placeholder detection logic (
scan_handler.py): Enhanced the logic that determines whether a ROM's existing name is a placeholder:Added test coverage (
test_fastapi.py): New testtest_scan_rom_unmatched_no_match_uses_parsed_nameverifies that:Checklist
Created with PostHog Code