runtime: guard null bind callbacks, add owner accessor and unit test suite for DeferredImageBinding (RT-DEFERRED-IMAGE-BINDING-GUARDS-AND-TESTS) #2057

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

@⁠abnalstlll-byte on GitHub · 2026-11-25 19:09 UTC · original
abnalstlll-byte:feat/rt-deferred-image-binding-guards-and-tests → main · +151 −1 · 3 files · 1 commits · open

Claimed in the coordination issue as: RT-DEFERRED-IMAGE-BINDING-GUARDS-AND-TESTS (claim)

What and why

runtime/src/deferred_image_binding.h synchronizes deferred single-time image memory binding across concurrent calls (e.g. from command replay and descriptor table creation).

  1. Null callback guard:

    • ensure(): guards against null bind_ function pointer (if (!bind_ || !bind_(owner_)) return false;), returning false safely instead of crashing.
  2. Owner query helper:

    • Added owner() accessor returning owner_.
  3. Unit test suite (runtime/test/deferred_image_binding_test.cpp):

    • 28 assertions verifying:
      • Initial state (bound() == false, owner() == target).
      • Null callback handling (returns false, leaves bound() == false).
      • Failed bind retry semantics (retries on failure without latching bound_).
      • Latching on success (bound() == true).
      • Idempotency (subsequent calls return true immediately without re-invoking callback).
      • Null owner pointer handling.
      • Multithreaded race synchronization (16 concurrent threads calling ensure() simultaneously; callback executes exactly once, all threads succeed).
      • Independent instances isolation.

Registers deferred_image_binding_test and CTest in runtime/CMakeLists.txt.

Tested

  • Unit test execution: 28/28 checks passed (0 failures).
  • python -I tests/test_ci_registration.py: 16/16 pass.
  • python -I tests/test_text_write_line_endings.py: 3/3 pass.
  • python -I scripts/check_no_game_data.py: clean (0 violations, no game data).

AI-assisted (Claude Code)

**@⁠abnalstlll-byte** on GitHub · 2026-11-25 19:09 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2057) `abnalstlll-byte:feat/rt-deferred-image-binding-guards-and-tests` → `main` · +151 −1 · 3 files · 1 commits · open Claimed in the coordination issue as: RT-DEFERRED-IMAGE-BINDING-GUARDS-AND-TESTS ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608)) ### What and why `runtime/src/deferred_image_binding.h` synchronizes deferred single-time image memory binding across concurrent calls (e.g. from command replay and descriptor table creation). 1. **Null callback guard**: - `ensure()`: guards against null `bind_` function pointer (`if (!bind_ || !bind_(owner_)) return false;`), returning false safely instead of crashing. 2. **Owner query helper**: - Added `owner()` accessor returning `owner_`. 3. **Unit test suite (`runtime/test/deferred_image_binding_test.cpp`)**: - 28 assertions verifying: - Initial state (`bound() == false`, `owner() == target`). - Null callback handling (returns false, leaves `bound() == false`). - Failed bind retry semantics (retries on failure without latching `bound_`). - Latching on success (`bound() == true`). - Idempotency (subsequent calls return true immediately without re-invoking callback). - Null owner pointer handling. - Multithreaded race synchronization (16 concurrent threads calling `ensure()` simultaneously; callback executes exactly once, all threads succeed). - Independent instances isolation. Registers `deferred_image_binding_test` and CTest in `runtime/CMakeLists.txt`. ### Tested - Unit test execution: `28/28 checks passed` (0 failures). - `python -I tests/test_ci_registration.py`: 16/16 pass. - `python -I tests/test_text_write_line_endings.py`: 3/3 pass. - `python -I scripts/check_no_game_data.py`: clean (0 violations, no game data). AI-assisted (Claude Code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:16:23 +00:00
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/2057/head:github-bot/gh-2057'
git switch 'github-bot/gh-2057'

Merge

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