ObjectChange incorrect ordering for GenericRelation references #11273

Closed
opened 2025-12-29 21:42:44 +01:00 by adam · 0 comments
Owner

Originally created by @arthanson on GitHub (Jun 7, 2025).

Originally assigned to: @arthanson on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.3.2

Python Version

3.12

Steps to Reproduce

  1. Create a device with an interface and connect a cable to it to another interface (you can use the imports below)
  2. delete the device
  3. Check the ChangeLog for the ordering of the Change Logs
Create Device Role "test":
name,slug,color
"test","test",888888

Create Manufacturer "test":
name,slug
"test","test"

Create Device Type "test":
manufacturer,model,slug,u_height
"test","test","test",1.0

Create Site "test":
name,slug,status
"test","test",active

Create Device "test" and "test2":
role,manufacturer,device_type,status,site,name
"test","test","test",active,"test","test"
"test","test","test",active,"test","test2"

Create Interfaces on the 2 test devices:
device,name,type
test,1,1000base-tx
test2,1,1000base-tx

Create Cable:
side_a_device,side_a_type,side_a_name,side_b_device,side_b_type,side_b_name,label
test,dcim.interface,1,test2,dcim.interface,1,"test:1,test2:1"

Expected Behavior

The changelog for this deletion (by date-time) should be:
Device
Interface
CableTermination

This is because of the dependency chain: the CableTermination relies on the Interface and the Interface relies on the Device. This is required when playing back the ChangeLog to reconstruct data, otherwise the CableTermination will get created before the Interface and fail.

Observed Behavior

You will see the order (by date-time) of the ChangeLog records will be:
Device
CableTermination
Interface
Image

Originally created by @arthanson on GitHub (Jun 7, 2025). Originally assigned to: @arthanson on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.3.2 ### Python Version 3.12 ### Steps to Reproduce 1. Create a device with an interface and connect a cable to it to another interface (you can use the imports below) 2. delete the device 3. Check the ChangeLog for the ordering of the Change Logs ``` Create Device Role "test": name,slug,color "test","test",888888 Create Manufacturer "test": name,slug "test","test" Create Device Type "test": manufacturer,model,slug,u_height "test","test","test",1.0 Create Site "test": name,slug,status "test","test",active Create Device "test" and "test2": role,manufacturer,device_type,status,site,name "test","test","test",active,"test","test" "test","test","test",active,"test","test2" Create Interfaces on the 2 test devices: device,name,type test,1,1000base-tx test2,1,1000base-tx Create Cable: side_a_device,side_a_type,side_a_name,side_b_device,side_b_type,side_b_name,label test,dcim.interface,1,test2,dcim.interface,1,"test:1,test2:1" ``` ### Expected Behavior The changelog for this deletion (by date-time) should be: Device Interface CableTermination This is because of the dependency chain: the CableTermination relies on the Interface and the Interface relies on the Device. This is required when playing back the ChangeLog to reconstruct data, otherwise the CableTermination will get created before the Interface and fail. ### Observed Behavior You will see the order (by date-time) of the ChangeLog records will be: Device CableTermination Interface ![Image](https://github.com/user-attachments/assets/d219c7e1-9361-4832-abde-de423e2ec596)
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:42:44 +01:00
adam closed this issue 2025-12-29 21:42:45 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11273