Commit Graph

15878 Commits

Author SHA1 Message Date
Peter Eckel 15565a1709 Add the Redis username to the Django default cache settings 2026-08-28 16:18:09 -04:00
Jeremy Stretch 443a22706f Avoid renaming existing schema components
Serializers used only in a nested context have no complete form in the schema, so
prefixing them with "Brief" renamed an existing component to no purpose and dropped
the old name entirely. Exempt serializers declaring an explicit Meta.ref_name from
the prefix, and pin the three affected names.

This narrows the schema diff to the fields the bug actually affected: no components
are removed, and the nine which are added are purely additive.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 15:55:51 -04:00
Jeremy Stretch 9a37694d22 Address review feedback on #22989
* Drop the non-BaseModelSerializer fallback in FixSerializedPKRelatedField.
  SerializedPKRelatedField.to_representation() passes nested unconditionally, so a
  serializer which doesn't accept it raises TypeError on every read; the branch
  documented a component for a configuration the API cannot serve.
* Generate the OpenAPI schema once per class rather than once per test method.
* Exercise the component.ref and request-schema return paths, and use SimpleTestCase
  for the tests which don't touch the database.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 15:36:42 -04:00
Jeremy Stretch 2893928662 Closes #22989: Reference brief components for nested SerializedPKRelatedField
FixSerializedPKRelatedField passed the serializer class to resolve_serializer(),
which instantiates it with no arguments. The field's nested setting was therefore
lost, and the generated response schema referenced the complete component (with
the complete field set) even where the field renders a brief representation.

Resolve an instance carrying the field's nested setting instead. Request schemas
are unaffected and continue to accept integer primary keys.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 15:20:36 -04:00
Martin Hauser 2b54582cd7 fix(api): Discover nested prefetches for SerializedPKRelatedField
Teach _get_nested_serializer() to unwrap ManyRelatedField and resolve the
serializer configured on SerializedPKRelatedField. Preserve the field's
nested value so prefetch discovery follows brief_fields for nested
representations and the full field set otherwise.

Guard the recursion against reference cycles by tracking the serializer
states already being resolved on the current path. Because nested defaults
to False the target expands its full field set, so a self-referential or
mutually referential declaration would otherwise recurse without a
termination condition. The key pairs the serializer class with its
effective field set, since re-entering a serializer at a narrower depth is
finite rather than cyclic, and the states are copied per frame so a sibling
field can still expand what another one stops at.

Populate interface VDC relationships and VRF route target assignments in
the API test fixtures, update the two query count baselines, and add
coverage for direct, many-valued and non-nested serialized related fields
alongside self-referential, mutually referential, brief-depth and
sibling-reuse cases.

Fixes #22988
2026-08-28 13:36:13 -04:00
Martin Hauser ab9bd6f5b6
Closes #23049: Update development database scripts for PostgreSQL 15 and later (#23065)
Fixes #23049
2026-08-28 10:43:52 -05:00
Martin Hauser fe194e7003 fix(ui): Reconcile sidebar state when crossing the responsive breakpoint
SideNav classified the viewport only during construction. Resizing past
the `lg` breakpoint therefore left the desktop sidebar in its previous
mobile state, and the menu group containing the current page remained
collapsed until the pointer entered the sidebar.

Use the existing desktop media query as an event source. Apply the
persisted pin preference directly to the body attributes during
initialization and on each breakpoint transition, then reinitialize the
active menu section.

Avoid calling `pin()` or `unpin()` during responsive transitions so
Bootstrap retains ownership of its collapse state and the stored
preference is not rewritten unnecessarily.

Also remove the `show` class from a menu group toggle when collapsing
its section to keep the toggle and menu state synchronized.

Fixes #23035
2026-08-28 10:12:54 -04:00
Martin Hauser 88f90dc8ca fix(forms): Fix owner field placement in PowerOutlet and Service forms
Move owner field from fieldsets to Meta.fields in PowerOutletForm and
add it to ServiceCreateForm Meta.fields. Ensures owner field appears in
forms and can be properly saved. Adds test coverage with Owner creation.

Fixes #23052
2026-08-28 08:44:02 -04:00
Martin Hauser 6437626d6d fix(ipam): Support multiple values for VLANGroup scope filters
Replace NumberFilter with MultiValueNumberFilter for VLANGroup scope
filters (Region, Site Group, Site, Location, Rack Group, Rack,
Cluster Group, Cluster). Update filter_scope method to use `__in`
lookup and add comprehensive test coverage for multi-value filtering.

