fix(metadata): identify archives by their largest member again - #4059
Closed
gantoine wants to merge 1 commit into
Closed
fix(metadata): identify archives by their largest member again#4059gantoine wants to merge 1 commit into
gantoine wants to merge 1 commit into
Conversation
Since 4.9.0 an archive's RomFile carries a composite hash computed across every entry inside it, and the Hasheous and Playmatch lookups picked that up by reading the file record's digests. Both services index a multi-file archive by the largest file inside it, so the composite matched nothing and arcade sets (where multi-file zips are the norm) silently stopped resolving. `RomFile.lookup_hashes` now centralises which digests a ROM database should be queried with: the disc-data SHA1 for a CHD, the largest member's digests for an archive, the file's own otherwise. Single-file archives are unaffected, since a composite over one entry equals that entry's hash. Nothing is re-hashed, the composite stays the stored ROM-level identity, and the same digests are what we now contribute back through Playmatch's suggestion endpoint. Fixes #3742 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
Maybe I'm misunderstanding, but for multi-file folder .chd games submitted to Playmatch, PlayMatch doesn't get the largest top-level file's CHD SHA-1 hash, it just uses first file with a size > 0? This would cause .m3u files to get submitted I'd think... |
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.
Description
Explain the changes or enhancements you are proposing with this pull request.
Completes phase 2 of #3411, which #3412 deferred.
Since 4.9.0 an archive's
RomFilecarries a composite hash computed across every entry inside it. The Hasheous and Playmatch lookups read their digests straight off that file record, so they silently switched from "hash of the largest file inside the archive" (what 4.8.x sent) to the composite. Both services index a multi-file archive by its largest internal file, so the composite matches nothing and those ROMs stopped resolving by hash — most visibly on arcade sets, where multi-file zips are the norm.RomFile.lookup_hashesnow owns the question of which digests a ROM database should be queried with:archive_membersBoth
hasheous_handler.lookup_romandplaymatch_handler.lookup_romuse it, as does the Playmatch suggestion payload — contributing a composite hash back to their index would have been worse than not contributing at all.Notes:
archive_membershas been populated since 4.9.0, so existing libraries are fixed by a rescan without touching the files.romnom(the filename), which for arcade zips is the set name, so it still resolves. Changing it would shift match results for a lot of libraries and belongs in its own change.Checklist
Please check all that apply.
Tests added:
RomFile.lookup_hashes(own digests / CHD / largest member) intests/models/test_rom.py, plus a payload assertion for each of the two handlers.Screenshots (if applicable)
n/a — backend only.
Fixes #3742
🤖 AI assistance disclosure: this change was written with Claude Code (Claude Opus 5), working from the analysis in the issue. Reviewed by me before opening.
🤖 Generated with Claude Code