Humm, not sure. Feels like the order of the operations doesn’t matter. You can do in two rounds.
You can also try.
upsert {
query {
v as q(func: eq(username, "NAME"))
}
mutation {
delete {
uid(v) <uidList> * .
}
}
mutation {
set {
uid(v) <uidList> <0x5> .
uid(v) <uidList> <0x6> .
uid(v) <uidList> <0x7> .
uid(v) <uidList> <0x8> .
}
}
}