pub fn verify_batch_order(
slots: &[usize],
ks: &[usize],
canonical: bool,
) -> (Vec<usize>, Vec<usize>)Expand description
Order one verify batch AND assign its depths — the planner’s entry point
(mtp_dcut::plan), the one place a sequence’s verify depth is decided.
Returns (order, depths) where order is verify_batch_permutation
and depths[p] is the row count position p verifies.
canonical = true— the depth MULTISET is re-paired onto the ordered batch, deepest onto the lowest slot.depths[p]is therefore NOT generallyks[order[p]]; the multiset is preserved exactly, only the pairing is re-made. Both dispatch invariants then hold by construction: slots non-decreasing inp(the SSM consecutive-slot precondition) and depths non-increasing inp(the contiguous depth-run precondition).canonical = false— each member keeps its own depth.
Because a caller must TRUNCATE each sequence’s drafts to the depth it was
assigned, this must be called exactly once per batch; downstream stages
that only need the batch in dispatch order use
verify_batch_permutation, which cannot disturb an assignment.