After extensive refactoring, that chunk of code is now only 5.5 pages long instead of 11 😅
Still about 4 pages too long compared to what an ideal function would be but this is the main ActivityPub handling code we're dealing with here, so it's always going to be a little crazy.