BUILD-GAMEDATA-GRAPH-INDEX-AND-ATOMIC: gamedata_graph: index sibling parentPath lookups and write JSON atomically #897
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/897"
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 narekshaghoyandev on 2026-11-24T15:02:25Z.
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)
Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T15:06:16Z.
Review: APPROVED
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.Imported from ubiquitarianism/leonida. Originally posted by LewisStephens99 on 2026-11-24T15:13:39Z.
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.Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-24T23:22:41Z.
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).