Skip to content

New endpoints to fetch all IDs#2921

Merged
gantoine merged 9 commits intomasterfrom
only-ids-param
Jan 28, 2026
Merged

New endpoints to fetch all IDs#2921
gantoine merged 9 commits intomasterfrom
only-ids-param

Conversation

@gantoine
Copy link
Copy Markdown
Member

@gantoine gantoine commented Jan 19, 2026

Description
Explain the changes or enhancements you are proposing with this pull request.

These are high-performance endpoints that simply return a list of IDs for some objects, without a) fetching all fields and b) going through pydantic to populate the models.

Checklist
Please check all that apply.

  • I've tested the changes locally
  • I've updated relevant comments
  • I've assigned reviewers for this PR
  • I've added unit tests that cover the changes

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @gantoine, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the API by introducing a suite of new endpoints designed to efficiently retrieve lists of identifiers for various resource types, such as collections, firmware, platforms, ROMs, saves, states, and users. This change improves client-side data fetching by allowing applications to request only the IDs they need, reducing payload size and database load. The underlying database query logic has been optimized to support this partial data retrieval, ensuring better performance.

Highlights

  • New Identifier Endpoints: Introduced dedicated /identifiers endpoints across various resource types (collections, firmware, platforms, ROMs, saves, states, and users) to efficiently retrieve lists of their respective IDs.
  • Database Query Optimization: Enhanced underlying database handler methods to accept an only_fields parameter, enabling SQLAlchemy's load_only option for more efficient retrieval of specific columns, primarily for the new identifier endpoints.
  • Code Clean-up and Consistency: Removed redundant db_rom_handler imports from within functions in backend/endpoints/rom.py and updated a comment in backend/handler/metadata/igdb_handler.py for clarity.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 19, 2026

Test Results

703 tests   702 ✅  1m 28s ⏱️
  1 suites    1 💤
  1 files      0 ❌

Results for commit 67efe62.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 19, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
12330 7989 65% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
backend/endpoints/collections.py 30% 🟢
backend/endpoints/firmware.py 29% 🟢
backend/endpoints/platform.py 56% 🟢
backend/endpoints/responses/collection.py 96% 🟢
backend/endpoints/rom.py 45% 🟢
backend/endpoints/saves.py 31% 🟢
backend/endpoints/states.py 31% 🟢
backend/endpoints/user.py 59% 🟢
backend/handler/database/collections_handler.py 45% 🟢
backend/handler/database/firmware_handler.py 58% 🟢
backend/handler/database/platforms_handler.py 86% 🟢
backend/handler/database/roms_handler.py 55% 🟢
backend/handler/database/saves_handler.py 90% 🟢
backend/handler/database/states_handler.py 90% 🟢
backend/handler/database/users_handler.py 90% 🟢
backend/handler/metadata/igdb_handler.py 36% 🟢
TOTAL 58% 🟢

updated for commit: 67efe62 by action🐍

@BrandonKowalski
Copy link
Copy Markdown
Member

Damn. This caused more work than anticipated. Thanks for doing this! ❤️

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces new endpoints to fetch identifiers for various entities (collections, firmware, platforms, ROMs, saves, states, and users). It also refactors the corresponding database handlers to accept an only_fields parameter, optimizing queries by loading only necessary columns. This is a good approach for improving efficiency. Additionally, some minor cleanup of local imports in backend/endpoints/rom.py and a comment update in backend/handler/metadata/igdb_handler.py were made.

@gantoine
Copy link
Copy Markdown
Member Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several new /identifiers endpoints across various resources to efficiently fetch only the IDs. This is a great performance enhancement. The implementation is supported by adding an only_fields parameter to the corresponding database handler methods, which leverages SQLAlchemy's load_only feature.

My review focuses on further improving the performance of these new endpoints. I've identified a few areas where database queries can be made more efficient by avoiding unnecessary data loading and moving filtering logic from the application to the database. These changes will ensure the new endpoints are as fast and scalable as possible.

@gantoine
Copy link
Copy Markdown
Member Author

/gemini review

@gantoine gantoine marked this pull request as ready for review January 19, 2026 14:59
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new high-performance endpoints to fetch resource identifiers, which is a great addition for improving frontend performance. The changes are well-implemented by adding an only_fields parameter to the database handlers to limit the data fetched from the database. I've found a couple of areas for improvement related to performance and code redundancy in the new and existing endpoints, which I've detailed in the comments. Specifically, one of the new identifier endpoints can be made more efficient, and an existing endpoint has some redundant filtering logic. Overall, this is a solid contribution that improves the API's performance. Addressing the suggested changes will make it even better.

@gantoine gantoine merged commit 2052ca6 into master Jan 28, 2026
8 checks passed
@gantoine gantoine deleted the only-ids-param branch January 28, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants