What each change does
Size means remaining size. An order for 10 that has filled 4 has 6 left: changing it to 5 is a decrease, and changing it to 8 is an increase.
The new order keeps everything else from the original, including its time in force. A smaller size must still meet the market’s minimum order size, or the modify is rejected and the order is left as it was.
When the new order fails
Cancel and re-place happen in order, in one transaction. The new order is placed only if the cancel succeeded, so you never end up with both. But the new order can still fail, most often on margin, and then you have neither. A maker-only modify (replaceMakerOnly) whose new price would cross the book ends the same way.
Timing
A modify is ordered within its block like any other transaction. See Transaction sequencing. In the SDKs a modify isDexReplaceOrder. It targets the order by its order ID or its client order ID. To change a take-profit or stop-loss, see Take-profit and stop-loss.