[PR #8882] [MERGED] fix(server): legacy Agents migration skips packages this Engine can't install #8859

Closed
opened 2026-11-07 17:40:15 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8882
Author: @SpicyMarinara
Created: 11/5/2026
Status: ✅ Merged
Merged: 11/5/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/legacy-migration-skips-incompatible


📝 Commits (1)

  • 6960f41 fix(server): skip catalog entries this Engine cannot install in startup migrations

📊 Changes

2 files changed (+94 additions, -2 deletions)

View changed files

📝 packages/server/src/services/capability-packages/package-manager.service.ts (+26 -2)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+68 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #8881

Found while checking the Agents promotion for v2.5.2 (#8877).

Why this change

  • Profiles created before downloadable Agents existed get their packages from a one-time startup migration. It installs every published catalog entry without asking. It already skipped Experiences and zip rulesets so they could not block the other packages. It did not skip entries this Engine cannot install: ones that need a newer capability API, ones whose Engine range does not include this version, and ones with a manifest install issue.
  • For one of those entries, installCatalogPackage throws CapabilityPackageCompatibilityError. The whole migration then failed, and startup logged "will retry next startup" and retried on every launch. Each attempt stopped at the same entry, so the packages after it never installed. The Noodle extraction migration in the same startup block never ran either.
  • This was reproduced with v2.5.1's code and today's Agents staging catalog: gacha-forge 1.27.5 needs capability API 1.385, and v2.5.1 supports 1.341. v2.5.2 supports 1.816, so today's catalog would get through, but the first published entry above 1.816 would block it the same way.

What changed

  • Upgraded profiles now get every catalog package this Engine can install, even when the catalog also lists packages that need a newer Engine. Each skipped package is logged as a warning with its id and version, and the player can install it from the catalog after updating the Engine.
  • The legacy migration still finishes after a skip, so its completion marker is written and it does not run again. This is deliberate. Repeating the migration would reinstall every package the player has removed since, because it installs whatever is missing. Per-chat selections do not depend on what got installed, so nothing is lost.
  • If the Noodle entry is one this Engine cannot install, the Noodle migration now stays pending, the same as when Noodle is not published yet. No marker is written, so an updated Engine installs Noodle on a later startup.
  • Download, checksum and every other install failure still fail the migration so it retries on the next startup. The only new skip is CapabilityPackageCompatibilityError, which installCatalogPackage throws only from its checks before downloading: install issue, capability API, Engine range. These are the same capability API and Engine range checks that update discovery (findCompatibleCapabilityPackageUpdates) applies.
  • Server only. Nothing changes in the UI, settings, storage format, API responses or the manual install route.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Agent-run checks, at commit 6960f41eb5 on staging cca56b5342 (these do not replace the boxes above; full pnpm check was not run):

  • node ./scripts/run-regressions.mjs --filter capability-package-lifecycle: fails without the fix with CapabilityPackageCompatibilityError: Package requires capability API 1.817; this Engine supports 1.816 thrown from migrateLegacyAvailability. Passes with it.
  • With only the legacy half of the fix applied, the same regression fails in migrateExtractedNoodleAvailability with the same error. With a catch-all instead of the narrow class check, it fails with Missing expected rejection, which shows that download failures still fail the migration.
  • node ./scripts/run-regressions.mjs --filter capability-package: 5/5 passed (chat-controls, install-refusal, lifecycle, cache, disk-cleanup).
  • cd packages/server && ../../node_modules/.bin/tsc --noEmit -p .: passed.
  • node ./scripts/pnpm-runner.mjs --filter @marinara-engine/server lint (the server lint script, which is tsc): passed.
  • prettier --check on both changed files: passed.
  • ESLint: not applicable. The repo's ESLint config covers packages/client only, and neither changed file is in it.
  • Local CodeRabbit review (coderabbit review --agent --committed, base cca56b5342): completed, 0 findings on both files.

Manual verification notes

  • Manually verify that a data directory from before downloadable Agents (user state but no capability-packages/availability-migration-v1.json) starts on this build against a catalog with an entry above capability API 1.816. Startup should log Startup migration skipped <id> <version>, which this Engine cannot install once, install every other compatible package, and write the legacy marker. It should not log "Optional package availability migration did not complete".
  • Manually verify that a second startup of that profile does not run the migration again: nothing is reinstalled, including a package you uninstalled in between.
  • Manually verify that with an incompatible Noodle entry in the catalog, startup leaves noodle-extraction-migration-v1.json absent and does not fail. After switching to a catalog whose Noodle entry is compatible, the next startup should install Noodle.
  • Manually verify that a skipped package can still be installed from the Agents browser once the Engine supports it, and that before that the manual install still refuses it with the existing 409 message.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Not applicable: server-only startup behavior.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8882 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 11/5/2026 **Status:** ✅ Merged **Merged:** 11/5/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/legacy-migration-skips-incompatible` --- ### 📝 Commits (1) - [`6960f41`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6960f41eb50da9b2dc04dd1b1b22e82a48b46835) fix(server): skip catalog entries this Engine cannot install in startup migrations ### 📊 Changes **2 files changed** (+94 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+26 -2) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+68 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Closes #8881 Found while checking the Agents promotion for v2.5.2 (#8877). ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Profiles created before downloadable Agents existed get their packages from a one-time startup migration. It installs every published catalog entry without asking. It already skipped Experiences and zip rulesets so they could not block the other packages. It did not skip entries this Engine cannot install: ones that need a newer capability API, ones whose Engine range does not include this version, and ones with a manifest install issue. - For one of those entries, `installCatalogPackage` throws `CapabilityPackageCompatibilityError`. The whole migration then failed, and startup logged "will retry next startup" and retried on every launch. Each attempt stopped at the same entry, so the packages after it never installed. The Noodle extraction migration in the same startup block never ran either. - This was reproduced with v2.5.1's code and today's Agents staging catalog: gacha-forge 1.27.5 needs capability API 1.385, and v2.5.1 supports 1.341. v2.5.2 supports 1.816, so today's catalog would get through, but the first published entry above 1.816 would block it the same way. ## What changed <!-- List the key changes in this PR --> - Upgraded profiles now get every catalog package this Engine can install, even when the catalog also lists packages that need a newer Engine. Each skipped package is logged as a warning with its id and version, and the player can install it from the catalog after updating the Engine. - The legacy migration still finishes after a skip, so its completion marker is written and it does not run again. This is deliberate. Repeating the migration would reinstall every package the player has removed since, because it installs whatever is missing. Per-chat selections do not depend on what got installed, so nothing is lost. - If the Noodle entry is one this Engine cannot install, the Noodle migration now stays pending, the same as when Noodle is not published yet. No marker is written, so an updated Engine installs Noodle on a later startup. - Download, checksum and every other install failure still fail the migration so it retries on the next startup. The only new skip is `CapabilityPackageCompatibilityError`, which `installCatalogPackage` throws only from its checks before downloading: install issue, capability API, Engine range. These are the same capability API and Engine range checks that update discovery (`findCompatibleCapabilityPackageUpdates`) applies. - Server only. Nothing changes in the UI, settings, storage format, API responses or the manual install route. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Agent-run checks, at commit 6960f41eb5 on `staging` cca56b5342 (these do not replace the boxes above; full `pnpm check` was not run): - `node ./scripts/run-regressions.mjs --filter capability-package-lifecycle`: fails without the fix with `CapabilityPackageCompatibilityError: Package requires capability API 1.817; this Engine supports 1.816` thrown from `migrateLegacyAvailability`. Passes with it. - With only the legacy half of the fix applied, the same regression fails in `migrateExtractedNoodleAvailability` with the same error. With a catch-all instead of the narrow class check, it fails with `Missing expected rejection`, which shows that download failures still fail the migration. - `node ./scripts/run-regressions.mjs --filter capability-package`: 5/5 passed (chat-controls, install-refusal, lifecycle, cache, disk-cleanup). - `cd packages/server && ../../node_modules/.bin/tsc --noEmit -p .`: passed. - `node ./scripts/pnpm-runner.mjs --filter @marinara-engine/server lint` (the server lint script, which is tsc): passed. - `prettier --check` on both changed files: passed. - ESLint: not applicable. The repo's ESLint config covers `packages/client` only, and neither changed file is in it. - Local CodeRabbit review (`coderabbit review --agent --committed`, base `cca56b5342`): completed, 0 findings on both files. ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - Manually verify that a data directory from before downloadable Agents (user state but no `capability-packages/availability-migration-v1.json`) starts on this build against a catalog with an entry above capability API 1.816. Startup should log `Startup migration skipped <id> <version>, which this Engine cannot install` once, install every other compatible package, and write the `legacy` marker. It should not log "Optional package availability migration did not complete". - Manually verify that a second startup of that profile does not run the migration again: nothing is reinstalled, including a package you uninstalled in between. - Manually verify that with an incompatible Noodle entry in the catalog, startup leaves `noodle-extraction-migration-v1.json` absent and does not fail. After switching to a catalog whose Noodle entry is compatible, the next startup should install Noodle. - Manually verify that a skipped package can still be installed from the Agents browser once the Engine supports it, and that before that the manual install still refuses it with the existing 409 message. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) <!-- Add before/after screenshots or recordings for UI changes --> Not applicable: server-only startup behavior. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:40:15 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8859
No description provided.