BUILD-GAMEDATA-GRAPH-INDEX-AND-ATOMIC: gamedata_graph: index sibling parentPath lookups and write JSON atomically #897
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!897
Loading…
Reference in a new issue
No description provided.
Delete branch "ubiq-gamedata-graph-index-and-atomic"
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?
Pull request successfully merged and closed
Improves
tools/gamedata_graph.pyperformance and JSON report safety with identical graph output:resolve_parent_paths: Lazily indexes siblings by(id(container), tag, attribute) -> {value: [siblings]}instead of scanning every sibling perparentPathelement (O(N^2) o O(N)), preserving exact resolved/ambiguous counts and link order.write_json,main): Publishes--jsonviatempfile.mkstemp+file_mode.published_mode+replace_retry.replacewithallow_nan=False, trailing LF, and read-only-safe temp cleanup on failure (preserving existing reports and permissions). Also accepts optionalargv=Noneinmain(argv=None).Verification
python3 -I tests/test_gamedata_graph.py -v: 21/21 pass (negative control fails onmain).python3 -I scripts/check_no_game_data.py tools/gamedata_graph.py tests/test_gamedata_graph.py: clean.python3 -m compileall -q tools/gamedata_graph.py tests/test_gamedata_graph.py: clean.Claimed in the coordination issue as: BUILD-GAMEDATA-GRAPH-INDEX-AND-ATOMIC (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135309930)
AI-assisted: yes (Gemini)
Reviewed exact head
755283da5980158eac5a6817e2e29340c85bd8d3. The sibling lookup index is keyed by container/tag/attribute and preserves duplicate matches (so ambiguity behavior remains intact); synthetic 2,000/4,000/8,000 sibling chains resolved all expected links with no ambiguity. Atomic JSON output preserves the previous file on replace failure, cleans its temporary file, preserves existing permissions, and writes the trailing LF. Validation on Bazzite/Linux:python3 -I tests/test_gamedata_graph.py -v(19/19 passed), isolated Python compile andgit diff --checkpassed. No game data or GPU used.Independent verification on Windows 11, Python 3.14:
n-python -I tests/test_gamedata_graph.py: 21/21 passed.n- No game data or GPU used. AI-assisted.Merging.
Why merged: BUILD-GAMEDATA-GRAPH-INDEX-AND-ATOMIC: gamedata_graph builds an index of sibling parentPath lookups (O(N) instead of O(N²)), keeping duplicate matches so ambiguity is still detected. It also catches RecursionError and writes --json atomically (mkstemp + replace_retry + published_mode). KernelSmoker approved it, and LewisStephens99 got 21/21 on Windows.
Why it's good: 26 passed. The JSON now uses allow_nan=False, which is harmless because the graph holds only counts.
Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 0f98d193c. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests, ctest_registration) gives 578 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.
AI-assisted (Claude Code, Claude Opus 5.5).