Based on what I read here, if your application is stuck in security clearance mandamus is not going to help with anything. That is because it is in the hands of 3rd parties. It will only be useful if the application is being stuck because of IRCC itself. Again, don't quote me on this. But I have read this in a few places on this forum!
To be honest, it's more complicated than that.
IRCC can't play the "3rd party card" indefinitely as you'd see here :
https://www.canlii.org/en/ca/fct/doc/2005/2005fc803/2005fc803.html
It's a high bar to clear. In the above, IRCC screwed up with additional delays after a first security screening was completed, for an applicant separated from his family and who couldn't mourn his kid who died years ago while waiting for a PR application to be processed for more than 4 years. But after all, it also says that officially, people stuck in security check can seek mandamus relief. The issue is whether they'll need to go through the whole process (and not simply a letter of demand after which IRCC will just be like yeah let's finalize this like they'd do for an application that's just gathering dust because the language proof wasn't checked), whether the relief will actually be granted based on the prejudice the person is facing, which isn't necessarily a guarantee, and whether the relief, if it was to be granted, would be done fast enough to justify the whole process and money VS just waiting another year (say) for the screening to be complete.