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#6484
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/4738
Author: @kolacheee
Created: 8/7/2026
Status: ✅ Merged
Merged: 8/8/2026
Merged by: @SpicyMarinara
Base:
staging← Head:feat/4708-downgrade-guard📝 Commits (10+)
6c98122wip(4708): downgrade guard - format file, launcher check-target, server 409 gatee6f225dMerge feat/4708-message-shards (review fixes) into feat/4708-downgrade-guard3141411feat(launcher): unshard escape hatch, docs, and format-guard regression7728f7fMerge feat/4708-message-shards (manifest-heal fix) into feat/4708-downgrade-guardad891b6fix(launcher): harden the downgrade guard and unshard after adversarial review2e2ec13Merge feat/4708-message-shards (stale-physical-shard fix) into feat/4708-downgrade-guardd141c9fMerge branch 'staging' into feat/4708-downgrade-guard269b8beMerge feat/4708-message-shards (review fixes + staging) into feat/4708-downgrade-guardc10af1efix(launcher): honor the check-target exit-code contract everywhere137ede3Merge remote feat/4708-downgrade-guard (maintainer branch update)📊 Changes
14 files changed (+1161 additions, -16 deletions)
View changed files
📝
CLAUDE.md(+4 -0)📝
Dockerfile(+3 -0)📝
Dockerfile.lite(+3 -0)📝
docs/TROUBLESHOOTING.md(+21 -0)📝
docs/UPGRADING.md(+6 -0)📝
package.json(+1 -1)📝
packages/server/src/routes/updates.routes.ts(+103 -1)📝
scripts/protect-launcher-data.mjs(+417 -8)➕
scripts/regressions/launcher-format-guard.regression.mjs(+513 -0)📝
start-termux.sh(+29 -3)📝
start.bat(+15 -0)📝
start.sh(+29 -3)➕
storage-format.json(+3 -0)📝
win/installer/install.bat(+14 -0)📄 Description
Linked issue
Part 2 of #4708 (intentionally not
Closes— the issue stays open for the remaining chat-keyed tables; see the checklist there).Why this change
What changed
storage-format.json(repo root, tracked): declares the storage format a checkout understands. The guard reads it off the target ref withgit show; absent (any ref predating this PR) means format 2. A regression pins it toSTORAGE_VERSIONinfile-backed-store.tsso a missed bump cannot silently disable the guard.scripts/protect-launcher-data.mjs check-target <ref>compares the on-diskstorage/manifest.jsonversion against the target ref's declared format; exits 2 with a[BLOCK]message on incompatible targets.start.sh,start-termux.sh, andstart.batrun it before the update snapshot (a blocked target stays blocked on every launch — snapshotting first would re-copy the whole data directory each time) and skip the auto-update instead of downgrading (fail-safe: any guard failure skips the update, never applies it). The Windows installer's update-over-existing-install path carries the same guard, blocking only on exit code 2 so an older checkout whose script predates the subcommand cannot break a legitimate upgrade. The storage-dir mirror honorsMARINARA_FILE_STORAGE_DIRandMARINARA_ENV_FILEwith the server's exact dotenv merge semantics, so the guard reads the same manifest the server would.updates.routes.tscarries a twin ofcheckTargetStorageFormatwith a kept-in-sync comment; the regression pins the pairing.node scripts/protect-launcher-data.mjs unshard(run with the server stopped) rebuilds the monolith layout from the shard files: reads everything before writing anything (fsync-before-rename writes), keeps every shard file in<table>.post-unshard-<timestamp>/, rewrites the manifest as format 2 so the guard unblocks, keeps a crashed migration's monolith authoritative, and refuses the ambiguous "monolith and shards both present, neither in progress" forked state rather than guessing a merge. A health-endpoint probe refuses to run while a server is answering (a live Marinara re-shards on its next save), and an interrupted run resumes under a shards-stay-authoritative rule — the same rule the store's own classifier applies — with any displaced monolith set aside as.pre-unshard-<timestamp>, never deleted. Both Docker images ship the script so the documented one-off-container recovery actually works.mari db unshardcommand. ThemariCLI turned out to be an HTTP forwarder to a running server — unusable here (a live sharded server re-shards on its next flush, and Docker/manual users may have no server at all), so the command lives in the offline launcher-data script instead.docs/TROUBLESHOOTING.mdsection ("Chats show no messages after switching to an older version" — the exact title every guard message points at) and a "Downgrading to an older version" section indocs/UPGRADING.md.CLAUDE.mddocuments thestorage-format.json↔STORAGE_VERSIONpairing rule (it is not aversion:syncfile).launcher-format-guardlane inregression:issues: format-file pairing, guard presence and guard-before-snapshot ordering in every entry point (source pins, including the installer and both Dockerfiles),SHARDED_TABLES/.migratingpairing pins between the script and the store source,checkTargetStorageFormatagainst a real git fixture repo (blocked / allowed / fresh-install cases), thecheck-targetCLI exit contract, env-mirror parity (alias + custom env file), and ten behavioral unshard cases (rebuild + ordering, dedup + bak-only recovery, crashed-migration, forked-state abort incl..bak-only monoliths, unreadable-shard abort, resumed-run shards-win semantics, live-server refusal). Plus, on the #4735 side: the store heals a lagging manifest version on startup, so a crash between the migration and its first flush cannot leave the guard trusting a stale format 2.The change went through an adversarial review workflow (3 specialist lenses, every finding independently re-verified against the code); 16 confirmed findings were fixed and regression-pinned before this PR was opened.
Coverage is honest, not universal: manual
git checkoutbypasses every guard, and a Docker tag switch is only protected by the store's own forward version gate (PR 1) — for both, the TROUBLESHOOTING steps are the recovery. The PR does not pretend otherwise.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
start.bat/start.shprint the[WARN] Skipping auto-update…line and boot the current version.node scripts/protect-launcher-data.mjs unshard, boot an older build, and confirm chats render; then boot the current build again and confirm the automatic re-migration.pnpm check(green, before and after the review-fix round),node scripts/regressions/launcher-format-guard.regression.mjs(green, including the resumed-run, live-server-refusal, and env-parity cases),launcher-env+launcher-updatelanes (green), message-sharding lane including the new manifest-heal pin (green),bash -non both shell launchers (clean).Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)docs/TROUBLESHOOTING.mdanddocs/UPGRADING.mdchanged → needs a[docs-i18n] docs/TROUBLESHOOTING.md docs/UPGRADING.mdfollow-up issue (will open one when this PR is submitted).Summary by CodeRabbit
New Features
Bug Fixes
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.