mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
* fix(recommendations): handle named metadata objects in facet tokens * fix(recommendations): pr-ready step 2 (code-review): skip non-list columns, base role fallback on usable names Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(recommendations): pr-ready step 3 (simplify): type facet params as object, trim redundant test cases Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(recommendations): pr-ready step 4 (review-polish): keep the extract_tokens test prefix Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(roms): read names from metadata objects in filter values and ROM responses Share the facet name cleaner as utils.facets.facet_names, and run it in the filter-values reader, RomMetadataSchema, and over every list[str] key of the provider metadata blobs, so an {id, name} entry no longer fails /api/roms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(roms): clean name lists in raw metadata edits, reject non-object JSON parse_raw_metadata now runs the provider blob's list-of-names keys through facet_names before storing it, so {id, name} objects stop landing in the database, and answers 422 when the JSON is not an object. Manual metadata keeps its strict adapter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
531 B
Python
21 lines
531 B
Python
import pytest
|
|
|
|
from utils.facets import facet_names
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
("column", "names"),
|
|
[
|
|
(["RPG", " Action "], ["RPG", "Action"]),
|
|
([{"id": 1, "name": "RPG"}, {"name": " Action "}], ["RPG", "Action"]),
|
|
(["RPG", None, 42, {"id": 1}, {"name": None}, {"name": " "}], ["RPG"]),
|
|
("RPG", ["RPG"]),
|
|
(" ", []),
|
|
(None, []),
|
|
(42, []),
|
|
({"id": 1, "name": "RPG"}, []),
|
|
],
|
|
)
|
|
def test_facet_names(column, names):
|
|
assert facet_names(column) == names
|