Consolidate per-platform label files and add fuzzy romName matching - #5
Merged
Conversation
…latform}.xml
Labels are now stored in a single Labels/{platform}.xml per platform combining a
<Defaults> block and <Game launchBoxId="..." romName="..."> entries. The two-tier
Defaults/User filesystem now merges at the entry level rather than doing wholesale
file shadowing: User game entries win over Defaults entries matched first by
launchBoxId then by romName; User <Defaults> buttons override Defaults buttons per-key.
GameInfo gains LaunchBoxId (populated from IGame.LaunchBoxDbId in the LaunchBox layer)
as the primary lookup key, with RomName as the fallback. InputLabelsLoader is rewritten
to load and merge both tiers, replacing the old per-game + _DefaultLabels.xml approach.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Label lookup now falls back to fuzzy matching when neither launchBoxId nor exact
romName match: NormalizeRomName strips balanced parenthesis and bracket groups then
lowercases, so "OutRun (USA, Europe)" on disk finds a bare "OutRun" entry and vice
versa. Extracted into RomNameUtils.NormalizeRomName (Infrastructure) with unit tests.
InputLabelsLoader caches parsed platform data so each Labels/{platform}.xml is read
and merged at most once per session, consistent with TemplateService. Logs elapsed
parse time on first load.
romName attributes in fixture and asset label files stripped of region tags to
reflect realistic contributor data — the E2E tests now exercise the fuzzy path.
Four subsystem tests cover all matching combinations: bare/bracketed entry vs
bare/bracketed ROM, and a non-match guard confirming bracket-stripping does not
imply substring matching.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The loader reads node.Attributes["launchBoxId"], so an `id` attribute would be silently ignored. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Unit test coverage (Core.Tests)Summary - Unit tests (Core.Tests)Summary
CoverageDynamicControls.Core - 99.1%
Integration test coverage (Core.IntegrationTests)Summary - Integration tests (Core.IntegrationTests)Summary
CoverageDynamicControls.Core - 90.8%
|
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.
Summary
Labels/{platform}/{rom}.xml) with a single consolidatedLabels/{platform}.xmlper platform. Each file has a<Defaults>block and<Game launchBoxId="..." romName="...">entries. The two-tierDefaults//User/merge now happens at the entry level — User entries win over Defaults entries bylaunchBoxId, then byromName.launchBoxIdlookup:InputLabelsLoaderindexes entries bylaunchBoxId(now typed asint?throughout, matchingIGame.LaunchBoxDbId) and tries it beforeromName. Stable across ROM renames and No-Intro set updates.romNamematching: when neitherlaunchBoxIdnor exactromNamematch, the loader falls back to a normalised form (balanced bracket groups stripped, lowercased).NormalizeRomNameis extracted toRomNameUtilswith its own unit tests. Asset and fixtureromNamevalues are stripped of region tags to reflect realistic contributor data; the existing E2E tests now exercise the fuzzy path automatically.Test plan
RomNameUtilsTests— 13 normalisation cases + idempotencyInputLabelsLoaderTests— unit coverage: name/id/fuzzy lookup, user/defaults merge, caching, error pathsInputLabelsSubsystemTests— 4 fuzzy-match combination tests +launchBoxIdsubsystem testSegaGenesisEndToEndTests.SegaGenesis_OutRun_MatchedByLaunchBoxId— E2E coverage of thelaunchBoxIdpath🤖 Generated with Claude Code