[PR #45] [MERGED] fix(scan): match the most specific KNOWN game entry #81

Closed
opened 2026-10-15 20:53:16 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rehan-remade/universal-modder/pull/45
Author: @enk0r
Created: 10/4/2026
Status: ✅ Merged
Merged: 10/5/2026
Merged by: @rehan-remade

Base: main ← Head: fix/scan-known-game-shadowing


📝 Commits (1)

  • 88d0137 fix(scan): match the most specific KNOWN game entry

📊 Changes

2 files changed (+11 additions, -1 deletions)

View changed files

📝 tests/test_um.py (+10 -0)
📝 um/scan.py (+1 -1)

📄 Description

What

um scan picks the known-game route with:

known = next((v for k, v in KNOWN.items() if k == lname or (k in lname and len(k) > 5)), None)

KNOWN contains both "grand theft auto v" and "grand theft auto v enhanced", and "grand theft auto v" is a substring of "grand theft auto v enhanced". next() returns whichever matching key comes first in dict order, so the Enhanced entry has been dead code since it was added: every "Grand Theft Auto V Enhanced" install gets the legacy route.

Impact

The legacy route tells the user/agent to use the plain ScriptHookV build plus OpenIV/CodeWalker; the Enhanced entry ("ScriptHookV (enhanced build) + ASI loader", no OpenIV/CodeWalker) can never be selected. Since agents read the scan report to choose a modding route, this silently sends GTA V Enhanced owners down a route that doesn't work.

Fix

Sort the candidate keys longest-first so the most specific entry wins:

known = next((v for k, v in sorted(KNOWN.items(), key=lambda kv: -len(kv[0])) if k == lname or (k in lname and len(k) > 5)), None)

Test

test_known_game_longest_key_wins scans a folder named "Grand Theft Auto V Enhanced" and asserts the route comes from the Enhanced entry. It fails on the old code and passes with the fix. Full suite: 29 passed.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rehan-remade/universal-modder/pull/45 **Author:** [@enk0r](https://github.com/enk0r) **Created:** 10/4/2026 **Status:** ✅ Merged **Merged:** 10/5/2026 **Merged by:** [@rehan-remade](https://github.com/rehan-remade) **Base:** `main` ← **Head:** `fix/scan-known-game-shadowing` --- ### 📝 Commits (1) - [`88d0137`](https://github.com/rehan-remade/universal-modder/commit/88d0137b7d00181f0478b5f7e6f7676b29202568) fix(scan): match the most specific KNOWN game entry ### 📊 Changes **2 files changed** (+11 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_um.py` (+10 -0) 📝 `um/scan.py` (+1 -1) </details> ### 📄 Description ## What `um scan` picks the known-game route with: `known = next((v for k, v in KNOWN.items() if k == lname or (k in lname and len(k) > 5)), None)` `KNOWN` contains both `"grand theft auto v"` and `"grand theft auto v enhanced"`, and "grand theft auto v" is a substring of "grand theft auto v enhanced". `next()` returns whichever matching key comes first in dict order, so the Enhanced entry has been dead code since it was added: every "Grand Theft Auto V Enhanced" install gets the **legacy** route. ## Impact The legacy route tells the user/agent to use the plain ScriptHookV build plus OpenIV/CodeWalker; the Enhanced entry ("ScriptHookV (enhanced build) + ASI loader", no OpenIV/CodeWalker) can never be selected. Since agents read the scan report to choose a modding route, this silently sends GTA V Enhanced owners down a route that doesn't work. ## Fix Sort the candidate keys longest-first so the most specific entry wins: `known = next((v for k, v in sorted(KNOWN.items(), key=lambda kv: -len(kv[0])) if k == lname or (k in lname and len(k) > 5)), None)` ## Test `test_known_game_longest_key_wins` scans a folder named "Grand Theft Auto V Enhanced" and asserts the route comes from the Enhanced entry. It fails on the old code and passes with the fix. Full suite: 29 passed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 20:53:16 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rehan-remade/universal-modder#81
No description provided.