Skip to content

fix: put a modpack back on its own platform from the migration plan - #556

Merged
AntonBabchenko merged 3 commits into
mainfrom
fix/pack-origin-remedy
Nov 30, 2026
Merged

AntonBabchenko merged 3 commits into
mainfrom
fix/pack-origin-remedy

Conversation

@AntonBabchenko

Copy link
Copy Markdown
Owner

Summary

A modpack-owned mod the loader refuses used to end in the migration plan with «change it from the modpack update flow» — a dead end, because the pack card reads "up to date" in exactly the state that produces it: an instance re-versioned with its pack left attached (the maintainer's case: Fabulously Optimized 14.0.0-beta.4 targets 26.2, the instance runs 26.1.1).

The plan now says what the pack is built for and offers the remedy:

  • Backend. When a pack-origin mod is stranded and the instance records its pack version, mods_plan_mc_migration lists the pack's versions (one request, same network chokepoint, interactive priority) and returns McMigrationPlan.pack: PackVerdict. Known says whether Minecraft and/or the loader differ (the loader only where the source lists loaders; an entry with no Minecraft tag cannot contradict either) and how many other versions fit the instance. A failed request or a delisted version is Unavailable, never a platform claim.
  • Migration dialog. The stranded section opens with a pack block: «Restore Minecraft 26.2» re-applies the installed version through the existing update flow, which writes the pack's Minecraft and loader back; «Pick another modpack version (N for Minecraft X · Loader)» deep-links the pack drawer's switch dialog pre-filtered. Per-mod copy describes what the pack does instead of pointing elsewhere. Unavailable says the check failed and offers a retry.
  • Confirm. New PackPlatformRestoreDialog: the MC / loader risk, the file list only when the diff has files, "already matches" when the archive turns out to match, and «Back up worlds first» — the same choice, copy and default as the update and switch confirms (on: the worlds move to another Minecraft version).

Re-landed from feat/pack-origin-remedy (2026-09-16)

That branch (designed, reviewed, never verified or PR'd) sat 143 commits behind main. Squash-merged onto origin/main and adapted:

Review findings fixed (second commit)

  • The dialog's "this pack update is mine" mark was never cleared, so a later update from the drawer ended without a re-plan.
  • A restore queued behind another task of the instance (e.g. a game install) did not hold the plan's writes in a reopened dialog (taskFor returns the first active task of a scope).
  • A bridge failure while reading the instance for a restore ended the click in silence.
  • No project-id fallback for the pack name; an unrecorded pack version is named from the list entry.

Test plan

  • New/changed Vitest: migration-plan-dialog, pack-platform-restore-dialog, instance-game-section, modpack-version-list, imported-view; Rust unit tests for pack_verdict (incl. empty game tag, unrecorded version). One new test seen red → green locally (instance-game-section "keys the rescan by the platform the record now has"); everything else is CI's.
  • Live check on 2eee2a9e (dev build, own identifier + data root, torn down after): imported Fabulously Optimized 14.1.2 (26.2), switched the profile to 26.1.2 keeping the pack, added a world → Overview «35 mods won't let the game start» → «Fix incompatible» → the pack block («built for Minecraft 26.2», Restore + «16 for Minecraft 26.1.2 · Fabric»), every pack row «fixes with the button above» → Restore → confirm (MC 26.1.2 → 26.2 risk, «no mod files change», backup ticked, 1 world) → applied: profile on 26.2 / Fabric 0.20.1 (the pack's own), a backup zip of the world exists, the plan re-planned to «nothing to move», the Installed list dropped its problems box. Re-versioned again → «Pick another version» opened the drawer's switch dialog filtered to 26.1.2. The merge of origin/main after that run brought only zh_Hans.json.
  • CI green.

Follow-ups (not in this PR)

  • Prevent the state at its source: Settings → Minecraft version change with «Keep & continue» leaves a pack attached to a platform it does not target.
  • SwitchRiskList's MC-change copy says «after switching» also inside the restore confirm.
  • zh_Hans still has the old mods.migration.reason.packOrigin text; Weblate should flag it as the source changed.

A pack-owned mod the loader refuses ended in "change it from the modpack
update flow" - a dead end when the pack card reads "up to date", which is
exactly the state of an instance re-versioned with its pack left attached
(Fabulously Optimized 14.0.0-beta.4 targets 26.2 in an instance on 26.1.1).

The plan now lists the pack's versions when such a row exists and returns
a PackVerdict: whether the instance left the installed version's platform
(Minecraft first; loader only where the source lists loaders), the entry a
restore re-applies, and how many other versions fit the instance. A failed
request or a delisted version is Unavailable, never a platform claim.

The stranded section opens with a block for the pack: "Restore Minecraft
26.2" re-applies the installed version through the update flow, which
writes the pack's Minecraft and loader back; "Pick another modpack
version" deep-links the drawer's switch dialog pre-filtered to the
instance's platform. The new PackPlatformRestoreDialog confirm offers
"Back up worlds first" like the update and switch confirms do (on by
default: the worlds move to another Minecraft version).

Re-landed from feat/pack-origin-remedy (2026-09-16) on current main:
the Manage window is gone, so the Settings tab's Game section re-reads
the instance record after the dialog applies; LoaderPicker keeps main's
#422 contract; the restore holds the plan's Apply while its confirm is
open.
… update

Review findings on the re-landed restore:

- The dialog marked a pack update as its own for good once it started a
  restore, so a later update from the drawer ended without the re-plan it
  needs. The end of its own task now consumes the mark, and a restore that
  never reached the queue clears it.
- A restore queued behind another task of the instance (a game install)
  did not hold the plan's writes in a reopened dialog: the check asked for
  the instance's first active task only. It now looks for any active pack
  update of the instance.
- A bridge failure while reading the instance for a restore now says why
  instead of ending the click in silence.
- An entry that names no Minecraft version no longer reads as built for
  another one, and a pack whose name or version the profile did not record
  is named after the profile and the list entry, never the project id.
@AntonBabchenko
AntonBabchenko merged commit 45d1e3d into main Nov 30, 2026
12 checks passed
@AntonBabchenko
AntonBabchenko deleted the fix/pack-origin-remedy branch November 30, 2026 19:37
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