Skip to main content

Module workspace

Module workspace 

Source
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 rel is a safe relative path. Returns an error mentioning label and orig if the path contains .., is absolute, or otherwise escapes the project root.
ensure_within_root ๐Ÿ”’
Verify that candidate resolves (after following symlinks) to a path that lives inside allowed_root. Protects against src/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 path under root, 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.