[PR #20478] [MERGED] Fixes #20471: Update NumericRange handling to use half-open intervals #15936

Closed
opened 2025-12-30 00:24:54 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20478
Author: @pheus
Created: 10/2/2025
Status: Merged
Merged: 10/7/2025
Merged by: @arthanson

Base: mainHead: 20471-update-numericrange-handling-using-half-open-intervals


📝 Commits (1)

  • 3a755ee fix(api): Update NumericRange handling to use half-open intervals

📊 Changes

3 files changed (+18 additions, -11 deletions)

View changed files

📝 netbox/netbox/api/fields.py (+1 -1)
📝 netbox/utilities/data.py (+11 -4)
📝 netbox/utilities/tests/test_data.py (+6 -6)

📄 Description

Fixes: #20471

Summary

Normalize integer range handling to use half‑open intervals [lower, upper) across the app. Inclusive inputs are still accepted (forms/CSV/API) but are converted to a canonical half‑open form on save and serialization. This yields stable pre/post snapshots and prevents spurious change log entries when saving an unchanged VLANGroup.

Changes

  • Canonicalize all NumericRange values for VLANGroup.vid_ranges to [lo, hi) in forms, serializers, and utilities.
  • Ensure change‑logging compares normalized values to avoid no‑op diffs.
  • Update tests for round‑trip stability and “no new changelog on no‑op save.”

Notes

  • No database schema changes.
  • Backward‑compatible: existing data remains valid; user‑facing behavior is unchanged.

🔄 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/netbox-community/netbox/pull/20478 **Author:** [@pheus](https://github.com/pheus) **Created:** 10/2/2025 **Status:** ✅ Merged **Merged:** 10/7/2025 **Merged by:** [@arthanson](https://github.com/arthanson) **Base:** `main` ← **Head:** `20471-update-numericrange-handling-using-half-open-intervals` --- ### 📝 Commits (1) - [`3a755ee`](https://github.com/netbox-community/netbox/commit/3a755eead14ee0bbd058344b78c652d919152857) fix(api): Update NumericRange handling to use half-open intervals ### 📊 Changes **3 files changed** (+18 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `netbox/netbox/api/fields.py` (+1 -1) 📝 `netbox/utilities/data.py` (+11 -4) 📝 `netbox/utilities/tests/test_data.py` (+6 -6) </details> ### 📄 Description <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be approved and assigned prior to opening a pull request. This helps avoid waste time and effort on a proposed change that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WILL BE CLOSED AUTOMATICALLY. Please specify your assigned issue number on the line below. --> ### Fixes: #20471 <!-- Please include a summary of the proposed changes below. --> **Summary** Normalize integer range handling to use half‑open intervals `[lower, upper)` across the app. Inclusive inputs are still accepted (forms/CSV/API) but are converted to a canonical half‑open form on save and serialization. This yields stable pre/post snapshots and prevents spurious change log entries when saving an unchanged `VLANGroup`. **Changes** - Canonicalize all `NumericRange` values for `VLANGroup.vid_ranges` to `[lo, hi)` in forms, serializers, and utilities. - Ensure change‑logging compares normalized values to avoid no‑op diffs. - Update tests for round‑trip stability and “no new changelog on no‑op save.” **Notes** - No database schema changes. - Backward‑compatible: existing data remains valid; user‑facing behavior is unchanged. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:24:54 +01:00
adam closed this issue 2025-12-30 00:24:54 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15936