Repository navigation
Description
Problem
After element-cycle-resolution Phase 6, src/simlin-engine/src/vm.rs is 5920 lines — under, but within ~80 lines of, the hard MAX_LINES=6000 per-file threshold that scripts/lint-project.sh (rule at scripts/lint-project.sh:40-47) enforces on Rust sources. That lint runs in the pre-commit hook and CI.
This is tech debt / a maintainability risk, not a current violation: any future task that adds more than ~80 lines to vm.rs will trip the threshold and be forced to do a tangential split mid-stream before it can commit unrelated changes — the same failure mode as #471 (vdf.rs went over and broke pnpm lint on main), caught here proactively the way #518 was for db.rs.
How it got here
vm.rs has already actively managed headroom: the vector-op machinery for VECTOR ELM MAP and VECTOR SORT ORDER was spun out into sibling modules vm_vector_elm_map.rs and vm_vector_sort_order.rs specifically to keep vm.rs under the cap. The element-cycle-resolution work pushed it back up to 5920, so the slack from those extractions is largely consumed.
Why it matters
- The next non-trivial change to
vm.rswill failpnpm lint/ pre-commit / CI on an otherwise-unrelated diff. - The hard threshold exists to force modularization of super-sized files; bumping it ad hoc would undermine the policy.
vm.rsis the bytecode VM/interpreter hub — a high-traffic file where new opcodes and builtin implementations land — so the squeeze will recur.
Component
src/simlin-engine/src/vm.rs- Lint rule in
scripts/lint-project.sh
Possible approaches
Behavior-preserving extraction only. Following the existing sibling-module precedent (vm_vector_elm_map.rs, vm_vector_sort_order.rs):
- Extract another self-contained vector/array opcode implementation into its own
vm_<op>.rssibling. - Or relocate a cohesive VM subsystem (e.g. a group of builtin implementations, or the debug/disassembly helpers such as
debug_print_bytecode) into a sibling module.
The fix is mechanical: find a cohesive cluster and relocate it. Doing it now (with headroom to spare) is lower-risk than doing it under duress when a feature commit is blocked.
Context
Surfaced during the element-cycle-resolution Phase 6c code review (docs/implementation-plans/2026-05-18-element-cycle-resolution/). This is the vm.rs companion to #518 (db.rs at the same cap); for reference, db.rs is currently 5895 lines. See the 2026-05-19 update comment on #518.
Activity
bpowers commentedon Jun 8, 2026
Resolved: vm.rs is now 5582 lines (~418 of headroom), down from the 5920 this issue was filed at. The proactive extraction it asked for happened along the way -- the set_value and reset/run_initials test suites moved into the sibling modules vm_set_value_tests.rs and vm_reset_and_run_initials_tests.rs (the same pattern as vm_vector_elm_map.rs / vm_vector_sort_order.rs), and subsequent VM work (#599/#717) kept the file under control. Worth reopening (or filing fresh) if new opcode work pushes it back within ~100 lines of the 6000 cap.