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#1883
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 (Jul 11, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3483
Originally assigned to: @kolacheee on GitHub.
Summary
Nested lorebook folders shipped in #2602, but the shared type contract still says folders are flat, one import path still flattens them, and the Mari CLI silently drops folder placement. This is the exact failure class behind #3348: an agent read a stale "folders are flat" comment and shipped code that flattened nested folders on import.
Why this is a problem: comments and type contracts are what agents (and new contributors) treat as ground truth. A false "flat folders" contract sitting in the shared types is a loaded gun for the next lorebook PR.
What it negatively affects: user data (folder structure is silently lost on legacy profile import and on Mari-CLI entry edits) and future agent work on the lorebook subsystem.
Expected behavior
Comments describe nesting truthfully, and every import/write path preserves
parentFolderId/folderId.Actual behavior
packages/shared/src/types/lorebook.ts:86and:112— JSDoc says "Folders are flat in v1 —parentFolderIdis reserved for future nested-folder support and must currently be null" and "Always null in v1; the server rejects non-null values." Both claims are false today:lorebooks.routes.ts:752-759accepts and validates a non-null parent on create, and:768-773re-parents with cycle/self-parent checks viacanReparentFolder. Suggested replacement: "parentFolderIdnests folders; the server validates the parent exists and rejects cycles (see lorebook-folder-tree.ts)."packages/server/src/routes/backup.routes.ts:2107— the legacy (pre-snapshot) branch ofPOST /import-profilebuilds afolderIdMapbut hardcodesparentFolderId: nullwhen creating folders, so nested folders silently flatten when importing an older backup. The correct two-pass parent remap exists ~60 lines below for preset groups (2164-2192) and is never applied to lorebook folders.packages/server/src/services/mari-db/mari-db.service.ts:1901—mari lorebook add-entry/update-entrynever read or assignfolderId(a real nullable FK), so folder placement is silently dropped, with no warning, when entries are managed through the Mari CLI.Steps to reproduce
lorebook.ts:86with the create/patch handlers atlorebooks.routes.ts:752.Environment
45b650de9)Logs, screenshots, or video
N/A — file/line references above point at the exact code.
Additional context
Related history: #2602 (nested folders), #3348 (the earlier flattening regression this class of stale comment caused). Found by a repo-wide read-only sweep for dead code and stale comments; every entry above was adversarially re-verified against the code before filing. No fix has been started — filing for triage. Part of a coordinated set of sweep catalogue issues filed together.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: