text_tables: read a directory source's subfolders in name order (TEXT-TABLES-WALK-ORDER) #2235

Open
github-bot wants to merge 1 commit from github-bot/gh-2235 into main AGit
Owner

@⁠syfyra on GitHub · 2026-11-26 09:47 UTC · original
syfyra:fix/text-tables-walk-order → main · +34 −2 · 2 files · 1 commits · draft

Claimed in the coordination issue as: TEXT-TABLES-WALK-ORDER (#1608)

What and why

For a source that is a folder of whole resources, tools/text_tables.py blobs() sorted the files of each folder but walked the subfolders in the order os.walk lists them, which is the file system's: by name on NTFS, by hash on ext4. The dialogue table keeps the last text read for a label (docs/text.md, "Labels with two texts": a label can have two texts in one language), so the same folder gave a different text_en and a different --tables/--strings row order on Windows and on Linux. AGENTS.md asks for the same output for the same input on every platform.

The walk now sorts its subfolder list in place, so it descends in name order everywhere; the open #921 does the same in gamedata_xml. Carve folders (index.json) and .rpf sources are read in offset order and are not affected.

Tested

Windows 11, Python 3.14.7, synthetic resources only:

  • python -I tests/test_text_tables.py: the new TestDialogue.test_subfolders_are_read_in_name_order writes one table each into a/ and b/ with different text for one label and reads the folder with the real walk and with one that lists subfolders backwards (standing in for another file system). On main the backwards walk reads b first and the first table's text wins; with the fix both give the same order and text. 34 tests OK.
  • python -I tests/test_progress_dashboard.py OK; python -m compileall; scripts/check_no_game_data.py on both files.

GPUs tested: n/a (CPU-only tool)

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

**@⁠syfyra** on GitHub · 2026-11-26 09:47 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2235) `syfyra:fix/text-tables-walk-order` → `main` · +34 −2 · 2 files · 1 commits · draft Claimed in the coordination issue as: TEXT-TABLES-WALK-ORDER (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why For a source that is a folder of whole resources, `tools/text_tables.py` `blobs()` sorted the files of each folder but walked the subfolders in the order `os.walk` lists them, which is the file system's: by name on NTFS, by hash on ext4. The dialogue table keeps the last text read for a label (docs/text.md, "Labels with two texts": a label can have two texts in one language), so the same folder gave a different `text_en` and a different `--tables`/`--strings` row order on Windows and on Linux. AGENTS.md asks for the same output for the same input on every platform. The walk now sorts its subfolder list in place, so it descends in name order everywhere; the open #921 does the same in `gamedata_xml`. Carve folders (`index.json`) and `.rpf` sources are read in offset order and are not affected. ### Tested Windows 11, Python 3.14.7, synthetic resources only: - `python -I tests/test_text_tables.py`: the new `TestDialogue.test_subfolders_are_read_in_name_order` writes one table each into `a/` and `b/` with different text for one label and reads the folder with the real walk and with one that lists subfolders backwards (standing in for another file system). On `main` the backwards walk reads `b` first and the first table's text wins; with the fix both give the same order and text. 34 tests OK. - `python -I tests/test_progress_dashboard.py` OK; `python -m compileall`; `scripts/check_no_game_data.py` on both files. GPUs tested: n/a (CPU-only tool) AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
blobs() sorted the files of each folder but walked the subfolders in the
order os.walk lists them, which is the file system's: by name on NTFS, by
hash on ext4. The dialogue table keeps the last text read for a label
(docs/text.md, "Labels with two texts"), so the same folder of resources
gave a different text_en, and a different --tables/--strings row order,
on Windows and Linux. Sort the subfolders in place so the walk descends
in name order everywhere.

Tested: new test_subfolders_are_read_in_name_order with a walk that lists
subfolders backwards; it fails before the fix (b before a, the first
table's text wins) and passes after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:24:04 +00:00
Author
Owner

@⁠real-rusher on GitHub · 2026-11-26 10:06 UTC · original

Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_text_tables.py: 34 tests OK (1 skipped). The PR's test file against main's tools/text_tables.py: 1 failure, so the new test fails on main and passes with the fix. compileall clean.

AI-assisted: yes (Claude Code)

**@⁠real-rusher** on GitHub · 2026-11-26 10:06 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2235#issuecomment-7188910629) Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_text_tables.py: 34 tests OK (1 skipped). The PR's test file against main's tools/text_tables.py: 1 failure, so the new test fails on main and passes with the fix. compileall clean. AI-assisted: yes (Claude Code)
Author
Owner

@⁠lixonik on GitHub · 2026-11-26 11:11 UTC · original · reviewed

Windows 11: 34/34 text-table tests passed, including deterministic folder traversal and duplicate resolution. No findings from these checks.

AI-assisted.

**@⁠lixonik** on GitHub · 2026-11-26 11:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2235#pullrequestreview-6073114880) · **reviewed** Windows 11: 34/34 text-table tests passed, including deterministic folder traversal and duplicate resolution. No findings from these checks. AI-assisted.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2235/head:github-bot/gh-2235'
git switch 'github-bot/gh-2235'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2235'
git switch 'github-bot/gh-2235'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2235'
git switch 'github-bot/gh-2235'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2235'
git switch 'main'
git merge --squash 'github-bot/gh-2235'
git switch 'main'
git merge --ff-only 'github-bot/gh-2235'
git switch 'main'
git merge 'github-bot/gh-2235'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.