[backend] Support more branch_types

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Proposal

Follows up on the discussion in #504143 (comment 2296157328):

I also think we should make PolicyBranchesService deterministic so that the returned branches have a stable order, so that we can scan the same 5 branches every time. I've created a follow-up for doing so, in the scope of this Issue, I'll just cap the branches returned by PolicyBranchesService to N.

Edited by 🤖 GitLab Bot 🤖