Fixes #20471: Update NumericRange handling to use half-open intervals #1150

Closed
opened 2026-04-05 21:09:41 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @pheus on 10/2/2025

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.
*Originally created by @pheus on 10/2/2025* <!-- 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.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#1150