Skip to content

Add Rom.ra_hash and RomFile.ra_hash fields to API#3019

Merged
gantoine merged 2 commits intomasterfrom
ra-hash-api-response
Feb 13, 2026
Merged

Add Rom.ra_hash and RomFile.ra_hash fields to API#3019
gantoine merged 2 commits intomasterfrom
ra-hash-api-response

Conversation

@gantoine
Copy link
Member

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

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
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 integrates support for RetroAchievements (RA) hashes into the API and its underlying database handler. It introduces a new ra_hash field across relevant data models and updates the ROM lookup endpoint and its database query logic to allow identifying ROMs using this new hash type, thereby enhancing the system's ROM identification capabilities.

Highlights

  • API Model Extension: Added the ra_hash field to the RomFileSchema and RomSchema API response models, allowing for the inclusion of RetroAchievements hash values in ROM data.
  • API Endpoint Enhancement: Extended the get_rom_by_hash API endpoint to accept ra_hash as an optional query parameter, enabling ROM lookup using this new hash type. The endpoint's validation logic was also updated to ensure at least one hash (CRC, MD5, SHA1, or RA) is provided.
  • Database Handler Update: Modified the get_rom_by_hash method in the database handler to accept ra_hash as an optional parameter and incorporated it into the database query conditions for both Rom and RomFile entities, facilitating database lookups by RetroAchievements hash.
Changelog
  • backend/endpoints/responses/rom.py
    • Added ra_hash field to the RomFileSchema class.
    • Added ra_hash field to the RomSchema class.
  • backend/endpoints/rom.py
    • Modified the get_rom_by_hash function to include ra_hash as an optional query parameter.
    • Updated the conditional check in get_rom_by_hash to validate if at least one of crc_hash, md5_hash, sha1_hash, or ra_hash is provided.
    • Passed the new ra_hash parameter to the db_rom_handler.get_rom_by_hash call.
  • backend/handler/database/roms_handler.py
    • Updated the get_rom_by_hash method signature to accept ra_hash as an optional parameter with a default value of None.
    • Extended the query conditions within get_rom_by_hash to include ra_hash for both Rom and RomFile entities when performing database lookups.
Activity
  • The author has tested the changes locally.
  • Relevant comments within the code have been updated.
  • Reviewers have not yet been assigned for this pull request.
  • Unit tests covering the changes have not yet been added.
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.

Copy link
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 correctly adds support for querying ROMs by their RetroAchievements hash (ra_hash). The changes are implemented across the API response schemas, the endpoint, and the database handler. The implementation is straightforward and correct. I've found a minor typo in an API parameter description, which I've left a comment on. It would also be beneficial to add a unit test for the get_rom_by_hash endpoint to cover this new search capability, as noted in the PR checklist.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

Test Results

801 tests   800 ✅  2m 4s ⏱️
  1 suites    1 💤
  1 files      0 ❌

Results for commit a3c8828.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
13015 8517 65% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
backend/endpoints/responses/rom.py 96% 🟢
backend/endpoints/rom.py 45% 🟢
backend/handler/database/roms_handler.py 54% 🟢
TOTAL 65% 🟢

updated for commit: a3c8828 by action🐍

@gantoine gantoine merged commit 5a7312d into master Feb 13, 2026
8 checks passed
@gantoine gantoine deleted the ra-hash-api-response branch February 13, 2026 16:32
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.

1 participant

Comments