Fixes #22671
2026-08-28 08:37:35 -04:00
github-actions dbaafd132f Update source translation strings 2026-08-28 07:31:39 +00:00
bctiemann a8626a517f
Merge pull request #23057 from netbox-community/22991-optimize-modulebaytype-queries
Closes #22991: Omit manufacturer from ModuleBayType representation
2026-08-27 18:14:34 -04:00
bctiemann 50290b53e5
Merge pull request #23051 from netbox-community/23038-fix-signed-S3-URLs
Fixes #23038: Don't append cache-busting parameter to signed static file URLs
2026-08-27 18:12:53 -04:00
Martin Hauser f657bcb78a
Fixes #23043: Correct Front Port position validation for bulk creation (#23055) 2026-08-27 15:36:05 -05:00
Jeremy Stretch 32e383f066 Closes #22991: Omit manufacturer from ModuleBayType representation 2026-08-27 16:07:41 -04:00
Jeremy Stretch 7a030c97c6
Fixes #23042: Submit SSO login requests via POST (#23050)
Render social authentication actions as POST forms to comply with
social-auth-app-django 6.0's POST-only begin view. Pass the `next` and
SAML `idp` parameters as hidden fields so they remain available to
`do_auth()`.

Preserve the post-login URL when the login page is re-rendered after a
failed password attempt, and avoid shadowing the request data while
enumerating SAML identity providers. Extend the tests to validate the
rendered SSO forms and their hidden parameters.
2026-08-27 17:52:08 +02:00
Martin Hauser 1374fde4aa
Closes #23032: Make GraphQL custom field N+1 regression test deterministic (#23034)
Fixes #23032
2026-08-27 10:07:06 -05:00
Jeremy Stretch db859c11b7 Defer debug log formatting in static_with_params()
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 11:01:08 -04:00
Jeremy Stretch f91e0e9fb3 Fixes #23038: Don't append cache-busting parameter to signed static file URLs
Storage backends such as S3 may return presigned URLs whose signature covers
the entire query string. Appending a version parameter to such a URL after it
has been signed invalidates the signature, causing the storage backend to
reject the request with a 403.

Return signed URLs unmodified. These embed an expiration and are regenerated
on each request, so they require no cache-busting parameter.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 10:48:10 -04:00
Jeremy Stretch c1135de8f5
Closes #23044: Add workflow to enforce milestone assignment on issue closure (#23045)
Reopens any issue that is closed as completed without a milestone
assigned, after a short grace period to allow for the milestone being
set immediately after closure.
2026-08-27 15:42:30 +02:00
Jeremy Stretch aa1d49d0f5 Release v4.7.0-beta2 2026-08-26 15:29:15 -04:00
Martin Hauser 743b068343 fix(dcim): Add parent field to InterfaceTemplate import form
Adds parent field to InterfaceTemplateImportForm to support channelized
interface imports. Filters parent queryset by device_type or module_type
during validation to prevent MultipleObjectsReturned errors when
resolving parent interfaces by name.

Fixes #23036
2026-08-26 14:41:22 -04:00
Jeremy Stretch cd87ab3159
Fixes #23010: Defer bulk changes to object data when adding/removing a custom field (#23011) 2026-08-26 10:51:59 -07:00
Martin Hauser 368ad277e5
Closes #22563: Preserve sidebar scroll position across navigation (#22803)
Store the vertical sidebar's scroll position in session storage so it
remains scoped to the current browser tab. Restore it on the next page
and use the browser's native scrolling behavior to reveal the active
item when needed.

When the active dropdown is closed, reveal its top-level heading instead
of the hidden child. Persist only positive offsets from an overflowing
sidebar so a collapsed or non-scrollable layout cannot erase a useful
saved position with zero.
2026-08-26 19:01:07 +02:00
Jeremy Stretch 83ba52521f
Fixes #23027: Pin config Context cache invalidation to the saving connection (#23028)
Propagate the signal-provided database alias through config context
cache invalidation so scope lookups, cache updates, and commit callbacks
use the same connection and transaction as the triggering change.

