When fulfilling a role request with a named resource using the replace allocation functionality, the resource is added to the project and the entire allocation transfers over from the role as expected. However, the role remains on the team with zero allocation.
This same behavior is seen in both the Classic and New UI.
This behavior is due to the 'Reassign Tasks when Replacing a Role' setting. This setting is a global setting and can be found under Administration - Project Management - Settings.
When this setting is unchecked, the role will remain on the project team just in case there are assignment records associated to this role. The system does not check whether there are assignments associated or not.
Checking this box will allow the role to be removed from the project team when doing the role replace. This is assuming the role has no allocation hours remaining. Additionally, if the role does have tasks assignments on this project, the assignments will be replaced by the resource as well.
KB000008639: After replacing a Resource with a Role, the Role still has allocation on a project