[PR #2288] descriptor_range_changes: merge adjacent inclusive ranges, skip inverted ranges, and add unit test #2291

Open
opened 2026-11-26 21:20:42 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2288
Author: @narekshaghoyandev
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: ubiq-desc-range-merge-adjacent


📝 Commits (1)

  • 7796b0f descriptor_range_changes: merge adjacent inclusive ranges, skip inverted ranges, and add unit test

📊 Changes

3 files changed (+97 additions, -1 deletions)

View changed files

📝 runtime/CMakeLists.txt (+5 -0)
📝 runtime/src/descriptor_range_changes.h (+2 -1)
➕ runtime/test/descriptor_range_changes_test.cpp (+90 -0)

📄 Description

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://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7192440165)
AI-assisted: yes (Gemini)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2288 **Author:** [@narekshaghoyandev](https://github.com/narekshaghoyandev) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `ubiq-desc-range-merge-adjacent` --- ### 📝 Commits (1) - [`7796b0f`](https://github.com/ubiquitarianism/leonida/commit/7796b0f32f53eb7e34aa8aac831eb1b61d434762) descriptor_range_changes: merge adjacent inclusive ranges, skip inverted ranges, and add unit test ### 📊 Changes **3 files changed** (+97 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `runtime/CMakeLists.txt` (+5 -0) 📝 `runtime/src/descriptor_range_changes.h` (+2 -1) ➕ `runtime/test/descriptor_range_changes_test.cpp` (+90 -0) </details> ### 📄 Description ## 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://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7192440165) AI-assisted: yes (Gemini) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#2291
No description provided.