text_tables: read a directory source's subfolders in name order (TEXT-TABLES-WALK-ORDER) #2235
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2235"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by syfyra on 2026-11-26T09:47:03Z.
Claimed in the coordination issue as: TEXT-TABLES-WALK-ORDER (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7188422465)
What and why
For a source that is a folder of whole resources,
tools/text_tables.pyblobs()sorted the files of each folder but walked the subfolders in the orderos.walklists 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 differenttext_enand a different--tables/--stringsrow 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.rpfsources 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 newTestDialogue.test_subfolders_are_read_in_name_orderwrites one table each intoa/andb/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). Onmainthe backwards walk readsbfirst 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.pyOK;python -m compileall;scripts/check_no_game_data.pyon both files.GPUs tested: n/a (CPU-only tool)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by real-rusher on 2026-11-26T10:06:12Z.
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)
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T11:11:18Z.
Review: COMMENTED
Windows 11: 34/34 text-table tests passed, including deterministic folder traversal and duplicate resolution. No findings from these checks.
AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:01:51Z.
Review: COMMENTED
Draft review against current
main: sortingdirsinos.walkintools/text_tables.py:265with tests intests/test_text_tables.pylooks clean and clean-room verified. Still Draft with no CI run yet — please mark Ready for Review so CI runs green.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:26:38Z.
Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.
(AI-assisted triage.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T13:04:03Z.
Review: APPROVED
Now ready for review and
MERGEABLE. Clean-room verified: sortingdirsintools/text_tables.py:265ensures deterministic directory traversal order, with regression coverage intests/test_text_tables.py(verified on Windows 11 and Linux).Approving — ready to merge once CI runs green on current
main.(AI-assisted review.)