Entity X has one to many relationship with Entity Y. So in entity Y there is a lookup field new_xId. Users can edit Y record to assign new_xId or add Y from X subgrid.
In this case because field new_xId always get changed, we added a plugin to update message of entity Y. We expected the context depth will be 1 when the association happens.
It is 2.
After alot of head scratching why Plugin Context Depth is 2; we found out that it is only 2 when associating Y records from X subgrid, but it is 1 when editing record Y individually.
Our conclusion is that Associate 1:M event actually fires an update event. Keep this in mind when designing plugin.
Cheers – Sy