[PR #3998] [MERGED] Fix Windows launcher ERR_INVALID_URL_SCHEME in run-directly guards #6191

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3998
Author: @SpicyMarinara
Created: 7/23/2026
Status: ✅ Merged
Merged: 7/23/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/3997-launcher-windows-entry-guard


📝 Commits (1)

  • ed4b7ea Fix Windows launcher crash in run-directly guards

📊 Changes

4 files changed (+39 additions, -4 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 scripts/protect-launcher-data.mjs (+4 -2)
📝 scripts/read-launcher-env.mjs (+4 -2)
📝 scripts/regressions/launcher-update.regression.mjs (+30 -0)

📄 Description

Linked issue

Fixes #3997

Why this change

On Windows, restarting Marinara from a fresh staging checkout crashed the launcher's update-snapshot step with ERR_INVALID_URL_SCHEME from protect-launcher-data.mjs:161, and the launcher then skipped auto-update to protect user data. The run-directly guard built its comparison URL with new URL(process.argv[1], "file:") — a Windows path like D:\Users\... has its drive prefix parsed as the URL scheme, so the file: base is ignored and fileURLToPath throws on the resulting d: URL at module load. read-launcher-env.mjs carried the same latent pattern.

What changed

  • Both run-directly guards now compare import.meta.url === pathToFileURL(process.argv[1]).href — pathToFileURL is the drive-letter-safe conversion.
  • The launcher-update regression lane now asserts the pathToFileURL guard shape in both scripts, fails if the new URL(process.argv...) pattern is reintroduced, and executes protect-launcher-data.mjs directly to prove the guard reaches main() without a URL-scheme crash.
  • CHANGELOG entry under Unreleased → Fixed.

This is the fix alone; no behavior changes beyond the guard evaluation.

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

Manual verification notes

  • Manually verify on Windows: restart the launcher on staging and confirm "Checking for updates..." proceeds to a created/skipped snapshot message with no ERR_INVALID_URL_SCHEME, and auto-update is no longer skipped.
  • Manually verify Get-Content .env-driven launcher settings still resolve (read-launcher-env.mjs path) on Windows.

pnpm check, regression:issues-adjacent launcher lanes (launcher-env, launcher-update) were run by the preparing agent and passed on macOS; the Windows behavior itself needs the manual check above. The boxes are left for the human contributor per repository policy.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

CHANGELOG.md updated; no version bump.

UI evidence

No UI changes — launcher console output only.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed a Windows launcher crash caused by drive-letter paths being misinterpreted as URL schemes.
    • Restored launcher snapshot creation and prevented affected auto-update checks from being skipped.
  • Tests

    • Added regression coverage to verify direct launcher execution works correctly on Windows-style paths.

🔄 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/3998 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/23/2026 **Status:** ✅ Merged **Merged:** 7/23/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/3997-launcher-windows-entry-guard` --- ### 📝 Commits (1) - [`ed4b7ea`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ed4b7ea52e97b719e5574dce429809e0adbd6e4e) Fix Windows launcher crash in run-directly guards ### 📊 Changes **4 files changed** (+39 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `scripts/protect-launcher-data.mjs` (+4 -2) 📝 `scripts/read-launcher-env.mjs` (+4 -2) 📝 `scripts/regressions/launcher-update.regression.mjs` (+30 -0) </details> ### 📄 Description ## Linked issue Fixes #3997 ## Why this change On Windows, restarting Marinara from a fresh staging checkout crashed the launcher's update-snapshot step with `ERR_INVALID_URL_SCHEME` from `protect-launcher-data.mjs:161`, and the launcher then skipped auto-update to protect user data. The run-directly guard built its comparison URL with `new URL(process.argv[1], "file:")` — a Windows path like `D:\Users\...` has its drive prefix parsed as the URL *scheme*, so the `file:` base is ignored and `fileURLToPath` throws on the resulting `d:` URL at module load. `read-launcher-env.mjs` carried the same latent pattern. ## What changed - Both run-directly guards now compare `import.meta.url === pathToFileURL(process.argv[1]).href` — `pathToFileURL` is the drive-letter-safe conversion. - The launcher-update regression lane now asserts the `pathToFileURL` guard shape in both scripts, fails if the `new URL(process.argv...)` pattern is reintroduced, and executes `protect-launcher-data.mjs` directly to prove the guard reaches `main()` without a URL-scheme crash. - CHANGELOG entry under Unreleased → Fixed. This is the fix alone; no behavior changes beyond the guard evaluation. ## 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` ### Manual verification notes - Manually verify on Windows: restart the launcher on staging and confirm "Checking for updates..." proceeds to a created/skipped snapshot message with no `ERR_INVALID_URL_SCHEME`, and auto-update is no longer skipped. - Manually verify `Get-Content .env`-driven launcher settings still resolve (read-launcher-env.mjs path) on Windows. `pnpm check`, `regression:issues`-adjacent launcher lanes (`launcher-env`, `launcher-update`) were run by the preparing agent and passed on macOS; the Windows behavior itself needs the manual check above. The boxes are left for the human contributor per repository policy. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) CHANGELOG.md updated; no version bump. ## UI evidence No UI changes — launcher console output only. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Fixed a Windows launcher crash caused by drive-letter paths being misinterpreted as URL schemes. * Restored launcher snapshot creation and prevented affected auto-update checks from being skipped. * **Tests** * Added regression coverage to verify direct launcher execution works correctly on Windows-style paths. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:07:59 +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#6191
No description provided.