This repository was archived by the owner on Dec 3, 2026. It is now read-only.
Repository navigation
refactor(loop_lib, meta_rust_cli): drop dead parameters and a forwarding library; tests stop repeating each other - #205
Merged
Conversation
… was always false
…e uses loop_lib's copy
…d only by its own main, folds into main.rs
|
Warning Review limit reached
This review includes 7 billable files and costs up to $1.75.
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. View limit details
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
+201 / −452 lines (net −251). Production code in
loop_lib/loop_cli: +3 / −20.meta_rust_cli(code and its tests moved fromlib.rsintomain.rs): +172 / −184. Tests inloop_lib/loop_cli: +26 / −252.What changes
loop_lib::import_aliasesdrops itsdry_runparameter. Its one caller,loop --add-aliases-to-global-looprc(loop_cli/src/main.rs), always passesfalse;loophas no dry-run flag for it. Theif dry_run { … }branch could never run.Outcome::dry_runis gone. No code reads it: every.dry_runread in the repo is on aLoopConfig,Cli,Metaor request, never on anOutcome, andOutcomeis not serialized. Its callers (meta_cli/src/invoke.rs,loop_cli) use onlyrows(),error()andfinish().failed_resultandcapture_in_directorystop restatingCommandResult::default().CommandResultderivesDefault; the deletedproject: None,argv: Vec::new(),signal: None,stdout: Vec::new()are exactly its defaults, and both literals already end in..CommandResult::default(). Same values.StdoutErroris imported, not re-exported, byloop_lib. No crate namesloop_lib::StdoutError; the type stays public inmeta_plugin::out, soOnDone::call's signature is unchanged for callers.LoopConfig { … ..Default::default() }literals lose fields set to their default; fullDirCommand { … }literals becomeDirCommand { <the one non-default field>, ..DirCommand::new(dir, argv) }.ignore: vec went too:runandrun_commandsnever readignore.sandbox,runandran_inhelpers instead of building its own sandbox, command andpwd-line filter. Same binary, same arguments, same assertions.Sandbox::newalready canonicalizeswork(), so the extracanonicalize()was a no-op;runalso pipes an empty stdin and pointsSHELLat a missing file, which apwdrun never touches. The third case (run from insideb) keeps its owncurrent_dir.meta_rust_cliis one binary. Its[lib]target was called only by its ownmain.rs, through a one-line forwardingfn execute. The function and its tests move intomain.rsasfn execute(ctx: &Ctx, request: Request)(the signaturePluginDefinition::executetakes);lib.rsand the[lib]table are deleted. The strict test reuses its request withrequest.clone()(RequestderivesClone).Deleted items
loop_lib::import_aliases'sdry_runparameter:rg -w import_aliasesfinds only the definition andloop_cli/src/main.rs(import and one call withfalse).loop_lib::Outcome::dry_run(pub field):rg '\.dry_run\b' --type rustfinds no read on anOutcome.pub use meta_plugin::out::StdoutErrorinloop_lib:rg 'loop_lib::StdoutError'and theuse loop_lib::{…}lists find no user.meta_rust_clilibrary (execute_command):rg meta_rust_clifinds no crate that imports it;meta_cli/tests/plugin_deps.rsnames the package (still there) andmeta_cli/tests/single_source.rsreads the usage string inmeta_rust_cli/src/main.rs(still there).scripts/programs.pyreads only[[bin]]targets.meta_rust_cliispublish = false.loop_libhas nopublish = false, but releases no longer runcargo publish(thepublishjob was removed fromrelease.ymlin #186); its last crates.io version is 0.2.22. No other repo in the workspace depends onloop_libormeta_rust_cli(rg loop_lib/rg meta_rust_cliacross 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.runonly mapsconfig.directoriesontoDirCommand::new(withconfig.env) and callsrun_commands, so aruntest and arun_commandstest with the same config run the same code:test_run_without_looprc(run,echo, one folder, silent, sequential → ok)test_run, first half (same, two folders).runreads no.looprc; loop_cli'san_empty_looprc_selects_what_no_looprc_doescovers the file.test_run_commands_sequential(twoechos → ok)each_command_runs_in_its_own_directory_with_its_own_envwithparallel: false: three commands succeed, and each ran in its own folder with its own env.test_run_commands_parallel(same, parallel)parallel: true.test_run_commands_dry_run(touch in dry run → ok, no file)test_dry_run_does_not_execute(same command and assertions, throughrun).test_run_commands_failure_handling(exit 1, sequential → error)test_run, second half (same, throughrun).test_run_commands_failure_in_dry_run_succeeds(exit 1in dry run → ok)test_dry_run_returns_success(same, throughrun).test_run_commands_empty_liststays: it is the only test ofrun_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), andmeta_rust_cli's four tests (moved intomain.rs, callingexecuteinstead ofexecute_command; same assertions).Behaviour
No behaviour change.
meta-cargois built from the same code; only its crate layout changed.Cargo.lockis 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.