mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 01:58:41 +01:00
* fix(backend): project the identifier endpoints onto the id column The `/identifiers` routes for saves, states, firmware, platforms, smart collections and rom notes each asked their handler for entities with `only_fields=[Model.id]`. `load_only` narrows the selected columns but does not cancel an eager relationship, so a `lazy="joined"` join still fired and a full entity was still built for every row. The platforms route was the worst of the six: `with_firmware` eager-loads every firmware row and its platform, and `load_only` does not cancel that either. Each handler grows a small query builder shared by its existing accessor and a new `*_ids` accessor that projects onto the id column with `with_only_columns`, which drops the entity and with it the eager joins. The firmware accessor already applied `noload`, so its SQL is unchanged; it moves to the projection only to stop building rows. `/api/users/identifiers` and the two `/collections` callers that use more than an id are left alone, because nothing eager fires for them. The `executed_statements` fixture moves to `tests/conftest.py` so the new endpoint tests can use it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Update backend/tests/endpoints/test_identifier_endpoints.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * style(backend): drop the leading blank line black rejects Removing the module docstring in the GitHub edit left an empty first line, which is the only thing black wanted to change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * test(backend): drive the note-identifier test through the endpoint Greptile flagged the handler-level test for bypassing the route's auth, 404, and visibility checks. It now issues the request the frontend would and asserts the id-only projection holds among the route's own reads. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * refactor(backend): fold the duplicate SQL-capture fixtures into the shared one Step 3 of the PR-ready gauntlet (simplify). The shared `executed_statements` fixture gains the two roms test files that still declared byte-identical local copies, and the id-only assertions share one statement parser instead of two. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * docs(backend): tighten the get_platform_ids docstring to one line Step 4 of the PR-ready gauntlet (review-polish). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>