Update labels disappeared at random and only came back after switching
instances, and mods installed from a modpack never got one.
- display no longer requires the snapshot inventory to match the manifest
exactly; a single changed file wiped every label in the instance even
though each update is keyed by its exact installed version
- a finished scan is applied instead of discarded when the manifest moved
on in the meantime, and the pending queue no longer leaks or replays
stale snapshots over newer ones
- compare versions by publish date and ask the provider for the installed
version when it is missing from the compatible list, which is the normal
case for modpack pinned files; also fixes the modpack update label
- keep known updates for checks that failed so an offline scan no longer
overwrites a good cache
- rescan only when the inventory changed or the snapshot is older than
30 minutes, with one pooled http client per scan instead of one per mod
Phase E added snapshots for the ErrorPopup; this extends the same
pattern to the three other high-value widgets the audit flagged.
- src/tui/widgets/instances.rs: two snapshots covering the instance
list with three synthetic instances (verifies layout, "Never played"
rendering, scrollbar gutter) and the empty list. State is passed in
via the existing State::with_instances constructor; no global state
involved.
- src/tui/widgets/popups/new_instance/render.rs: two snapshots covering
the Name step (default) and Loader step (hardcoded loader list, no
network). WIZARD_STATE is global, so the tests reset it under its
mutex and serialise via a per-module TEST_SERIAL mutex to prevent
cross-test races. The Version and LoaderVersion steps are skipped
here because their render path calls ensure_versions_loaded which
tokio::spawns a network task; covering them would need a fully
pre-populated state and is deferred.
- src/tui/widgets/popups/import_modpack/render.rs: two snapshots
covering the Input step (default) and the Fetching step (just a
spinner + label, no network triggered by render). Same global-state
serialisation pattern as new_instance.
Snapshots live next to each widget under snapshots/ as plain text and
are committed to git.
Audit identified six high-priority coverage gaps. This commit closes
them with 30 net new passing tests.
- tests/net_retry.rs (new): 5 wiremock-based tests for the retry
envelope in net/mod.rs. Covers get_json + download_file across:
5xx retry-then-succeed, 4xx fail-fast (asserted via wiremock
expect(1) so any retry attempt fails the test), and exhaust at
MAX_RETRIES = 3 (asserted via expect(4)). The exhaust test takes
~3.5s of wall time because the production code sleeps 500 + 1000 +
2000 ms between attempts; this is unavoidable without making the
delays configurable.
- tests/launch_pipeline.rs: 3 new error-path tests against
build_launch_invocation. merged_profile_missing_main_class_fails
surfaces the LaunchError::Parse branch when meta.json deserialises
cleanly but lacks mainClass. legacy_loader_profile_missing_loader_version_errors
and legacy_loader_profile_missing_installer_json_errors exercise the
two Parse branches inside migrate_legacy_loader_profile_if_needed.
- instance/manager.rs: 6 tests for rename (happy path, noop on same
name, empty target rejected, missing source, target collision) and
touch_last_played (sets the field to a stamp within 5 seconds of
now). The InstanceManager rename surface had no coverage before;
mutating the validation order or the std::fs::rename target would
not have failed any existing test.
- instance/content/mods.rs: 4 new precedence-chain tests. The reader
chain is fabric > quilt > forge-toml (which itself tries
neoforge.mods.toml before mods.toml) > mcmod.info. Only the
fabric-over-forge precedence had a test before. Adds quilt > forge,
forge_toml > mcmod_info, neoforge.mods.toml > mods.toml, and a test
that a mods.toml carrying only logoFile (no [[mods]] array) still
resolves the icon.
- tui/widgets/instances.rs: 12 new tests for format_last_played. One
case for the None input (returns "Never played"), then an rstest
covering each bucket boundary in the match (0/59 just-now,
60/3599 minutes, 3600/86399 hours, 86400/2591999 days,
2592000/31535999 months, >=31536000 over-a-year). A mutation that
bumps any boundary by one second, or swaps a unit suffix, fails at
least one case.
enter now confirms the search and returns focus to the list so items
can be selected, toggled, etc. pressing / returns to the search bar
with the query intact, esc clears it.