mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #4421] Channel switch (main → staging) can leave stale source files that break the build #2400
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#2400
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?
Originally created by @kolacheee on GitHub (Aug 1, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4421
Originally assigned to: @Gunterlie on GitHub.
When a user switches from the stable channel (main) to staging, files that exist on main but were deleted on staging can persist in the working tree as untracked files. The build then fails because
tscpicks them up viainclude: ["src/**/*.ts"]and they reference types/enums that no longer exist on staging.The immediate trigger is
packages/shared/src/constants/chat-mode-capabilities.ts— present on main (whereChatModeincludesvisual_novel), deleted on staging via PR #4356. After a main→staging switch the file stays behind, andtscerrors on the stalevisual_novelkey:Why the file persists
On Windows,
git checkoutcan fail to delete individual files (antivirus scanner, Windows Search indexer, or another process briefly locking the file). Git may still report the checkout as successful (HEAD moves to the target) while the locked file remains as an untracked leftover.Once the file lingers,
start.batmakes the problem self-perpetuating: itsgit stash push -u(line 190) captures the untracked file before every update, andrestore_stashed_changesputs it back afterward — so the stale file survives every subsequent relaunch.The in-app updater (
updates.routes.ts) avoids this particular trap (itscreateUpdateStashuses--untracked-files=no), but neither update path runs any post-checkout cleanup to verify the working tree matches the target commit.Try it yourself
git checkout -b staging origin/staging).chat-mode-capabilities.ts(Windows file lock), the build fails with TS2353.start.bat— the file is stashed with-u, restored after the no-op update, and the build fails again.Suggested fix
After a successful channel-switch checkout (both
start.batandcheckoutOrCreateUpdateBranchinupdates.routes.ts), run a targeted cleanup of source directories:This removes untracked files in the source trees without touching user data, node_modules, or config files. A full
git clean -fdwould be too aggressive (could delete.env, data files, etc.), but scoping it topackages/*/srcis safe — those directories should only contain tracked source.An alternative (less targeted but more thorough): after any checkout that changes channels, compare
git ls-tree -r --name-only HEADagainst the working tree and remove files that exist locally but not in the target tree.