[GH-ISSUE #1411] [Issue]: Lorebook vectorization misses secondary key parity #700

Closed
opened 2026-10-20 17:32:02 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Xelvanis on GitHub (May 27, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1411

Originally assigned to: @Xelvanis on GitHub.

## Summary

Refactor lorebook vectorization missed staging parity for secondary lorebook keys and lorebook-level vectorization exclusion.

Expected behavior

Lorebook vectorization should build embedding input from an entry's primary keys and secondary keys, including imported legacy aliases such as secondary_keys and keysecondary. If a lorebook record has excludeFromVectorization: true, the vectorization command should skip the whole book before calling the embedding provider.

Actual behavior

The refactor native vectorization helper only used keys, so secondary-key trigger text was not included in embedding input. It also only honored per-entry excludeFromVectorization, so a lorebook-level exclusion could still attempt provider vectorization.

Steps to reproduce

  1. Create or import a lorebook entry with primary keys plus secondary keys, including legacy/staging shapes such as secondaryKeys, secondary_keys, or keysecondary.
  2. Run the refactor lorebook_vectorize command for that lorebook.
  3. Inspect the embedding input behavior or semantic matching coverage for the secondary-key terms.
  4. Set excludeFromVectorization: true on the lorebook record and run vectorization again.

Impact area

  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor before branch fix/lorebook-secondary-key-vector-parity
  • Run mode: Tauri/native command path
  • OS + version: Not captured
  • Node + pnpm versions: Not relevant
  • Rust version, if relevant: Not captured
  • Remote Runtime URL configured? Not relevant
  • Provider, model, or integration, if relevant: Any embedding provider configured for lorebook vectorization

Logs, screenshots, or video

No user logs or screenshots. This was identified through refactor-vs-staging code comparison and reproduced with focused Rust command/helper tests on the fix branch.

Regression notes

Staging builds lorebook embedding text from primary and secondary keys and skips all entries when the lorebook has excludeFromVectorization: true.

Additional context

Fix branch: fix/lorebook-secondary-key-vector-parity.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Xelvanis on GitHub (May 27, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1411 Originally assigned to: @Xelvanis on GitHub. ## Summary Refactor lorebook vectorization missed staging parity for secondary lorebook keys and lorebook-level vectorization exclusion. ## Expected behavior Lorebook vectorization should build embedding input from an entry's primary keys and secondary keys, including imported legacy aliases such as `secondary_keys` and `keysecondary`. If a lorebook record has `excludeFromVectorization: true`, the vectorization command should skip the whole book before calling the embedding provider. ## Actual behavior The refactor native vectorization helper only used `keys`, so secondary-key trigger text was not included in embedding input. It also only honored per-entry `excludeFromVectorization`, so a lorebook-level exclusion could still attempt provider vectorization. ## Steps to reproduce 1. Create or import a lorebook entry with primary keys plus secondary keys, including legacy/staging shapes such as `secondaryKeys`, `secondary_keys`, or `keysecondary`. 2. Run the refactor `lorebook_vectorize` command for that lorebook. 3. Inspect the embedding input behavior or semantic matching coverage for the secondary-key terms. 4. Set `excludeFromVectorization: true` on the lorebook record and run vectorization again. ## Impact area - [x] Catalog resources - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [ ] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `refactor` before branch `fix/lorebook-secondary-key-vector-parity` - Run mode: Tauri/native command path - OS + version: Not captured - Node + pnpm versions: Not relevant - Rust version, if relevant: Not captured - Remote Runtime URL configured? Not relevant - Provider, model, or integration, if relevant: Any embedding provider configured for lorebook vectorization ## Logs, screenshots, or video No user logs or screenshots. This was identified through refactor-vs-staging code comparison and reproduced with focused Rust command/helper tests on the fix branch. ## Regression notes Staging builds lorebook embedding text from primary and secondary keys and skips all entries when the lorebook has `excludeFromVectorization: true`. ## Additional context Fix branch: `fix/lorebook-secondary-key-vector-parity`. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:32:02 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (May 27, 2026):

Addressed directly on refactor in 7eb42c13. Lorebook vectorization now builds embedding text from primary keys plus canonical secondaryKeys and legacy aliases secondary_keys/keysecondary, and lorebook-level excludeFromVectorization returns a successful no-op before any embedding provider call. Validated with cargo test --manifest-path src-tauri/Cargo.toml lorebook --lib, git diff --check, and pnpm check.

<!-- gh-comment-id:4555170504 --> @SpicyMarinara commented on GitHub (May 27, 2026): Addressed directly on refactor in 7eb42c13. Lorebook vectorization now builds embedding text from primary keys plus canonical secondaryKeys and legacy aliases secondary_keys/keysecondary, and lorebook-level excludeFromVectorization returns a successful no-op before any embedding provider call. Validated with cargo test --manifest-path src-tauri/Cargo.toml lorebook --lib, git diff --check, and pnpm check.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#700
No description provided.