Mole icon indicating copy to clipboard operation
Mole copied to clipboard

Avoid unnecessary sudo in install, use safe test cleanup, and relax perf threshold

Open tw93 opened this issue 3 days ago • 0 comments

Motivation

  • Prevent installing as root into writable temporary prefixes by ensuring needs_sudo checks the parent directory when INSTALL_DIR does not exist.
  • Make test cleanup safer by using existing removal utilities instead of raw rm -rf.
  • Reduce fragility of the bytes_to_human performance test by allowing a configurable threshold for timing variability.

Description

  • Update needs_sudo in install.sh to return writable checks for INSTALL_DIR when it exists and otherwise check the parent directory.
  • Source lib/core/file_ops.sh in scripts/test.sh and replace the raw rm -rf /tmp/mole-test with safe_remove "/tmp/mole-test" true.
  • Change tests/performance.bats to use a configurable limit MOLE_PERF_BYTES_TO_HUMAN_LIMIT_MS with a default of 4000 ms instead of a hard-coded 2000 ms.

Testing

  • No automated tests were executed as part of this change.

Codex Task

tw93 avatar Dec 31 '25 12:12 tw93