We should ensure that STATE_DIR is actually set. Some systems may treat a blank as valid, then the next command will attempt to wipe the root.
I agree but I'm not sure how to address this. STATE_DIR is a constant pathlib.Path object and is not possible for the object to be 'unset' (by default Path() evaluates to the current working directory). Although we are thinking of making these constants configurable in the future (see https://github.com/CABLE-LSM/benchcab/issues/151) which would require addressing this issue. The underlying issue might be due to the approach we are taking when doing clean up. A safer way could be to archive run directories instead of deleting them recursively, and have an explicit command to do the deletion of the archive directory. This is similar to how payu sweep works. This way the deletion would not depend on a variable which could be misconfigured.
_Originally posted by @SeanBryan51 in https://github.com/CABLE-LSM/benchcab/pull/291#discussion_r1599373199_