Unexpected setNodeMarkup / setNodeAttribute difference

I figure these two should be the same:

tr.setNodeMarkup(pos, undefined, {...tr.doc.nodeAt(pos).attrs, [name]: value})
tr.setNodeAttribute(pos, name, value)

But the second one is causing a test failure. What’s the difference?

I’ve tried outputting the attrs after the line in question to debug, and the same JSON is output either way.

setNodeMarkup replaces the node’s opening token, whereas setNodeAttribute has an empty step map. Position mapping will be different for them.