Skip to content
This repository was archived by the owner on Dec 3, 2026. It is now read-only.

refactor(loop_lib, meta_rust_cli): drop dead parameters and a forwarding library; tests stop repeating each other - #205

Merged
gold-silver-copper merged 8 commits into
mainfrom
refactor/loop-dead-code
Nov 18, 2026
Merged

gold-silver-copper merged 8 commits into
mainfrom
refactor/loop-dead-code

Conversation

@gold-silver-copper

@gold-silver-copper gold-silver-copper commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

+201 / −452 lines (net −251). Production code in loop_lib/loop_cli: +3 / −20. meta_rust_cli (code and its tests moved from lib.rs into main.rs): +172 / −184. Tests in loop_lib/loop_cli: +26 / −252.

What changes

  • loop_lib::import_aliases drops its dry_run parameter. Its one caller, loop --add-aliases-to-global-looprc (loop_cli/src/main.rs), always passes false; loop has no dry-run flag for it. The if dry_run { … } branch could never run.
  • Outcome::dry_run is gone. No code reads it: every .dry_run read in the repo is on a LoopConfig, Cli, Meta or request, never on an Outcome, and Outcome is not serialized. Its callers (meta_cli/src/invoke.rs, loop_cli) use only rows(), error() and finish().
  • failed_result and capture_in_directory stop restating CommandResult::default(). CommandResult derives Default; the deleted project: None, argv: Vec::new(), signal: None, stdout: Vec::new() are exactly its defaults, and both literals already end in ..CommandResult::default(). Same values.
  • StdoutError is imported, not re-exported, by loop_lib. No crate names loop_lib::StdoutError; the type stays public in meta_plugin::out, so OnDone::call's signature is unchanged for callers.
  • loop_lib tests stop spelling out default values. LoopConfig { … ..Default::default() } literals lose fields set to their default; full DirCommand { … } literals become DirCommand { <the one non-default field>, ..DirCommand::new(dir, argv) }. ignore: vec![] (not the default [".git"]) went too: run and run_commands never read ignore.
  • Six loop_lib tests that repeat a kept test are deleted (see "Tests").
  • loop_cli's exclusion test uses the file's own sandbox, run and ran_in helpers instead of building its own sandbox, command and pwd-line filter. Same binary, same arguments, same assertions. Sandbox::new already canonicalizes work(), so the extra canonicalize() was a no-op; run also pipes an empty stdin and points SHELL at a missing file, which a pwd run never touches. The third case (run from inside b) keeps its own current_dir.
  • meta_rust_cli is one binary. Its [lib] target was called only by its own main.rs, through a one-line forwarding fn execute. The function and its tests move into main.rs as fn execute(ctx: &Ctx, request: Request) (the signature PluginDefinition::execute takes); lib.rs and the [lib] table are deleted. The strict test reuses its request with request.clone() (Request derives Clone).

Deleted items

  • loop_lib::import_aliases's dry_run parameter: rg -w import_aliases finds only the definition and loop_cli/src/main.rs (import and one call with false).
  • loop_lib::Outcome::dry_run (pub field): rg '\.dry_run\b' --type rust finds no read on an Outcome.
  • pub use meta_plugin::out::StdoutError in loop_lib: rg 'loop_lib::StdoutError' and the use loop_lib::{…} lists find no user.
  • The meta_rust_cli library (execute_command): rg meta_rust_cli finds no crate that imports it; meta_cli/tests/plugin_deps.rs names the package (still there) and meta_cli/tests/single_source.rs reads the usage string in meta_rust_cli/src/main.rs (still there). scripts/programs.py reads only [[bin]] targets.

meta_rust_cli is publish = false. loop_lib has no publish = false, but releases no longer run cargo publish (the publish job was removed from release.yml in #186); its last crates.io version is 0.2.22. No other repo in the workspace depends on loop_lib or meta_rust_cli (rg loop_lib / rg meta_rust_cli across the checked-out repos finds no dependency outside this one).

Tests

Deleted from loop_lib/src/tests.rs, each with the kept test that runs the same path with the same (or a stronger) assertion. run only maps config.directories onto DirCommand::new (with config.env) and calls run_commands, so a run test and a run_commands test with the same config run the same code:

Deleted Covered by
test_run_without_looprc (run, echo, one folder, silent, sequential → ok) test_run, first half (same, two folders). run reads no .looprc; loop_cli's an_empty_looprc_selects_what_no_looprc_does covers the file.
test_run_commands_sequential (two echos → ok) each_command_runs_in_its_own_directory_with_its_own_env with parallel: false: three commands succeed, and each ran in its own folder with its own env.
test_run_commands_parallel (same, parallel) the same test with parallel: true.
test_run_commands_dry_run (touch in dry run → ok, no file) test_dry_run_does_not_execute (same command and assertions, through run).
test_run_commands_failure_handling (exit 1, sequential → error) test_run, second half (same, through run).
test_run_commands_failure_in_dry_run_succeeds (exit 1 in dry run → ok) test_dry_run_returns_success (same, through run).

test_run_commands_empty_list stays: it is the only test of run_commands' early return for no commands.

Changed on purpose: loop_lib test literals (defaults dropped, same values), loop_cli's an_exclusion_holds_for_directories_named_outright (shared helpers, same assertions), and meta_rust_cli's four tests (moved into main.rs, calling execute instead of execute_command; same assertions).

Behaviour

No behaviour change. meta-cargo is built from the same code; only its crate layout changed. Cargo.lock is unchanged.

Considered, not done

Nothing in this PR's scope was skipped.

Not verified

Local checks ran on Linux only; CI's Test jobs cover macOS and Windows. No platform-specific code was touched.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 7 billable files and costs up to $1.75.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 57 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 90 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: e5b640f5-018a-4441-8a73-0d5fe9de0257
Commits

Reviewing files that changed from the base of the PR and between 283562b and c5f7bf1.

Files selected for processing: 7

  • loop_cli/src/main.rs
  • loop_cli/tests/cli.rs
  • loop_lib/src/lib.rs
  • loop_lib/src/tests.rs
  • meta_rust_cli/Cargo.toml
  • meta_rust_cli/src/lib.rs
  • meta_rust_cli/src/main.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@gold-silver-copper
gold-silver-copper merged commit 9439487 into main Nov 18, 2026
12 of 13 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant