If orphan detection is enabled on a heading (section title or discrete heading), that operation can leave the document in a modified state. This bug can be observed if there's a footnote in the section. The footnote gets duplicated and the backlinks to and from it break.
To avoid this problem, the scratch document needs to be pushed onto the stack when entering the dry run block and popped when exiting it.
If orphan detection is enabled on a heading (section title or discrete heading), that operation can leave the document in a modified state. This bug can be observed if there's a footnote in the section. The footnote gets duplicated and the backlinks to and from it break.
To avoid this problem, the scratch document needs to be pushed onto the stack when entering the dry run block and popped when exiting it.