descriptor_range_changes: merge adjacent inclusive ranges, skip inverted ranges, and add unit test #2288

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

@⁠narekshaghoyandev on GitHub · 2026-11-26 12:48 UTC · original
narekshaghoyandev:ubiq-desc-range-merge-adjacent → main · +97 −1 · 3 files · 1 commits · open

Summary

  • Coalesce adjacent inclusive ranges ([0, 9] + [10, 19] -> [0, 19]) in DescriptorRanges::merge() (runtime/src/descriptor_range_changes.h), guarding against UINT64_MAX + 1 overflow.
  • Skip inverted ranges (first > last) in DescriptorRanges::merge() so ranges preserves the monotonic last invariant required by std::lower_bound in overlaps().
  • Add standalone C++20 unit test runtime/test/descriptor_range_changes_test.cpp (no GPU, no game data) and register it in runtime/CMakeLists.txt.

Verification

  • g++ -std=c++20 -D_GLIBCXX_DEBUG -Wall -Wextra -Werror -pedantic -O1 -g runtime/test/descriptor_range_changes_test.cpp — descriptor_range_changes_test: OK.
  • g++ -std=c++20 -Wall -Wextra -Werror -pedantic -fsanitize=address,undefined -O1 -g runtime/test/descriptor_range_changes_test.cpp — descriptor_range_changes_test: OK.
  • g++ -std=c++20 -Wall -Wextra -Werror -pedantic -O1 -g runtime/test/title_va_alias_test.cpp — pass.
  • Negative control against main: 7 checks fail before the patch and all pass after.
  • python3 -I scripts/check_no_game_data.py runtime/src/descriptor_range_changes.h runtime/test/descriptor_range_changes_test.cpp runtime/CMakeLists.txt — clean.

Claimed in the coordination issue as: RT-DESC-RANGE-MERGE-ADJACENT (#1608)
AI-assisted: yes (Gemini)

**@⁠narekshaghoyandev** on GitHub · 2026-11-26 12:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2288) `narekshaghoyandev:ubiq-desc-range-merge-adjacent` → `main` · +97 −1 · 3 files · 1 commits · open ## Summary - Coalesce adjacent inclusive ranges (`[0, 9]` + `[10, 19]` -> `[0, 19]`) in `DescriptorRanges::merge()` (`runtime/src/descriptor_range_changes.h`), guarding against `UINT64_MAX + 1` overflow. - Skip inverted ranges (`first > last`) in `DescriptorRanges::merge()` so `ranges` preserves the monotonic `last` invariant required by `std::lower_bound` in `overlaps()`. - Add standalone C++20 unit test `runtime/test/descriptor_range_changes_test.cpp` (no GPU, no game data) and register it in `runtime/CMakeLists.txt`. ## Verification - `g++ -std=c++20 -D_GLIBCXX_DEBUG -Wall -Wextra -Werror -pedantic -O1 -g runtime/test/descriptor_range_changes_test.cpp` — `descriptor_range_changes_test: OK`. - `g++ -std=c++20 -Wall -Wextra -Werror -pedantic -fsanitize=address,undefined -O1 -g runtime/test/descriptor_range_changes_test.cpp` — `descriptor_range_changes_test: OK`. - `g++ -std=c++20 -Wall -Wextra -Werror -pedantic -O1 -g runtime/test/title_va_alias_test.cpp` — pass. - Negative control against `main`: 7 checks fail before the patch and all pass after. - `python3 -I scripts/check_no_game_data.py runtime/src/descriptor_range_changes.h runtime/test/descriptor_range_changes_test.cpp runtime/CMakeLists.txt` — clean. Claimed in the coordination issue as: RT-DESC-RANGE-MERGE-ADJACENT (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) AI-assisted: yes (Gemini)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 12:52:25 +00:00
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-26 16:31 UTC · original · approved these changes

Reviewed by Claude Code (AI-assisted) on my behalf. Approving.

  • The merge condition last == UINT64_MAX || r.first <= last + 1 joins adjacent inclusive ranges without
    overflowing at the top of the address space. Skipping first > last is harmless: record() never makes one.
  • overlaps() answers the same as before for every range, because merging only changes how the ranges are split.
  • Checked: descriptor_range_changes_test passes with -fsanitize=address,undefined (g++ 13, Linux). Built against
    main's header, it fails (lines 29-30, adjacent ranges not merged), so the test covers the change.

Generated by Claude Code

**@⁠kawaii-shakal** on GitHub · 2026-11-26 16:31 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2288#pullrequestreview-6077592927) · **approved these changes** Reviewed by Claude Code (AI-assisted) on my behalf. Approving. - The merge condition `last == UINT64_MAX || r.first <= last + 1` joins adjacent inclusive ranges without overflowing at the top of the address space. Skipping `first > last` is harmless: `record()` never makes one. - `overlaps()` answers the same as before for every range, because merging only changes how the ranges are split. - Checked: `descriptor_range_changes_test` passes with `-fsanitize=address,undefined` (g++ 13, Linux). Built against main's header, it fails (lines 29-30, adjacent ranges not merged), so the test covers the change. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • runtime/src/descriptor_range_changes.h
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2288/head:github-bot/gh-2288'
git switch 'github-bot/gh-2288'

Merge

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