From 1c34503f4e7570c208696ce35cedd2cd260364f4 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 6 Oct 2026 05:11:41 +0200 Subject: [PATCH] fix: one game data list for notes and composition --- scripts/check_release_assets.py | 4 +-- scripts/common.py | 1 + tests/test_large_file_cache.py | 51 +++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/scripts/check_release_assets.py b/scripts/check_release_assets.py index 2afa52c5..5c934260 100644 --- a/scripts/check_release_assets.py +++ b/scripts/check_release_assets.py @@ -24,7 +24,7 @@ import sys from collections.abc import Iterable sys.path.insert(0, os.path.dirname(__file__)) -from common import load_database +from common import composition_tier, load_database from largefiles import ( LARGE_FILES_RELEASE, LARGE_FILES_REPO, @@ -129,7 +129,7 @@ def _section_for(path: str) -> str: return "Arcade" if top == "QEMU": return "Virtual machine firmware" - if top in ("RPG Maker", "ScummVM"): + if composition_tier(path) == "game_data": return "Game engine data" if top in ("Apple", "Commodore", "Atari", "Sinclair", "Amstrad"): return "Computer" diff --git a/scripts/common.py b/scripts/common.py index ecfe8328..8b7ff9c1 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -1076,6 +1076,7 @@ GAME_DATA_TOPS = ( "Interplay", "Monolith", "Softdisk", + "Toys for Bob", "Valve", ) diff --git a/tests/test_large_file_cache.py b/tests/test_large_file_cache.py index 3ce19d46..b83c85a0 100644 --- a/tests/test_large_file_cache.py +++ b/tests/test_large_file_cache.py @@ -498,5 +498,56 @@ class DownloadFailuresAndRevisions(unittest.TestCase): ["PS3UPDAT.PUP", "PS3UPDAT.PUP.ed8ab192"], ) + +class GameDataHasOneDefinition(unittest.TestCase): + """The release notes and the composition table sorted game data apart. + + The notes knew two engine trees, the table sixteen: fifteen assets of + Doom, Quake, Half-Life and Descent were listed as "Other". The Ur-Quan + Masters tree was in neither. + """ + + def test_the_release_section_follows_the_composition_tier(self): + import check_release_assets + + for path in ( + "bios/Id Software/Doom 3/demo/demo00.pk4", + "bios/Valve/Half-Life/valve/pak0.pak", + "bios/Toys for Bob/The Ur-Quan Masters/uqm-0.8.0-voice.uqm", + ): + with self.subTest(path=path): + self.assertEqual(common.composition_tier(path), "game_data") + self.assertEqual( + check_release_assets._section_for(path), "Game engine data" + ) + + def test_a_tree_of_game_data_alone_is_a_game_data_tree(self): + db_path = REPO_ROOT / "database.json" + if not db_path.exists(): + self.skipTest("database.json not generated") + db = json.loads(db_path.read_text(encoding="utf-8")) + profiles = common.load_emulator_profiles(str(REPO_ROOT / "emulators")) + names: dict[str, set[str]] = {} + for profile in profiles.values(): + for entry in profile.get("files") or []: + category = entry.get("category", "bios") + for name in [entry.get("name"), *(entry.get("aliases") or [])]: + if name: + names.setdefault(name, set()).add(category) + trees: dict[str, set[str]] = {} + for record in db["files"].values(): + parts = record["path"].split("/") + if len(parts) > 2 and parts[0] == "bios": + trees.setdefault(parts[1], set()).update( + names.get(record["name"], {"unreferenced"}) + ) + only_game_data = sorted( + top for top, categories in trees.items() if categories == {"game_data"} + ) + self.assertEqual( + [top for top in only_game_data if top not in common.GAME_DATA_TOPS], [] + ) + + if __name__ == "__main__": unittest.main()