mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1513] Legacy import leaves boolean/array lorebook-entry fields as strings, breaking editor display and activation logic #763
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#763
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 @Romuromylus on GitHub (May 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1513
Originally assigned to: @Romuromylus on GitHub.
Summary
After a legacy profile import, several lorebook-entry fields are stored as JSON-encoded strings instead of native types. This makes the entry editor display the wrong toggle state, and because one generation path uses raw truthiness, it can also change which entries activate.
What is wrong (confirmed on imported entry "NPC: Kafka", key "Kafka")
Read back via
storage_list { entity: "lorebook-entries" }:caseSensitive= "false" (string) (should be boolean)constant= "false" (string)locked= "false" (string)preventRecursion= "false" (string)excludeFromVectorization= "false" (string)selective= "true" (string),selectiveLogic= "and" (string)enabled= "true" (string)matchWholeWords= true (boolean) <- correctly normalizedcharacterFilterIds/characterTagFilters/additionalMatchingSources/activationConditions= "[]" (string, should be arrays)keys/secondaryKeys= arrays <- correctly normalizedAll 1492 entries in the dataset share this pattern.
Confirmed symptoms
"false"is truthy in JS, so the raw string reads as on. (Whole Words is correct becausematchWholeWordsis a real boolean.)true.prompt-assembly.tsuses aboolish()coercion andmakers.tsuses=== true, butkeyword-scanner.tsuses raw truthiness (if (entry.constant)at lines 454/508,.filter((a) => !a.entry.preventRecursion)at 552, and passescaseSensitiveraw at 479). With string"false"being truthy, the scanner can wrongly treat entries as constant and wrongly suppress recursion.Root cause
The legacy normalizer (
src-tauri/src/commands/storage/profile/legacy.rs) normalizes some fields (matchWholeWords,keys,secondaryKeys) but notcaseSensitive/constant/locked/preventRecursion/excludeFromVectorization/selective, and it does not decode the string-encoded array fields.Suggested fix
Normalize these boolean and array fields to native types during legacy import (the same treatment
matchWholeWordsalready gets). Optionally makekeyword-scanner.tscoerce defensively likeprompt-assembly.ts.Environment
refactor @
ef244c80, Windows 11, Tauri desktop (pnpm tauri dev).Found during smoke test #1484 (Heavy Data / Legacy / Import Pass). Project board: https://github.com/orgs/Pasta-Devs/projects/4
@Romuromylus commented on GitHub (May 29, 2026):
Fixed by #1518 (merged into
refactorasa9cc0827). Legacy import now coerces the lorebook-entry boolean and array fields to native types, so the entry editor reads the correct toggle state and the keyword scanner no longer misclassifies entries.