[PR #4373] [MERGED] fix(capabilities): require refresh after client updates #6351

Closed
opened 2026-10-23 04:09:36 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4373
Author: @thetopham
Created: 7/31/2026
Status: ✅ Merged
Merged: 8/1/2026
Merged by: @thetopham

Base: staging ← Head: fix/capability-client-refresh-4372


📝 Commits (4)

  • 768db07 fix(capabilities): require refresh after client updates
  • 5fbe43e docs(capabilities): clarify refresh state
  • aff14f8 Merge remote-tracking branch 'origin/staging' into fix/capability-client-refresh-4372
  • 3a13435 fix(capabilities): serialize client version imports

📊 Changes

6 files changed (+292 additions, -29 deletions)

View changed files

📝 package.json (+1 -1)
📝 packages/client/src/components/capabilities/CapabilityElement.tsx (+110 -20)
📝 packages/client/src/hooks/use-capability-packages.ts (+80 -8)
➕ packages/client/src/lib/capability-client-version.ts (+31 -0)
📝 packages/client/src/localization/locales/en.json (+4 -0)
➕ scripts/regressions/capability-client-version-refresh.regression.ts (+66 -0)

📄 Description

Closes #4372

Why this change

An already-open browser tab cannot replace a registered custom-element constructor when a downloaded capability package updates. Marinara imported the new module and reported it as ready, but continued rendering the old client implementation until the user happened to refresh the page. This made World Maps 1.2.3 appear to be missing its shared-world Game Setup action even though the installed and served artifact contained it.

What changed

  • Preserve the version of capability client code that is actually registered for the lifetime of the page, including across restart-required package states.
  • Detect a newer ready package when the previous version's custom element is still registered.
  • Serialize in-flight client imports per package/version so an older pending import cannot race a newly installed version.
  • When an older import settles after a newer version is observed, require refresh if its custom element registered; otherwise retry the latest installed client.
  • Block the stale interface and show a localized Refresh now state instead of reporting the new module as ready.
  • Add focused regression coverage for old, current, fresh-page, unregistered-element, and overlapping-import version combinations.

Validation

  • pnpm check
  • focused capability-client version/import race regression
  • pnpm localization:check
  • git diff --check

Manual verification

  • Update a client-capability package while its previous version is loaded and verify its surfaces show Refresh now rather than stale UI.
  • Refresh and verify the newly installed client UI loads without another refresh prompt.
  • Complete a restart-required client package update, restart Marinara Engine, and verify the same refresh state appears.
  • Verify a first-time package install loads normally without an unnecessary refresh prompt.

🔄 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/4373 **Author:** [@thetopham](https://github.com/thetopham) **Created:** 7/31/2026 **Status:** ✅ Merged **Merged:** 8/1/2026 **Merged by:** [@thetopham](https://github.com/thetopham) **Base:** `staging` ← **Head:** `fix/capability-client-refresh-4372` --- ### 📝 Commits (4) - [`768db07`](https://github.com/Pasta-Devs/Marinara-Engine/commit/768db0728ea2613b3da2cfbda3d7dd6404c1cae4) fix(capabilities): require refresh after client updates - [`5fbe43e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5fbe43edc40ba68c64a4bf282bf78bf2836d1cad) docs(capabilities): clarify refresh state - [`aff14f8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/aff14f8a6ffc9921664d8ab89e6c7f5a83720909) Merge remote-tracking branch 'origin/staging' into fix/capability-client-refresh-4372 - [`3a13435`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3a134353807456938dd9de4de2a1254f0678ee77) fix(capabilities): serialize client version imports ### 📊 Changes **6 files changed** (+292 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `package.json` (+1 -1) 📝 `packages/client/src/components/capabilities/CapabilityElement.tsx` (+110 -20) 📝 `packages/client/src/hooks/use-capability-packages.ts` (+80 -8) ➕ `packages/client/src/lib/capability-client-version.ts` (+31 -0) 📝 `packages/client/src/localization/locales/en.json` (+4 -0) ➕ `scripts/regressions/capability-client-version-refresh.regression.ts` (+66 -0) </details> ### 📄 Description Closes #4372 ## Why this change An already-open browser tab cannot replace a registered custom-element constructor when a downloaded capability package updates. Marinara imported the new module and reported it as ready, but continued rendering the old client implementation until the user happened to refresh the page. This made World Maps 1.2.3 appear to be missing its shared-world Game Setup action even though the installed and served artifact contained it. ## What changed - Preserve the version of capability client code that is actually registered for the lifetime of the page, including across restart-required package states. - Detect a newer ready package when the previous version's custom element is still registered. - Serialize in-flight client imports per package/version so an older pending import cannot race a newly installed version. - When an older import settles after a newer version is observed, require refresh if its custom element registered; otherwise retry the latest installed client. - Block the stale interface and show a localized **Refresh now** state instead of reporting the new module as ready. - Add focused regression coverage for old, current, fresh-page, unregistered-element, and overlapping-import version combinations. ## Validation - `pnpm check` - focused capability-client version/import race regression - `pnpm localization:check` - `git diff --check` ## Manual verification - [ ] Update a client-capability package while its previous version is loaded and verify its surfaces show **Refresh now** rather than stale UI. - [ ] Refresh and verify the newly installed client UI loads without another refresh prompt. - [ ] Complete a restart-required client package update, restart Marinara Engine, and verify the same refresh state appears. - [ ] Verify a first-time package install loads normally without an unnecessary refresh prompt. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:09:36 +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#6351
No description provided.