split out safe spool filepath generation and add tests