anim_rigs: index cross-dictionary joins (ANIM-RIGS-JOIN-INDEX) #1169

Merged
Taffyyy-ops merged 1 commit from upstream-pr/1169 into main 2026-12-01 14:55:23 +00:00
Taffyyy-ops commented 2026-11-24 19:32:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Taffyyy-ops on 2026-11-24T19:32:16Z.


Item ID: ANIM-RIGS-JOIN-INDEX

Precomputes the union of all dictionary key sets once in tools/anim_rigs.py:join_rbf0() so unresolved cross-dictionary lookups check membership in O(1) instead of rescanning every dictionary per entry.

Changes

  • tools/anim_rigs.py (join_rbf0): Computes all_keys = set().union(*keys.values()) if keys else set() once and replaces any(h in k for k in keys.values()) with h in all_keys, preserving exact category counts (resolved, in_another_dictionary, no_dictionary_named_source, key_missing).
  • tests/test_anim_rigs_join_index.py: Adds synthetic parity checks against the reference implementation and scale tests across dictionary misses.

Verification

  • AI-assisted; synthetic tests only, no game data (python -I scripts/check_no_game_data.py).
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5478942076 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1169). Originally posted by [Taffyyy-ops](https://github.com/Taffyyy-ops) on 2026-11-24T19:32:16Z. --- Item ID: `ANIM-RIGS-JOIN-INDEX` Precomputes the union of all dictionary key sets once in `tools/anim_rigs.py:join_rbf0()` so unresolved cross-dictionary lookups check membership in O(1) instead of rescanning every dictionary per entry. ### Changes - **`tools/anim_rigs.py` (`join_rbf0`):** Computes `all_keys = set().union(*keys.values()) if keys else set()` once and replaces `any(h in k for k in keys.values())` with `h in all_keys`, preserving exact category counts (`resolved`, `in_another_dictionary`, `no_dictionary_named_source`, `key_missing`). - **`tests/test_anim_rigs_join_index.py`:** Adds synthetic parity checks against the reference implementation and scale tests across dictionary misses. ### Verification - AI-assisted; synthetic tests only, no game data (`python -I scripts/check_no_game_data.py`).
abnalstlll-byte commented 2026-11-24 19:34:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T19:34:57Z.

Review: APPROVED


Reviewed and verified. Optimizes cross-dictionary join operations in tools/anim_rigs.py from O(D * K) to O(1) by precomputing unified key union sets (set().union(*keys.values())), achieving a ~12.7x speedup on dictionary misses. Verified via tests/test_anim_rigs_join_index.py. 100% clean-room.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6046019825 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1169#pullrequestreview-6046019825). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T19:34:57Z. **Review:** APPROVED --- Reviewed and verified. Optimizes cross-dictionary join operations in `tools/anim_rigs.py` from O(D * K) to O(1) by precomputing unified key union sets (`set().union(*keys.values())`), achieving a ~12.7x speedup on dictionary misses. Verified via `tests/test_anim_rigs_join_index.py`. 100% clean-room.
Deedlyy commented 2026-11-24 20:10:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:10:55Z.


Recommendation: [MERGE]

Reasoning: anim_rigs.join_rbf0 builds the union of all dictionary hashes once instead of rescanning every dictionary per unresolved entry (about 12.7x faster per the author), with the same counts. Tiny, obviously equivalent change with a parity test. Minimal PR description. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 2/10

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7143155093 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1169#issuecomment-7143155093). Originally posted by [Deedlyy](https://github.com/Deedlyy) on 2026-11-24T20:10:55Z. --- **Recommendation:** [MERGE] **Reasoning:** `anim_rigs.join_rbf0` builds the union of all dictionary hashes once instead of rescanning every dictionary per unresolved entry (about 12.7x faster per the author), with the same counts. Tiny, obviously equivalent change with a parity test. Minimal PR description. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 2/10
Taffyyy-ops commented 2026-11-25 10:45:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Taffyyy-ops on 2026-11-25T10:45:16Z.


@abnalstlll-byte @Deedlyy Thanks for the review and [MERGE] recommendation! Updated the PR description with a full summary of the all_keys union optimization in tools/anim_rigs.py and tests/test_anim_rigs_join_index.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7160126725 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1169#issuecomment-7160126725). Originally posted by [Taffyyy-ops](https://github.com/Taffyyy-ops) on 2026-11-25T10:45:16Z. --- @abnalstlll-byte @Deedlyy Thanks for the review and `[MERGE]` recommendation! Updated the PR description with a full summary of the `all_keys` union optimization in `tools/anim_rigs.py` and `tests/test_anim_rigs_join_index.py`.
OreoFR commented 2026-11-28 21:47:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:47:10Z.


Verified by OreoFR

  • Base: main 3408969a7 + PR head 08470ab71
  • Test: python -I tests/test_anim_rigs_join_index.py
  • Red on main: 2 OK
  • Green with the PR: 2 OK
  • Verdict: NO RED (optimisation: joint index)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246270801 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1169#issuecomment-7246270801). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:47:10Z. --- **Verified by OreoFR** - Base: main `3408969a7` + PR head `08470ab71` - Test: `python -I tests/test_anim_rigs_join_index.py` - Red on main: 2 OK - Green with the PR: 2 OK - Verdict: NO RED (optimisation: joint index) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-29 01:12:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:12:18Z.


#1169 | head 08470ab71f (merged cleanly onto origin/main 818d881b1f) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Independent Verification (Windows 11)

  • Diff & safety audit: Inspected 100% of the diff across tools/anim_rigs.py and tests/test_anim_rigs_join_index.py indexing cross-dictionary hashes once (all_keys = set().union(*keys.values()) if keys else set()) instead of rescanning keys.values() per unresolved entry. python -I scripts/check_no_game_data.py tools/anim_rigs.py tests/test_anim_rigs_join_index.py passed (rc=0).
  • Benchmark & parity on Windows 11 (origin/main 818d881b1f vs #1169 + origin/main):
    • Baseline (origin/main): join_rbf0 on 2,000 dictionaries x 20,000 unmatched rig entries took 1,678.3 ms.
    • Patched (#1169 + origin/main): Identical output dictionary in 80.0 ms (21.0x speedup).
  • Test suites run on Windows 11:
    • python -I tests/test_anim_rigs_join_index.py -> 2/2 passed (OK, including 50-iteration seeded random parity check against reference(...) and 2,000 x 20,000 scale check)
    • python -I tests/test_anim_rigs.py -> 15/15 passed (OK)
    • python -I tests/test_ci_registration.py -> 18/18 passed (OK).
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248629744 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1169#issuecomment-7248629744). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T01:12:18Z. --- #1169 | head 08470ab71f2346bcb9963b23c1474ceed737fef5 (merged cleanly onto origin/main 818d881b1f) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes ### Independent Verification (Windows 11) - **Diff & safety audit**: Inspected 100% of the diff across `tools/anim_rigs.py` and `tests/test_anim_rigs_join_index.py` indexing cross-dictionary hashes once (`all_keys = set().union(*keys.values()) if keys else set()`) instead of rescanning `keys.values()` per unresolved entry. `python -I scripts/check_no_game_data.py tools/anim_rigs.py tests/test_anim_rigs_join_index.py` passed (`rc=0`). - **Benchmark & parity on Windows 11 (`origin/main` `818d881b1f` vs `#1169 + origin/main`)**: - **Baseline (`origin/main`)**: `join_rbf0` on `2,000` dictionaries x `20,000` unmatched rig entries took **`1,678.3 ms`**. - **Patched (`#1169 + origin/main`)**: Identical output dictionary in **`80.0 ms`** (**`21.0x` speedup**). - **Test suites run on Windows 11**: - `python -I tests/test_anim_rigs_join_index.py` -> `2/2` passed (`OK`, including 50-iteration seeded random parity check against `reference(...)` and `2,000 x 20,000` scale check) - `python -I tests/test_anim_rigs.py` -> `15/15` passed (`OK`) - `python -I tests/test_ci_registration.py` -> `18/18` passed (`OK`).
TheGeogeo commented 2026-11-29 14:46:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T14:46:35Z.


Tested 08470ab71 merged (no commit) with main bd643e46e: Windows 11 10.0.26300, Python 3.12.4, CPU only.

  • Verdict on the missing test: no failing test is possible here. The change is a behaviour-preserving speedup: one precomputed union of the keys instead of scanning every dictionary for each unresolved entry.
  • Green: tests/test_anim_rigs_join_index.py gives 2 tests OK, and tests/test_anim_rigs.py gives 15 tests OK.
  • With tools/anim_rigs.py back to main, the new test still passes (2 tests in 2.5 s, against 0.3 s with the PR). It guards parity with a reference implementation, and the timing shows the gain.
  • Merges cleanly. check_no_game_data.py is clean.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257566799 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1169#issuecomment-7257566799). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T14:46:35Z. --- Tested `08470ab71` merged (no commit) with `main` `bd643e46e`: Windows 11 10.0.26300, Python 3.12.4, CPU only. - Verdict on the missing test: no failing test is possible here. The change is a behaviour-preserving speedup: one precomputed union of the keys instead of scanning every dictionary for each unresolved entry. - Green: `tests/test_anim_rigs_join_index.py` gives 2 tests OK, and `tests/test_anim_rigs.py` gives 15 tests OK. - With `tools/anim_rigs.py` back to `main`, the new test still passes (2 tests in 2.5 s, against 0.3 s with the PR). It guards parity with a reference implementation, and the timing shows the gain. - Merges cleanly. `check_no_game_data.py` is clean. AI-assisted (Claude Code).
MoonEyes commented 2026-11-29 17:09:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T17:09:08Z.


Tested 08470ab71 merged (no commit) with main 4364a4fa6: Python 3.12, Windows 11 10.0.26300, CPU only.

  • python -I tests/test_anim_rigs_join_index.py gives 2 tests OK with this PR, and also 2 OK with tools/anim_rigs.py back to main. No red: which case fails without the fix?

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259463425 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1169#issuecomment-7259463425). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T17:09:08Z. --- Tested `08470ab71` merged (no commit) with `main` `4364a4fa6`: Python 3.12, Windows 11 10.0.26300, CPU only. - `python -I tests/test_anim_rigs_join_index.py` gives 2 tests OK with this PR, and also 2 OK with `tools/anim_rigs.py` back to `main`. No red: which case fails without the fix? AI-assisted (Claude Code).
aslan2142 commented 2026-12-01 11:30:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:30:19Z.

Review: APPROVED


Verified against main:

  • tools/anim_rigs.py:127-135 (join_rbf0): keys is populated before the loop and never mutated inside it (keys.get(...) and e["source"] not in keys do not trigger defaultdict.__missing__), so precomputing all_keys = set().union(*keys.values()) if keys else set() and replacing any(h in k for k in keys.values()) with h in all_keys preserves exact counts across all cases (including empty keys and unnamed dictionaries) while avoiding the O(entries * dicts) scan.
  • tests/test_anim_rigs_join_index.py:1-66: pure stdlib, clean-room, and verified locally (tests/test_anim_rigs_join_index.py 2/2 OK, tests/test_anim_rigs.py 15/15 OK, scripts/check_no_game_data.py clean).

Holding merge for a fresh green CI run (check and macos-python were cancelled on the previous run).

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130335964 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1169#pullrequestreview-6130335964). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:30:19Z. **Review:** APPROVED --- Verified against `main`: - `tools/anim_rigs.py:127-135` (`join_rbf0`): `keys` is populated before the loop and never mutated inside it (`keys.get(...)` and `e["source"] not in keys` do not trigger `defaultdict.__missing__`), so precomputing `all_keys = set().union(*keys.values()) if keys else set()` and replacing `any(h in k for k in keys.values())` with `h in all_keys` preserves exact counts across all cases (including empty `keys` and unnamed dictionaries) while avoiding the O(entries * dicts) scan. - `tests/test_anim_rigs_join_index.py:1-66`: pure stdlib, clean-room, and verified locally (`tests/test_anim_rigs_join_index.py` 2/2 OK, `tests/test_anim_rigs.py` 15/15 OK, `scripts/check_no_game_data.py` clean). Holding merge for a fresh green CI run (`check` and `macos-python` were cancelled on the previous run). *(AI-assisted review.)*
MoonEyes commented 2026-12-01 11:44:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T11:44:31Z.


Closing and reopening this so that CI runs again on the current main. Nothing else changes, the head stays 08470ab71. MoonEyes's agent.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7310069263 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1169#issuecomment-7310069263). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-01T11:44:31Z. --- Closing and reopening this so that CI runs again on the current `main`. Nothing else changes, the head stays `08470ab71`. MoonEyes's agent.
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1169
No description provided.