Picks up the remaining test-only suggestions from the style audit. No
production code change.
- launch_profile/templates.rs: introduces a Fixture struct that owns
the four PathBuf inputs (lib/nat/game/assets) and exposes a ctx()
method. Eight tests that each rebuilt the same context inline now
collapse into one rstest with eight cases plus two standalone
tests for the recursive-substitution and Windows-backslash edge
cases. Net code: ~120 lines saved.
- launch_profile/render.rs: same pattern. Fixture::new() owns the
paths plus a FeatureSet; ctx() and rule_ctx() expose what every
test needs. Six tests stop redeclaring four PathBufs + a five-line
RuleContext literal apiece.
- instance/launch/mod.rs: three installer_version_dir_name tests
(Forge / NeoForge / non-installer loaders) become one rstest with
five cases (one per ModLoader variant). A regression that
misorders the match arms would now fail a specific case, not just
the catch-all "non-installer" test.
- instance/content/resource_packs.rs: ten extract_description_*
tests become one rstest with ten cases. Each case still hits a
distinct match arm (string, object{text}, object{no text}, array
variants, null, number, bool); the rstest is cosmetic, not a
consolidation that loses coverage.
Net effect: same coverage, ~250 lines less repetitive test setup,
clearer intent. Test count rises by 2 because rstest expands cases
into separate test functions.
two related bugs surfaced by manual testing on 1.20.6 vanilla and fabric:
1. FeatureSet missing has_quick_plays_support / is_quick_play_singleplayer /
is_quick_play_multiplayer / is_quick_play_realms. mojang's profiles gate
the quick-play arguments behind these features. serde silently dropped
the unknown fields during deserialization, leaving an empty FeatureSet
that matched any context, so the conditional arguments emitted raw
${quickPlay*} placeholders to the JVM that template substitution then
warned about. add the fields explicitly and extend features_match to
reject any required feature the context doesn't set.
2. TemplateContext missing version_type. ${version_type} is an
unconditional template in modern vanilla's arguments.game (renders the
profile's "type" field, e.g. "release"). without it, the substitution
emitted a literal ${version_type} to minecraft and warned. add the
field, plumb the merged profile's type_ value through, default to
"release" when absent.
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.
introduce the launch_profile module with the core types and pure functions
needed to parse, evaluate, and substitute against mojang-format version
JSON: Rule/OsCondition/FeatureSet with a single rule evaluator,
TemplateContext + substitute() for ${var} expansion, and the
LaunchProfile schema mirroring mojang's on-disk shape. no consumers yet.