Expand description
Shared utilities for creating isolated project workspaces.
Used by both mutation testing and brutalization to copy a project to a temporary directory for safe source-level modifications.
Constantsยง
- MAX_
SYMLINK_ ๐DEPTH - Maximum recursion depth for nested lib symlinks to prevent infinite loops.
Functionsยง
- copy_
dir_ recursive - Recursively copy a directory, skipping symlinked directories for safety.
- copy_
extra_ ๐project_ path - copy_
project - Copy essential project files to a temp workspace.
- ensure_
safe_ relative_ path - Validates that
relis a safe relative path. Returns an error mentioninglabelandorigif the path contains.., is absolute, or otherwise escapes the project root. - ensure_
within_ ๐root - Verify that
candidateresolves (after following symlinks) to a path that lives insideallowed_root. Protects againstsrc/test/lib/etc. being symlinks that escape the project root. - handled_
project_ ๐roots - is_
covered_ ๐by_ handled_ root - is_
safe_ relative_ path - Check if a path is safe for use as a relative path within a workspace. Rejects absolute paths, parent directory components (..), and other unsafe patterns.
- process_
nested_ ๐lib_ dir - push_
handled_ ๐project_ root - relative_
to_ root - Compute relative path of
pathunderroot, or return the path unchanged if not under root. - symlink_
dir - Create a symlink to a directory (cross-platform).
- symlink_
nested_ ๐libs - Recursively symlink nested lib directories within a library.