Deduplicate identical files, merge nonconflicting legacy directories, and archive differing disposable caches without overwriting current data. Resume stale journals and detect local settings conflicts before moving instances.
Render migration Retry/Quit in the shared popup footer and add regression coverage for recovery and data preservation.
mcl named shortcut files with the sanitized instance name, but the
migration looked them up by raw display name and never matched; the
windows lookup keeps the legacy .bat extension.
Picks up the style audit's findings without touching production
behaviour (except for two em-dash characters in non-test code that
violated the no-em-dash rule).
- cli/import.rs, instance/import/mmc.rs: replace the two em-dashes
that leaked into source (one in a user-facing format string, one
in a code comment) with hyphen / colon.
- instance/manager.rs: rewrite test_manager to return TempDir instead
of a hand-rolled tempdir path with manual cleanup. Drop the
trailing std::fs::remove_dir_all from every test. Rename test_*
functions to describe the scenario per CONTRIBUTING (delete_missing_
instance_returns_not_found, save_then_load_all_round_trips_config,
load_one_missing_returns_not_found, etc.).
- migrate.rs: replace unique_tmp + atomic counter with
tempfile::tempdir() across all seven tests; ~10 lines of plumbing
gone, automatic cleanup via Drop.
- auth/accounts.rs: drop the dummy_account wrapper that just forwarded
to create_offline_account; inline the real call at the eight use
sites.
- instance/models.rs: rename test_instance_config_roundtrip to
instance_config_roundtrips_through_json.
- instance/content/mods.rs: drop the "what" comments above straight
forward asserts; keep the one "why" comment that explains an
empty-name + present-logo coverage gap. Trim the obvious "helper to
create a jar (zip) file" comment above make_jar.
- tests/smoke.rs: //! to // for the file header; project convention is
// for files (//! is for crate-level rustdoc, which doesn't render
for integration test crates).
Adds one new test:
- instance/import/mmc.rs: extract_mmc_archive_copies_minecraft_subtree
builds an in-memory zip with a Pack/ prefix, a Pack/mmc-pack.json
sibling, and Pack/.minecraft/{options.txt, mods/test-mod.jar},
then asserts only the .minecraft/ subtree lands in the destination
with relative paths preserved. Closes the mmc extract coverage gap
the audit flagged.
Audit found 9 confirmed-weak unit tests plus several newly-found ones that
asserted things equivalent to themselves, returned vacuous truth, or had
assertions guarded behind conditionals that silently swallowed failure.
Changes by file:
- auth/accounts.rs: create_offline_account_fields now pins the uuid to
offline_uuid("TestPlayer") instead of !is_empty(); mutating the uuid
derivation would fail this now.
- cli/mod.rs: parses_instance_list_subcommand drills into the list
subcommand under instance rather than only verifying the instance
group exists.
- config/theme.rs: border_style_roundtrip is now an rstest covering all
four BorderStyle variants; mutating any non-Double arm is caught.
- instance/desktop.rs: removed desktop_path_returns_some (assertion was
gated behind if let Some so could pass when the function returned
None); build_content_linux* already covers the real behaviour.
- instance/launch/mod.rs: removed five predicate-only tests that
asserted serde defaulting on LaunchProfile rather than invoking the
migration predicate. Added two tests that actually call
migrate_legacy_meta_if_needed (rstest over modern/legacy arg shapes)
and migrate_legacy_loader_profile_if_needed (modern-with-inheritsFrom
early-return). Renamed build_game_args_renders_upstream_arguments,
dropping the misleading "and appends loader args" clause that the
test never covered.
- instance/loader/mod.rs: removed test_vanilla_install_noop (no
assertion at all) and test_vanilla_get_versions (asserted a hardcoded
Ok(vec!["vanilla"]) return). Replaced test_vanilla_factory with an
rstest covering all five ModLoader variants; a misordered match arm
in get_installer is caught.
- migrate.rs: removed cleanup_instance_leftovers_handles_missing_dir
(had no assertions and was redundant with
cleanup_instance_leftovers_removes_shim_and_log4j).
- net/mod.rs: removed detect_java_falls_back_to_java which asserted
!is_empty() against a function whose worst-case fallback is the
literal string "java"; structurally uncatchable.
- tui/error_buffer.rs: peek_all_returns_newest_first and
auto_assigned_ids_are_unique now tag their pushed events with a
unique substring and filter peek_all_errors to just those, so the
assertions actually fire instead of being silently skipped via
if all.len() >= 2 when shared static state interfered.
Total: net zero change in test count (deletions and parameterised
replacements roughly balance), but mutation coverage of the surviving
suite is materially stronger.
Renames Cargo package, binary, internal path identifiers, java shim,
user-agent, log filename, desktop shortcut Exec lines, and CLI program
name. Wires src/migrate.rs into main() so existing users have their
on-disk data (~/.config/mcl/, ~/.local/share/mcl/, ~/.cache/mcl/) moved
to the new locations on first launch.
BREAKING CHANGE: binary is now named rmcl. Old paths are auto-migrated.