One step in a what-if simulation chain. Each variant maps to a single-action
helper in this module — simulate_sequence applies them in order. The
JSON shape matches the MCP raysense_what_if tool: the discriminator key
is action, and the field names align with the per-action MCP arguments.
Remove the local import edge from from_path to to_path and confirm the
reduction lowers the report’s cycle count. Returns EdgeNotFound if the
edge does not exist, or EdgeNotInCycle if removal does not break a cycle
(i.e., the edge is not load-bearing for any cycle).
Rank candidate local edges by how much each one’s removal reduces the
report’s cycle count. Considers up to max_candidates distinct local edges
(capped to avoid quadratic cost on large graphs); returns at most limit
recommendations sorted by reduction (descending), then path. Returns an
empty list when the report has no cycles.
Produce a ScanReport representing the codebase as if from_path had been
moved to to_path. The file keeps its file_id (and so all imports/calls
referencing it stay valid); only path, module, and the
graph-derived metrics that depend on path/module change.
Produce a ScanReport representing the codebase as if file_path did not
exist. All facts referencing the file (and any functions defined in it) are
dropped, and remaining file/function/call ids are renumbered so downstream
consumers that index by id continue to work.
Apply a sequence of Actions in order, threading the mutated ScanReport
through each step. Returns the first SimulateError encountered, indexed
by action position so callers know which step failed. Filesystem state is
never touched — every mutation is in-memory.