mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #1637] [MERGED] Normalize lorebook-entry fields at the generic storage boundary #5169
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#5169
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/1637
Author: @Romuromylus
Created: 5/30/2026
Status: ✅ Merged
Merged: 5/30/2026
Merged by: @Romuromylus
Base:
refactor← Head:fix/normalize-lorebook-entry-storage📝 Commits (3)
af430a3Normalize lorebook-entry fields at the generic storage boundary089f776Allow null relationships/dynamicState on lorebook-entry round-tripd7edbc8Add negative-control test for unparseable lorebook-entry object field📊 Changes
1 file changed (+133 additions, -1 deletions)
View changed files
📝
src-tauri/src/commands/storage/shared.rs(+133 -1)📄 Description
Why this change
Follow-up to #1571 (related to but not a duplicate of #1513). #1513 fixed legacy lorebook-entry import normalization, but the generic storage write boundary stayed loosely typed: the
lorebook-entriesarm ofnormalize_typed_json_fieldsonly normalizedkeysandsecondaryKeys. Any caller that bypassed the legacy import path (the editor, bulk create, copy/move/reorder, tool-generated entries, remote runtime) could still handenabled: "false",constant: "true",keys: "[\"moon\"]", or a JSON-string object across the boundary and rely on downstream UI/generation to guess the intended shape.normalize_typed_json_fieldsis the single contract both write paths cross:storage_createthroughwith_entity_defaults, andstorage_updatethroughnormalize_update_patch. Strengthening that one arm closes the gap for every generic caller at once.What changed
src-tauri/src/commands/storage/shared.rs: extend thelorebook-entriesarm to normalize the full native record shape:enabled,constant,selective,matchWholeWords,caseSensitive,useRegex,preventRecursion,locked,excludeFromVectorization) via the existingnormalize_boolish_fields,characterFilterIds,characterTagFilters,generationTriggerFilters,additionalMatchingSources,activationConditions) alongsidekeys/secondaryKeys,relationships/dynamicStateobjects and the nullablescheduleobject.Verification
cargo clippy --workspace --all-targets -- -D warningsclean.The end-user write paths reach this boundary through generic
storage_create/storage_update, fully covered by the new unit tests against the real normalization function.Known caveat: numeric fields
Numeric lorebook-entry fields (
probability,scanDepth,position,depth,order,sticky,cooldown,delay,ephemeral,groupWeight) are intentionally left untouched. There is no numeric-coercion primitive at this boundary today and the legacy contract never covered them, so adding one is out of scope for this fix. If a malformed numeric caller ever appears it warrants a dedicated follow-up with its own primitive.Linked issue
Closes #1571.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.