Watch Cluster scope changes through `_site_id` and add routing coverage
for direct, nested, tagged, reparented, and upstream invalidation paths.
2026-08-26 15:44:07 +02:00
github-actions 5fba79c4ca Update source translation strings 2026-08-26 05:10:03 +00:00
Jeremy Stretch c89a544eac Merge branch 'main' into feature 2026-08-25 12:34:17 -04:00
Jeremy Stretch f8b00e9aae Release v4.6.9 2026-08-25 11:02:20 -04:00
Martin Hauser 1077ff4a33 fix(forms): Correct nullable_fields in bulk edit forms
`nullable_fields` only marks declared form fields as clearable.
Several bulk edit forms referenced missing, stale, duplicate, or
non-model fields. This left intended fields unavailable, rendered
ineffective Set Null controls, and could trigger a server error for
Contact bulk edits.

Declare the intended fields, correct the PowerFeed and DataSource
entries, and remove invalid Contact group fields. Align owner and
comments nullification on forms that do not inherit the common
bulk-edit fields, and prevent DataSource comments from rendering twice.

Add regression coverage to keep nullable declarations aligned with
their form and model fields.

Fixes #22990
2026-08-25 09:06:31 -04:00
Jeremy Stretch eab6b42659
Fixes #23000: Prefetch Cable Terminations in the GraphQL API (#23021)
CableType.a_terminations and b_terminations were declared as bare
annotations, so strawberry-django resolved them by reading the model
properties with no prefetch hint. That left two nested N+1s (one query
per Cable for terminations, one per CableTermination for the termination
GFK) plus the termination's own device FK chain, for roughly six queries
per termination.

Resolve both fields via resolvers carrying a Prefetch of the
terminations for that cable end, with the termination GFK prefetched
through the existing build_gfk_prefetch() helper so the nested joins are
derived from the client's selection set rather than hard-coded.

Each end is prefetched under its own to_attr: two prefetches of the same
relation cannot be merged by the query optimizer, so a shared lookup
would break any query selecting both ends.
2026-08-25 09:27:14 +02:00
github-actions 194f3bbde2 Update source translation strings 2026-08-25 05:09:57 +00:00
bctiemann b7e02fe098
Merge pull request #23020 from netbox-community/23007-sidenav-javascript-uses-a-different-breakpoint-from-the
Closes #23007: Align sidebar initialization with the responsive layout breakpoint
2026-08-24 17:51:44 -04:00
Martin Hauser 105e58a433
refactor(ui): Use matchMedia for desktop breakpoint detection
Replace hardcoded width check with Bootstrap's lg breakpoint (992px)
using matchMedia API. Adds constant with comment linking to navbar
configuration for maintainability.
2026-08-24 22:12:54 +02:00
bctiemann b08799860f
Merge pull request #23017 from netbox-community/22978-event-leakage-on-rollback
Fixes #22978: Discard queued events when a REST API write is rolled back
2026-08-24 16:00:23 -04:00
piyush-003 a0c695f57d
Closes #22660: Add support for HPE Synergy's proprietary 300Gb QSFP-DD interface type 2026-08-24 15:58:42 -04:00
Martin Hauser 9d4440beba refactor(ui): Remove unused Bootstrap Collapse from sidebar navigation
Remove Bootstrap Collapse instances and section link handling logic that
is no longer needed. Simplifies sidebar navigation by removing manual
collapse management and related event handlers.

Fixes #22931
2026-08-24 12:55:44 -04:00
Jeremy Stretch 79f940f362 Fixes #22978: Discard queued events when a REST API write is rolled back
The REST API's write paths are transactional, but the in-memory events queue
is not: change logging receivers queue events eagerly (for deletions in
pre_delete, before the row is removed), and event_tracking() flushes that queue
only after the response has been rendered. Where a rolled-back write is caught
and converted into a normal response — the ProtectedError/RestrictedError and
AbortRequest handlers in NetBoxModelViewSet.dispatch(), and the
ObjectDoesNotExist to PermissionDenied conversions in the perform_*() methods —
the flush therefore dispatched events for objects that were never created,
updated, or deleted.

