In SortArchetypeNodeBase::resizeTable, the numDynamicInvocations was previously being set to the numRows in the talble pre-resize, which could cause overflow if the table had shrunk.
The implementation pattern of StateManager::iterateQuery closes matches that of StateManager::iterateArchetypesRaw. The difference is that iterateArchetypes raw does not consider a world ID. I decided to keep them separate for now, but we may want to merge them to simplify the code.
Two specific things to highlight: