Background: I've been building a Lead round robin system to evenly distribute work. It checks for records owned by queues, and assigns them to the next user available in each queue. I opted to do a lot of work before insert, so that I could shuffle records around without extra DML.
However, I (incorrectly) assumed that Lead Assignment Rules happened much earlier in the order of execution, so none of my before insert code is finding any records in a queue. I didn't realize at first, because I had similar code in the before update logic which was catching the records that I thought were being handled before insert, so things appeared to be working in tests, until I started building my assertions.
This got me thinking of the following question:
Considering the Order of Execution (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm), Before and After triggers all run PRIOR to Assignment Rules. Workflows and Process Builders also run after the before triggers. Since Assignment Rules count as a workflow field update, before update and after update triggers run one more time after the record has been assigned to the queue, which is when my code actually picks them up and runs it through round robin.
When a user creates a record themselves, they own it by default. Even if they check the box to run active assignment rules, it follows the same order. It will always run before triggers prior to any other updates that would change the ownership to a queue.
So, assuming SF doesn't change this order - Is it safe to say that it is 100% impossible for a record inserted manually through the Salesforce UI (specifically) to ever be owned by a queue BEFORE INSERT?