From 26505ccca4c6a71de0147d18d5df80d4154c8a18 Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Wed, 5 Aug 2026 19:19:55 -0500 Subject: [PATCH] docs: tighten the launchbox key-normalization comments Both blocks ended on a counterfactual about what storing raw text would do, which explains the change rather than the behaviour. State what the code does instead. Co-Authored-By: Claude Opus 5 --- backend/tasks/scheduled/update_launchbox_metadata.py | 6 ++---- backend/tests/tasks/test_update_launchbox_metadata.py | 8 +++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/backend/tasks/scheduled/update_launchbox_metadata.py b/backend/tasks/scheduled/update_launchbox_metadata.py index bdbb3b9f1..048e7e58b 100644 --- a/backend/tasks/scheduled/update_launchbox_metadata.py +++ b/backend/tasks/scheduled/update_launchbox_metadata.py @@ -143,10 +143,8 @@ class UpdateLaunchboxMetadataTask(RemoteFilePullTask): # Update initial progress update_stats.update(processed=processed_files, total=total_files) - # Every key below is stored the way lookups build it (stripped, - # and lowercased wherever the lookup lowercases). Storing the - # raw XML text instead would bury an entry behind whitespace - # nothing ever queries for. + # Keys are stored the way lookups build them: stripped, and + # lowercased wherever the lookup lowercases. for file in file_list: if file == "Platforms.xml": with z.open(file, "r") as f: diff --git a/backend/tests/tasks/test_update_launchbox_metadata.py b/backend/tests/tasks/test_update_launchbox_metadata.py index 0004c6101..a19b8b750 100644 --- a/backend/tests/tasks/test_update_launchbox_metadata.py +++ b/backend/tests/tasks/test_update_launchbox_metadata.py @@ -186,11 +186,9 @@ class TestUpdateLaunchboxMetadataTask: files_calls = [call for call in hset_calls if call[0][0] == LAUNCHBOX_FILES_KEY] assert len(files_calls) == 2 - # The fixture pads one entry per index the way a pretty-printed dump - # would. Keys have to come out normalized, or nothing would ever query - # them: lookups strip (and lowercase, where the index is lowercased). - # The Files key carries its platform too, since the same dump filename - # exists on several systems. + # The fixture pads one entry per index, as a pretty-printed dump does. + # Keys come out normalized, and the Files key carries its platform, + # since one dump filename exists on several systems. def fields(calls) -> set[str]: return {field for call in calls for field in call[1]["mapping"]}