Conversation
|
@claude /review Only report on issues of potential concern; we don't need commentary on anything that doesn't require further consideration. |
|
Claude finished @pheus's task in 2m 17s —— View job Code Review
Issues of Concern1.
There's no explanation in the PR for why this skip condition was introduced. If the test was legitimately failing due to a missing dependency, that should be addressed directly. As written, this disables a test that was working before and provides no coverage for the webhook dispatch path in standard environments. Fix this → 2. Potential unhandled
except ObjectDoesNotExist:
self.refresh_from_db(fields=['_path'])
return self._path if self._path_id else NoneAfter 3.
Overall the core logic — routing through |
|
Thanks for the review. 1. 2. Unhandled 3. Docstring: Fair nit. The inline comment explaining why |
arthanson
left a comment
There was a problem hiding this comment.
great work @pheus just some minor comments, - can we not reformat the comments for just line length changes unless there is a specific reason? quite a few of the changes are just reformatting comments without any wording changes.
| deleted, refresh only the `_path` field from the database and retry. | ||
| This keeps the fix cheap and narrowly scoped to the denormalized FK. | ||
| """ | ||
| if self._path_id is None: |
There was a problem hiding this comment.
I don't think this check is needed, the try below should return None if _path_id is None
There was a problem hiding this comment.
For PathEndpoint.path, I’d like to keep the early _path_id is None branch as a small fast-path/readability check, but I agree the important part is the second guarded lookup after refresh_from_db().
5384ef2 to
a398601
Compare
Cable edits can delete and recreate CablePath rows while endpoint instances remain in memory. Deferred event serialization can then encounter a stale `_path` reference and raise `CablePath.DoesNotExist`. Refresh stale `_path` references through `PathEndpoint.path` and route internal callers through that accessor. Update `EventContext` to track the latest serialization source for coalesced duplicate enqueues, while eagerly freezing delete-event payloads before row removal. Also avoid mutating `event_rule.action_data` when merging the event payload. Fixes #21498
a398601 to
9440c21
Compare
Fixes: #21498
This PR fixes a regression in deferred event serialization during cable edits.
When a cable termination is changed,
CablePathrows can be deleted and recreated while endpoint instances are still in memory. If an event rule is active, the deferred serialization introduced in v4.5.2 can then hit a stale_pathreference and raiseCablePath.DoesNotExist.The DCIM-side fix makes
PathEndpoint.pathrecover from a stale_pathreference with a narrow refresh of that field, and routes the remaining internal callers throughpathinstead of accessing_pathdirectly. This prevents the crash and keeps the fix scoped to the denormalized relation involved in path rebuilds.This PR also includes the
EventContextchanges intentionally. While thePathEndpointfix prevents the exception, it does not by itself address stale event payloads when the same object is enqueued multiple times within one request.EventContextnow tracks the latest serialization source for coalesced duplicate enqueues, so deferred serialization uses the most recent queued instance while keeping the publicobjectentry unchanged. Delete events are still serialized eagerly before the row becomes unavailable.Finally,
process_event_rules()now avoids mutatingevent_rule.action_datain place when merging event payload data.Together, these changes fix the traceback from #21498, preserve the deferred-serialization optimization, and ensure event consumers receive the final queued state for coalesced updates.