Skip to content

fix: a modpack with every mod inside it imports - #528

Merged
AntonBabchenko merged 3 commits into
mainfrom
fix/cf-modpack-empty-files
Oct 18, 2026
Merged

AntonBabchenko merged 3 commits into
mainfrom
fix/cf-modpack-empty-files

Conversation

@AntonBabchenko

Copy link
Copy Markdown
Owner

What was wrong

Found by the v0.28 regression pass (finding F5). Lucerna's own CurseForge .zip export of an instance whose mods all came from Modrinth or from disk bundles every jar in overrides/ and writes "files": []. Importing it back failed in two places:

  1. Parse. mods/modpack/curseforge.rs::parse always posted {"fileIds": [...]} to POST /v1/mods/files, also for an empty list, and required a CurseForge key first. CurseForge answers HTTP 400 to the empty list, so the preview never opened: «api.curseforge.com refused the request (error 400)» (seen in lucerna.log).
  2. Install. With the parse fixed, the preview opened at «0 of 0 selected» but Install stayed disabled (ImportPickerDialog: disabled={selectedShas.length === 0}), and the backend refused an empty selection too (import.rs: selected_shas.is_empty() → ModpackNoFilesSelected). A .mrpack whose mods all ride in overrides/ hits the same wall.

When it was born

Not a v0.28 regression. All three spots are identical at v0.27.0 and date from 703c05c (v0.5.0), when every pack listed files; the POST moved to network:: in 13fa3d2 (v0.6.0) unchanged in this respect. The export's classification (export/classify.rs) is unchanged since v0.27.0, and this is not the zip 9 bump (#516): the failure is an API request, not archive reading. So it shipped in v0.27.0 and earlier, and the changelog bullet goes under Fixed (with its Russian twin).

Fix

  • parse: no file entries → no request and no key needed; the summary lists the overrides as usual. With entries, the bulk POST goes in batches of cf_api::CF_MAX_BULK_FILE_IDS (the limit the sibling clients cf_api::resolve_files and mods/curseforge::versions_by_ids already batch by), stitched in order; a failed batch fails the parse with that batch's error (no partial summary).
  • import::selection_refusal(&summary, selected): «choose at least one» applies only when the pack lists files. A pack that lists none imports what its overrides bundle; one with only unresolvable mods imports so the manual-completion flow can run; one with none of these has nothing to install and is refused (ModpackNoFilesSelected, no new error variant, no bindings change).
  • ImportPickerDialog mirrors the rule: plain «Install» for a pack that lists no files, a note in place of «0 of 0 selected» and the select-all box, and Install off with «This pack has nothing to install.» for an empty pack.

Fallback discipline

The empty-list skip is not a fallback: there is nothing to ask. A failed batch is not swallowed (a_failed_batch_fails_the_parse asserts the 503 and that the second POST is the one that failed). The «nothing to install» case resolves to the restrictive answer.

Tests

  • lucernas_own_curseforge_export_imports: round trip through the export's own pieces (classify → build_cf_manifest → write_archive) of an instance with a Modrinth mod, then parse against a mock that must receive no request, then selection_refusal. Red with the old parse (mutation-checked).
  • a_pack_with_no_file_entries_asks_curseforge_nothing, more_than_a_batch_of_entries_is_resolved_in_batches (posts [100, 50]), a_failed_batch_fails_the_parse.
  • selection_refusal: no files + overrides, client overrides only, unresolvable only, nothing at all, files with none / one selected.
  • Picker (Vitest): plain Install for a bundled-only pack, the bundled note replacing the empty selection row, unresolvable-only enabled, nothing-to-install disabled with its note; the stale intent test rewritten to the new rule.

Live check

Dev launcher on the final head, isolated data root: smoke-fab120-cf.zip (Lucerna's own CF export, 3 mods, "files": []) previews with the bundled note and plain «Install», imports as a new instance with its three mods.

cargo-deny

No dependency change.

🤖 Generated with Claude Code

AntonBabchenko and others added 3 commits October 18, 2026 07:44
Found by the v0.28 regression pass (F5). Lucerna's own CurseForge export
of an instance whose mods came from Modrinth or from disk bundles every
jar in overrides/ and lists no files; a .mrpack of an all-local instance
does the same.

- modpack/curseforge.rs posted {"fileIds": []} to CurseForge, which
  answers 400, so the pack's preview never opened. A pack that lists no
  files now asks nothing and needs no key. A listed set is resolved in
  batches of cf_api::CF_MAX_BULK_FILE_IDS (100), as the sibling clients
  do; the first failing batch fails the parse.
- With the preview open, Install stayed disabled («0 selected») and the
  backend refused an empty selection (both since v0.5.0). «Choose at
  least one mod» now applies only to a pack that lists files
  (import::selection_refusal); the picker offers a plain Install for a
  pack that lists none. The picker test that pinned «0 files → disabled»
  is replaced by one that picks none of the listed files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up. The selection rule now takes the summary: a pack that
lists no files imports what its overrides bundle, one with only
unresolvable mods imports for manual completion, and one with neither has
nothing to install and is refused. The picker mirrors it, replacing the
empty «0 of 0 selected» row with a note. Adds a round-trip test that
imports Lucerna's own CurseForge export, tightens the failed-batch test,
and stops claiming a measured 400 above 100 ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…files

# Conflicts:
#	CHANGELOG.md
#	src/lib/changelog/locales/ru.md
@AntonBabchenko
AntonBabchenko enabled auto-merge (squash) October 18, 2026 06:26
@AntonBabchenko
AntonBabchenko merged commit e2d0909 into main Oct 18, 2026
12 checks passed
@AntonBabchenko
AntonBabchenko deleted the fix/cf-modpack-empty-files branch October 18, 2026 06:33
@AntonBabchenko AntonBabchenko mentioned this pull request Oct 18, 2026
1 of 2 tasks
AntonBabchenko added a commit that referenced this pull request Oct 18, 2026
Bump package.json, tauri.conf.json, Cargo.toml and Cargo.lock (the lucerna
entry only) to 0.28.0 and cut [Unreleased] into [0.28.0] — 2026-10-18 (EN +
RU) with its compare links. Range v0.27.0..e2d0909 (#503–#528); the section
was audited in #525.

Last re-audit, for #526–#528:
- #527's two Fixed bullets (borderless dialog fields, "No results." under a
  failed search) and #528's (a modpack with only bundled mods) describe
  defects present at v0.27.0, so they stay in Fixed. #528's quoted error was
  #513's new wording; a v0.27.0 user saw a generic mod-service message, so
  the bullet now says "an error from CurseForge".
- #526 made built-differently files notes everywhere and Repair optional: the
  Forge Changed bullet now says the files are noted, can be left, and Repair
  rebuilds them if you want. #526 and #527's F3/F4 fix flows new in this
  window: no bullet.
- Fixed is reordered by theme (the three new bullets join their neighbours).

Result: Added 7, Changed 4, Fixed 15, Security 2, EN/RU in parity.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant