[PR #921] gamedata_xml: write CSV/JSON reports atomically and sort walk subdirs #959

Open
opened 2026-11-26 20:19:37 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/921
Author: @narekshaghoyandev
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: ubiq-gamedata-xml-atomic-and-order


📝 Commits (1)

  • 1fef9b9 gamedata_xml: write CSV/JSON reports atomically and sort walk subdirs

📊 Changes

2 files changed (+117 additions, -8 deletions)

View changed files

📝 tests/test_gamedata_xml.py (+68 -0)
📝 tools/gamedata_xml.py (+49 -8)

📄 Description

Summary

  • Write --csv and --json reports in tools/gamedata_xml.py atomically via a staging temp file in the destination folder (file_mode.published_mode + replace_retry.replace), cleaning up staging files (including read-only ones) on failure so an existing report is never clobbered or truncated.
  • Extract write_json() with allow_nan=False and a trailing newline.
  • Sort dirs in place inside xml_files() so recursive directory walks visit subdirectories in deterministic order regardless of filesystem readdir order.
  • Accept an optional argv=None parameter in main(argv=None).

Verification

  • python3 -I tests/test_gamedata_xml.py -v — 18/18 pass (4 new regression tests).
  • Negative control against main: all 4 new tests fail before the patch and pass after.
  • python3 -I -m py_compile tools/gamedata_xml.py tests/test_gamedata_xml.py — pass.
  • python3 -I scripts/check_no_game_data.py tools/gamedata_xml.py tests/test_gamedata_xml.py — clean.

Claimed in the coordination issue as: BUILD-GAMEDATA-XML-ATOMIC-AND-ORDER
AI-assisted: yes (Gemini)


🔄 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/ubiquitarianism/leonida/pull/921 **Author:** [@narekshaghoyandev](https://github.com/narekshaghoyandev) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `ubiq-gamedata-xml-atomic-and-order` --- ### 📝 Commits (1) - [`1fef9b9`](https://github.com/ubiquitarianism/leonida/commit/1fef9b9f5c85d3dc702b83d09a24961c5dff1d30) gamedata_xml: write CSV/JSON reports atomically and sort walk subdirs ### 📊 Changes **2 files changed** (+117 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_gamedata_xml.py` (+68 -0) 📝 `tools/gamedata_xml.py` (+49 -8) </details> ### 📄 Description ## Summary - Write `--csv` and `--json` reports in `tools/gamedata_xml.py` atomically via a staging temp file in the destination folder (`file_mode.published_mode` + `replace_retry.replace`), cleaning up staging files (including read-only ones) on failure so an existing report is never clobbered or truncated. - Extract `write_json()` with `allow_nan=False` and a trailing newline. - Sort `dirs` in place inside `xml_files()` so recursive directory walks visit subdirectories in deterministic order regardless of filesystem `readdir` order. - Accept an optional `argv=None` parameter in `main(argv=None)`. ## Verification - `python3 -I tests/test_gamedata_xml.py -v` — 18/18 pass (4 new regression tests). - Negative control against `main`: all 4 new tests fail before the patch and pass after. - `python3 -I -m py_compile tools/gamedata_xml.py tests/test_gamedata_xml.py` — pass. - `python3 -I scripts/check_no_game_data.py tools/gamedata_xml.py tests/test_gamedata_xml.py` — clean. Claimed in the coordination issue as: BUILD-GAMEDATA-XML-ATOMIC-AND-ORDER AI-assisted: yes (Gemini) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
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
starred/leonida#959
No description provided.