Add ES-DE <sortname> import and edit support for ROM ordering#3460
Merged
Conversation
Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for sortname tag in ES-DE gamelist.xml import
Add ES-DE May 31, 2026
<sortname> import support for ROM ordering
Member
Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
Contributor
Author
Copilot
AI
changed the title
Add ES-DE
Add ES-DE May 31, 2026
<sortname> import support for ROM ordering<sortname> import and edit support for ROM ordering
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds ES-DE <sortname> support so imported ROMs can keep a display title while using a separate value for name-based ordering.
Changes:
- Adds
sort_nameto the ROM model, migration, API schemas, update endpoint, and frontend edit form. - Parses ES-DE
<sortname>fromgamelist.xmland persists it during scans. - Updates ROM name ordering logic and backend tests for sorting/import/update behavior.
Reviewed changes
Copilot reviewed 15 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
backend/alembic/versions/0082_add_rom_sort_name.py |
Adds nullable roms.sort_name column. |
backend/models/rom.py |
Adds sort_name ORM field. |
backend/handler/database/roms_handler.py |
Uses sort_name as the effective name-sort key when present. |
backend/handler/metadata/base_handler.py |
Extends metadata ROM payload typing with sort_name. |
backend/handler/metadata/gamelist_handler.py |
Parses <sortname> into gamelist metadata and ROM data. |
backend/handler/scan_handler.py |
Initializes and preserves sort_name during scan updates. |
backend/endpoints/roms/__init__.py |
Accepts, updates, and clears sort_name through the ROM update endpoint. |
backend/endpoints/responses/rom.py |
Exposes sort_name in ROM response schemas. |
backend/tests/handler/test_db_handler.py |
Adds DB-level coverage for sort_name ordering. |
backend/tests/handler/metadata/test_gamelist_handler.py |
Adds parser coverage for <sortname>. |
backend/tests/endpoints/roms/test_rom.py |
Adds endpoint coverage for editing and clearing sort_name. |
frontend/src/services/api/rom.ts |
Includes sort_name in ROM update form data. |
frontend/src/components/common/Game/Dialog/EditRom.vue |
Adds editable Sort name field to the ROM dialog. |
frontend/src/locales/en_US/rom.json |
Adds English label for Sort name. |
frontend/src/locales/en_GB/rom.json |
Adds British English label for Sort name. |
frontend/src/__generated__/models/SimpleRomSchema.ts |
Regenerates frontend simple ROM schema with sort_name. |
frontend/src/__generated__/models/DetailedRomSchema.ts |
Regenerates frontend detailed ROM schema with sort_name. |
frontend/src/__generated__/models/Body_update_rom_api_roms__id__put.ts |
Regenerates update request schema with sort_name. |
Files not reviewed (3)
- frontend/src/generated/models/Body_update_rom_api_roms__id__put.ts: Language not supported
- frontend/src/generated/models/DetailedRomSchema.ts: Language not supported
- frontend/src/generated/models/SimpleRomSchema.ts: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Contributor
Contributor
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
Collapse the separate `sort_name` column into `name_sort_key`, which is now
the single user-settable sort field: always normalized and indexed for fast
ordering, derived from `name` by default, and overridable. A new
`name_sort_key_custom` boolean marks user/metadata overrides so they survive
renames and rescans.
- Drop the `roms.sort_name` column; repurpose migration 0085 to add
`name_sort_key_custom`.
- Derive the key via `@validates("name")` unless pinned custom; the edit
dialog, unmatch flow, and ES-DE gamelist <sortname> set custom keys.
- update_rom / scan_rom keep the columns in sync explicitly (bulk update and
construction bypass / reorder the validator).
- Frontend: edit field drives name_sort_key (empty when auto), api sends the
override only when custom, regenerated types updated.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the name_sort_key_custom flag/migration in favour of a flagless rule: a key is "custom" when it no longer equals compute(name). Apply that consistently across all three write paths so a manual sort key survives renames while a derived key keeps following the name: - @validates re-derives on name assignment only when the stored key still matches the derived value; direct name_sort_key assignment stores a normalized custom key (or reverts to derived when cleared). Handles both kwarg orders at construction. - update_rom mirrors the same check for the bulk update() path it bypasses. - The edit endpoint only writes the key when the user actually changed the field, delegating the untouched case to update_rom. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Backfill the `sort-key` key (added to en_US/en_GB) across the remaining 15 locale rom.json files with translations, so check_i18n_locales passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 33 out of 37 changed files in this pull request and generated 4 comments.
Files not reviewed (4)
- frontend/src/generated/models/Body_update_rom_api_roms__id__put.ts: Generated file
- frontend/src/generated/models/DetailedRomSchema.ts: Generated file
- frontend/src/generated/models/RomGamelistMetadata.ts: Generated file
- frontend/src/generated/models/SimpleRomSchema.ts: Generated file
gantoine
approved these changes
Jun 18, 2026
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.
ES-DE
gamelist.xmlimports were ignoring<sortname>, so collections with Kanji/Hanzi titles could not preserve the intended library ordering. This change imports that field, uses it for ROM name sorting without changing the displayed title, and exposes it as an editable ROM field.Import ES-DE sort metadata
<sortname>fromgamelist.xmlsort_nameUse
sort_namefor orderingRom.sort_nameoverRom.namewhen ordering by namenameas the display title; only sort behavior changesPersist the new field
roms.sort_nameExpose
sort_namefor editingsort_namein ROM read/update API schemassort_nameto the ROM edit dialog so it can be changed manuallysort_namewhen metadata is unmatchedCover the new behavior
<sortname>sort_namewhen presentsort_nameWith this imported, the ROM still displays as
悪魔城ドラキュラ, but name sorting usesAkumajou Dracula. The imported sort title can also be reviewed and edited later from the ROM edit form.