Backport discard_events_on_rollback() from the feature branch and enter it
inside the transaction guarding each API write: perform_create(),
perform_update(), and perform_destroy(); the SequentialBulkCreatesMixin,
BulkUpdateModelMixin, and BulkDestroyModelMixin bulk actions; and
AvailableObjectsView.post(). The context manager sends clear_events on the way
out whenever the wrapped transaction is rolled back, whether by an exception
escaping the block or by an explicit set_rollback(), which also covers the
exceptions that reach dispatch(). This mirrors what the UI views now do (#22934).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-24 12:41:32 -04:00
Martin Hauser 4107109472
fix(models): Remove inert clone_fields from non-CloningMixin models (#23003)
Removes clone_fields declarations from ContactAssignment,
ImageAttachment, and FHRPGroupAssignment models that don't inherit
CloningMixin.
Adds test coverage to prevent clone_fields on models without cloning
support.

Fixes #22987
2026-08-24 08:46:05 -07:00
Jossel1n M0uette fd15a687f6
Closes #21387: Add InfiniBand 4X interface types (#23016)
Add 4X interface choices for all supported InfiniBand generations and
include the lane width in each display label. Correct the existing XDR
1X rate from 250 Gbps to 200 Gbps.
2026-08-24 17:45:34 +02:00
Jeremy Stretch 05e35e9264
Fixes #23013: Avoid denormalization refreshes for location assignment when not needed (#23014)
Skip descendant and component denormalization updates when a Location,
Rack, or Device is saved without changing its scope assignments. Handle
partial saves safely to avoid propagating stale in-memory values.
2026-08-24 17:30:37 +02:00
github-actions 43fe81f9e8 Update source translation strings 2026-08-22 05:06:32 +00:00
bctiemann 23e2c881b1
Merge pull request #23004 from netbox-community/22998-add-100gbase-x-sfp112-interface-type
Closes #22998: Add SFP112 (100GE) interface type
2026-08-21 10:24:52 -04:00
github-actions 1c84d6d8f4 Update source translation strings 2026-08-21 05:21:48 +00:00
Martin Hauser 044a627c3a
feat(dcim): Add SFP112 interface type for 100GE connections
Introduces 100GBASE-X-SFP112 interface type to support SFP112 form
factor transceiver modules. Adds new choice constant and display label
in alphabetical order within 100GE interface types section.

Fixes #22998
2026-08-20 22:22:40 +02:00
Jeremy Stretch e49e6afbbe
Fixes #22985: Exempt data file content from cache (#22986) 2026-08-20 21:14:53 +02:00
Martin Hauser b6cc7d811f fix(ui): Simplify sidebar initialization logic
Replace redundant conditional blocks with single if-else statement and
move resize listener outside viewport check. Changes width threshold
from `>` to `>=` for consistency with standard breakpoint behavior.

Fixes #22930
2026-08-20 14:41:54 -04:00
bctiemann 58ac88bc51
Merge pull request #22974 from netbox-community/22934-fix-event-queue-leaks
Fixes #22934: Clear queued events when a UI view rolls back a write
2026-08-20 13:32:27 -04:00
bctiemann 24b700336e
Merge pull request #22969 from netbox-community/22925-make-moduletypetestcase-independent-of-migration-seeded-data
Closes #22925: Make ModuleTypeTestCase independent of migration-seeded data
2026-08-20 13:14:41 -04:00
bctiemann 86c7a896a1
Merge pull request #22958 from netbox-community/22956-add-dedicated-tests-for-nestedobjectattr
Closes #22956: Add test coverage for NestedObjectAttr
2026-08-20 13:13:39 -04:00
Arthur Hanson d7f79bd501
Closes #22972: Restore tag deserialization compatibility with Django 6.1 (#22979)
Add set_base() support to CustomTaggableManager so Django's
deserializer can restore tag relationships through django-taggit.
Normalize primary-key values before delegating to taggit and add
regression coverage for object- and PK-based inputs.
2026-08-20 14:51:30 +02:00
Martin Hauser 875e7d0885
fix(api): Allow Module Bay Types to be written via the REST API (#22984)
Declare module_bay_types as a SerializedPKRelatedField on the Module
Bay, Module Bay Template, and Module Type serializers. This accepts
primary keys on write while preserving the nested representation on
read and avoids DRF's writable-nested assertion.

Because automatic serializer prefetch discovery no longer recurses into
this field, add manufacturer prefetches to the corresponding viewsets.
Populate the API test fixtures with Module Bay Types so the existing
list query-count tests cover the relationship and guard against N+1
queries.

Fixes #22982
2026-08-19 13:35:01 -07:00