Does Ruined Rex's Deathknell deal damage before or after units are healed at the end of combat?
Ruined Rex's [Deathknell] deals damage after the surviving units are healed. The combat cleanup adds the ability as a pending item.808.1.d.2 That cleanup heals all surviving units before the pending ability can begin finalization.468.1.a.1320334.2
If a legal enemy unit is available, the trigger's controller must choose one as its target during finalization.355.10403.2403.4.b Once no pending items remain, the controller of the next item receives priority before the trigger resolves.337.4 It deals 4 damage to the chosen enemy unit.