sort_and_finalize_staged_data lost some tests in the transition to open-source, and so when it was broken by a processing pipeline factor this was not recognised. This PR fixes it and adds some elementary tests to check that it's doing what it's supposed to
sort_and_finalize_staged_data lost some tests in the transition to open-source, and so when it was broken by a processing pipeline factor this was not recognised. This PR fixes it and adds some elementary tests to check that it's doing what it's supposed to