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, following symlinked directories only within the allowed root.
copy_dir_recursive_inner ๐Ÿ”’
copy_extra_project_path ๐Ÿ”’
copy_project
Copy essential project files to a temp workspace.
copy_project_dir_recursive ๐Ÿ”’
copy_project_local_optional_path ๐Ÿ”’
copy_project_local_permission_path ๐Ÿ”’
create_project_local_permission_dir ๐Ÿ”’
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_covered_by_symlinked_project_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.
isolated_mutable_path_rel ๐Ÿ”’
normalize_existing_ancestor ๐Ÿ”’
normalize_path ๐Ÿ”’
process_nested_lib_dir ๐Ÿ”’
push_handled_project_root ๐Ÿ”’
rebase_config_paths
Build a config for a copied temp workspace from an already materialized config.
rebase_mutable_project_path ๐Ÿ”’
rebase_project_path ๐Ÿ”’
rebase_remapping ๐Ÿ”’
relative_to_root
Compute relative path of path under root, or return the path unchanged if not under root.
resolve_against_root ๐Ÿ”’
symlink_dir
Create a symlink to a directory (cross-platform).
symlink_nested_libs ๐Ÿ”’
Recursively symlink nested lib directories within a library.