refactor: push zero-length normalization into nixlSecDescList (#1752)
## What? This PR moves the zero-length normalization logic for file-like segments (`FILE_SEG`, `BLK_SEG`, `OBJ_SEG`) one layer deeper into `nixlSecDescList`, as suggested in #1551. ## Why? This is a follow-up refactor to #1551. In that PR the normalization was applied at the call sites (`addDescList` for writes, `getIndex` for queries). The [comments](https://github.com/ai-dynamo/nixl/pull/1551#discussion_r3148738185) suggested that this invariant should be kept by `nixlSecDescList` itself, and it would be fail-safe to not assume that the input is already given normalized. ## How? - **Write path**: `addDesc()` copies the input, normalizes it if the list type is unbounded, then inserts. `addDescs()` applies `normalizeBatch()` on the whole vector before sorting and merging. - **Query path**: `getIndex()` still normalizes the query via `normalizeQuery()`, because externally-provided queries cannot be assumed to be pre-normalized. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Centralized section descriptor normalization inside the section-descriptor list to ensure consistent handling when adding and querying descriptors. * **Bug Fixes** * Improved matching behavior for lookups by aligning how queries are normalized with how stored descriptors are ordered. * Adjusted behavior so only designated segment types treat `len=0` as unbounded (normalized to max length), while others preserve `len=0`. * **Tests** * Added unit tests covering zero-length descriptor handling across segment types and add/move/query scenarios. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Ilia Yastrebov <iyastrebov@nvidia.com>
B
bin.pan committed
b7c63b038b3ec130d4e6562bdebd26080742cdae
Parent: 6ad0cea
Committed by GitHub <noreply@github.com>
on 7/30/2026, 3:02:29 PM