PathBuf renders zip entry paths with the host separator, so prefix
checks against 'META-INF/' never matched and excluded entries were
extracted anyway; normalize separators before matching.
Model natives/classifiers/extract on Library, download the matching
native classifier jar and unpack it into versions/<id>/natives so
pre-1.13 versions can launch. Cached client jar, libraries and assets
are now checked against their recorded size and sha1 instead of a bare
exists(), and fresh client jar downloads are verified before use.
Same pattern as fetch_version_manifest_from from the earlier batch:
each fetcher gets a sibling that takes the URL as a parameter; the
existing function delegates to it with the upstream constant.
Production callers are unchanged.
- src/net/forge.rs: fetch_forge_versions_from(client, promotions_url,
game_version) and fetch_forge_game_versions_from(client,
promotions_url).
- src/net/fabric.rs: fetch_fabric_game_versions_from(client, base) and
fetch_fabric_versions_from(client, base, game_version). The fabric
API is hierarchical so the helpers take the meta base URL and append
the rest internally, matching the existing layout.
- src/net/quilt.rs: same pair as fabric.
- src/net/neoforge.rs: fetch_neoforge_versions_from(client, api_url,
game_version).
- src/net/mojang.rs: download_assets_from(client, meta, meta_dir,
assets_base) so tests can route per-asset CDN downloads through a
wiremock server. download_assets delegates to it with
ASSETS_BASE_URL.
tests/net_loaders.rs adds eight wiremock tests covering each new
fetcher and a happy + error case for neoforge's invalid-game-version
branch. tests/net_mojang.rs gains download_assets_from_writes_index_and_assets
which now exercises the full per-asset download path against synthetic
hashes.
Production touches are minimal (one new pub fn delegating to the
existing one for each fetcher). Behaviour of existing callers is
unchanged.
The existing fetch_version_manifest hard-codes the Mojang URL, so tests
either had to hit the live endpoint (the #[ignore] live-API test) or
not run at all. Adds fetch_version_manifest_from(client, url) that lets
callers pick the URL; fetch_version_manifest stays compatible by
delegating with the upstream constant. fetch_version_meta_with_raw
already takes the URL via VersionEntry, no change needed.
tests/net_mojang.rs adds three wiremock tests:
- fetch_version_manifest_parses_synthetic_response verifies the
VersionManifest deserialiser against a synthetic upstream-shaped
payload (latest + versions list).
- fetch_version_meta_returns_struct_and_raw_bytes verifies both the
parsed VersionMeta and the raw byte capture path used by the install
flow to write upstream JSON byte-for-byte.
- fetch_version_manifest_retries_5xx_and_succeeds confirms the retry
envelope integrates correctly with VersionManifest deserialisation
on top of the retry-only tests in tests/net_retry.rs.
These don't replace the #[ignore = "hits live Mojang API"] canary
which still runs on master push to detect upstream schema drift.
- drop stale phase planning comments from launch_profile module headers.
- simplify merge_libraries to HashSet<&str> (no string clones).
- rewrite coord_key with match_indices (clearer intent).
- read /proc/sys/kernel/osrelease on linux for mojang_os_version
instead of shelling out to uname; return empty elsewhere.
- add comment explaining why is_retryable excludes Parse.
- shorten the launch_profile::... paths in launch/mod.rs with top-level
use statements.
- derive Default on LaunchProfile + nested types so test fixtures use
..Default::default() instead of listing every None field.
- inline account_can_launch at its single call site, delete the helper
and three tests that exercised trivially-correct one-line logic.
- extract get_json_with_raw on HttpClient and save_profile_bytes in
instance::loader; collapses three near-identical fetch_X_profile_with_raw
helpers and three near-identical 'create dir + write bytes' blocks.
several smaller fixes from the code review:
- add os_version to RuleContext + OsCondition for mojang rules that
constrain natives selection by host version (rare, but in the spec).
- factor mojang_os_name/arch/version into a shared launch_profile::system
module instead of duplicating between net/mojang.rs and launch/mod.rs.
- get_json and get_bytes now retry transient failures (5xx, connect,
body decode) via a shared get_with_retry envelope; previously only
download_file had retry logic.
- migrate_legacy_meta_if_needed falls back to the stale cached profile
with a warn log on network failure instead of erroring out (offline
launches now work).
- tightened legacy-loader detection by requiring the unique-to-rmcl
gameArguments field; clearer error when loader_version is absent.
- forge legacy versionInfo write uses compact serialization (no
pretty-print key reorder).
- deleted dead fetch_version_meta and save_profile_json.
- documented quick-play templates omission in templates::lookup.
- added end-to-end test that loads a vanilla profile from disk, loads a
loader profile with inheritsFrom, resolves, renders, and snapshots.
vanilla launches now read upstream mojang JSON via the new LaunchProfile
path, render game/JVM args through launch_profile::render with template
substitution, and store the cached meta.json byte-for-byte instead of
re-serializing through a narrow struct. legacy stripped meta.json files
are re-fetched on first launch. adds HttpClient::get_bytes and
fetch_version_meta_with_raw; collapses the two library-rule evaluators
into one shared launch_profile::rules::evaluate.