mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6899
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5720
Author: @kolacheee
Created: 9/1/2026
Status: ✅ Merged
Merged: 9/1/2026
Merged by: @kolacheee
Base:
staging← Head:fix/5645-5646-update-apply-hardening📝 Commits (2)
d3518eafix(updates): harden update-apply against dev instances and PowerShell (#5645, #5646)2456748fix(updates): close the review gaps in the update-apply hardening📊 Changes
10 files changed (+293 additions, -14 deletions)
View changed files
📝
.env.example(+4 -0)📝
CHANGELOG.md(+2 -0)📝
docs/CONFIGURATION.md(+1 -0)📝
e2e/start-servers.mjs(+3 -0)📝
packages/client/src/components/panels/SettingsPanel.tsx(+14 -4)📝
packages/server/src/config/runtime-config.ts(+16 -0)📝
packages/server/src/routes/updates.routes.ts(+80 -9)📝
packages/server/src/services/updates/update-apply-policy.ts(+16 -1)📝
scripts/dev.mjs(+7 -0)➕
scripts/regressions/update-apply-hardening.regression.ts(+150 -0)📄 Description
Linked issue
Closes #5645, closes #5646.
Why this change
Two failure modes on the update-apply surface, both hit by real people this week. #5646: the loopback channel-switch bypass is right for real installs, but dev and e2e servers boot from the developer's working repo — so one click of the channel selector in any local tab could stash uncommitted work, move HEAD to
staging, and force-rebuild the checkout underneath running Playwright sessions (this actually happened, wedging two e2e boots and silently switching the branch mid-development). #5645: the manual-update fallback those refusals point at was one long&&/||chain — Windows PowerShell 5.1, the default shell for exactly the testers the staging channel targets, rejects it with parser errors and runs nothing; the command also assumed the terminal was already sitting in the repo checkout, which many users can't find.What changed
#5646 — two independent guards, both refusing before the ordinary gate:
UPDATES_APPLY_DISABLED— a hard refusal checked ahead ofUPDATES_APPLY_ENABLEDand the loopback channel-switch bypass.scripts/dev.mjssets it (coveringpnpm devand, transitively, the e2e servers, which spawndev.mjs), ande2e/start-servers.mjssets it belt-and-braces. Documented indocs/CONFIGURATION.mdand.env.example.main/master/stagingrefuses to apply, protecting contributors who boot the server by other means. Detached checkouts stay allowed — the stable launcher pins them deliberately, andgit branch --show-currentyields empty →nullthere, verified.applyUnavailableReasonvalues (hard-disabled,dev-branch) with honest Settings-panel copy — no more "enable it withUPDATES_APPLY_ENABLED=true" advice for an instance that must never apply — and the check route previews the branch refusal so the panel never offers an Apply that would 403.#5645 — the manual command is now a complete recipe:
cdinto the server-detected repo root (cd /d "…"on Windows so it crosses drive letters;cd "…"elsewhere) — the server runs from the checkout, so it always knows the path the user may not.&&chains") on Windows, for both the staging apply command and the stable launcher command.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
pnpm lintand the production build are green locally;format:checkfails repo-wide on this Windows checkout (pre-existing autocrlf CRLF; touched files were run through Prettier directly).scripts/regressions/update-apply-hardening.regression.tspasses: the policy matrix (hard-disable beats the enabled flag and the channel-switch bypass; both legacy paths preserved), branch classification (incl. detached-nullstaying allowed), thecd-prefixed recipe on Windows and POSIX, the shell hint, and source pins on the launcher envs, the refuse-before-gate ordering, and the client copy.getCurrentBranchreturnsnullon detached HEAD (git branch --show-currentprints empty), so stable pinned installs are unaffected; the early 403 returns sit inside the route'stry, so theupdateApplyInProgressflag is released by the existingfinally.||let a failed leadingcdfall through intogit checkout -b+ install + build executed in whatever directory the user was standing in (pre-existing in shape; the newcdprefix made it urgent), and that the.envhot-reloader could lift the launcher-set hard-disable after boot (now latched at boot). Residual exposure recorded, not fixed, by design: a server booted directly (pnpm --filter server dev,node dist) from a checkout sitting onmain/stagingis indistinguishable from a legitimate tester install — the env flag covers the launchers and the branch guard covers named feature branches.pnpm devfrom a feature branch with uncommitted changes, open the app at localhost, and switch the update channel — it should refuse with the dev-instance message andgit status/git stash listshould be untouched (the issue's own repro).Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)CHANGELOG updated under [Unreleased] → Fixed;
docs/CONFIGURATION.mdgained theUPDATES_APPLY_DISABLEDrow — it rides the pending batched[docs-i18n]catch-up together with #5604 (planned as the closing PR of this issue arc).UI evidence (if applicable)
The two new refusal messages in Settings → Advanced → Updates are the visible change.
Summary by CodeRabbit
Bug Fixes
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.