add rebuild function to cases + simple tests

this is just laying some groundwork for a larger cleanup script, but should be simple to review and have no major consequences if we want to make future PRs easier to read