[PR #1409] [CLOSED] Restore lorebook No Vector parity #5075

Closed
opened 2026-10-22 04:12:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1409
Author: @Xelvanis
Created: 5/27/2026
Status: ❌ Closed

Base: refactor ← Head: fix/1333-lorebook-no-vector


📝 Commits (6)

  • 8c8e8dd Restore lorebook no-vector parity
  • 8fddd25 Address no-vector review findings
  • 7cf0151 Address lorebook no-vector review feedback
  • f7a31c2 Merge refactor into lorebook no-vector parity
  • dec8867 Merge latest refactor into lorebook no-vector parity
  • 9dc1496 Merge refactor into lorebook no-vector parity

📊 Changes

7 files changed (+292 additions, -24 deletions)

View changed files

📝 src-tauri/src/commands/storage/prompts.rs (+122 -11)
📝 src-tauri/src/commands/storage/shared.rs (+8 -0)
➕ src/engine/contracts/schemas/lorebook.schema.test.ts (+16 -0)
📝 src/engine/contracts/types/lorebook.ts (+1 -1)
➕ src/engine/generation-core/lorebooks/keyword-scanner.test.ts (+85 -0)
📝 src/features/catalog/lorebooks/components/LorebookEditor.tsx (+59 -12)
📝 src/features/catalog/lorebooks/types.ts (+1 -0)

📄 Description

Linked issue

Closes https://github.com/Pasta-Devs/Marinara-Engine/issues/1333

Why this change

  • Restores legacy lorebook-level No Vector parity that was missing after the refactor.
  • The refactor had entry-level vector exclusion, but no top-level lorebook flag wired through contracts, editor state, storage defaults, prompt assembly, or Rust vectorization.

What changed

  • Adds excludeFromVectorization to lorebook contracts, schema defaults, update schema, and feature types.
  • Adds a lorebook-level No Vector toggle in the lorebook editor and blocks vectorization until unsaved No Vector changes are saved.
  • Makes prompt assembly treat every entry in a No Vector lorebook as excluded from semantic retrieval while keeping keyword matching available.
  • Makes Rust storage/vectorization normalize legacy bool-ish values and skip whole-lorebook vectorization when the lorebook No Vector flag is enabled.
  • Preserves the vectorization response contract so total means vectorizable entries and skipped includes excluded/already-vectorized entries.
  • Adds focused contract, keyword scanner, vectorization response, and Rust storage-default coverage.

Refactor impact

Primary owner:

Catalog lorebooks UI, engine lorebook contracts/generation, and Rust storage/vectorization commands.

Impact areas reviewed:

  • Lorebook editor save/load state and vectorization controls.
  • Lorebook contract schema and defaulting behavior.
  • Prompt assembly lorebook normalization before semantic retrieval.
  • Rust lorebook defaults and vectorize command behavior.
  • Keyword scanner behavior for lorebook-level vector exclusion.
  • Legacy string/number boolean handling for lorebook and lorebook-entry No Vector flags.

Boundary notes:

  • UI changes stay in src/features/catalog/lorebooks.
  • Contract and prompt behavior stay in src/engine.
  • Native persistence/vectorization behavior stays in src-tauri.
  • No new raw Tauri invoke sites or engine-to-feature imports were added.

Pressure points touched:

  • LorebookEditor save/load and vectorization controls.
  • prompt-assembly lorebook normalization.
  • Rust storage defaults and lorebook vectorization command path.

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

Validation run locally:

  • pnpm exec vitest run src/engine/contracts/schemas/lorebook.schema.test.ts src/engine/generation-core/lorebooks/keyword-scanner.test.ts
  • pnpm typecheck
  • pnpm check:architecture
  • cargo test --manifest-path src-tauri/Cargo.toml lorebook_defaults_include_vectorization_enabled
  • cargo test --manifest-path src-tauri/Cargo.toml vectorize_lorebook_ -- --nocapture
  • cargo test --manifest-path src-tauri/Cargo.toml storage_commands::custom_tools::tests::script_execution_type_returns_actionable_error -- --nocapture
  • cargo check --manifest-path src-tauri/Cargo.toml
  • pnpm build
  • cargo nextest run --manifest-path src-tauri/Cargo.toml --workspace --no-fail-fast was attempted locally; 137/138 tests passed, with the remaining unrelated Windows-only local failure blocked by missing symlink privilege in marinara-assets tests::rejects_paths_that_escape_root_through_symlinked_directory.

Native Tauri QA:

  • Launched a separate QA app profile with Tauri dev.
  • Created a new lorebook from the lorebooks panel.
  • Opened the lorebook editor, toggled lorebook-level No Vector on, and observed the semantic vectorization section switch to a save-first warning while the lorebook was dirty.
  • Saved the lorebook and observed the semantic vectorization section switch to the disabled-by-lorebook No Vector message.
  • Confirmed the persisted lorebook row has excludeFromVectorization: true.

Not covered:

  • A real configured embeddings-provider vectorization run was not exercised.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

No docs files were changed. This checkout does not currently have a CHANGELOG.md.

UI evidence

  • Native Tauri QA was performed locally; no screenshot artifact is attached to this PR.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/1409 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/27/2026 **Status:** ❌ Closed **Base:** `refactor` ← **Head:** `fix/1333-lorebook-no-vector` --- ### 📝 Commits (6) - [`8c8e8dd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8c8e8dd9efeb6d5f627cb6f44f83825f74136afd) Restore lorebook no-vector parity - [`8fddd25`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8fddd2507af0409b081be4202914cf37818829e1) Address no-vector review findings - [`7cf0151`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7cf0151c113e391b8fb3d0d9e030493dd78b5f06) Address lorebook no-vector review feedback - [`f7a31c2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f7a31c2d659934733ab4b984ee8c077f771dc813) Merge refactor into lorebook no-vector parity - [`dec8867`](https://github.com/Pasta-Devs/Marinara-Engine/commit/dec88674494146f00c274e63797e9e99a112cf44) Merge latest refactor into lorebook no-vector parity - [`9dc1496`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9dc1496a9b7c0da9ef1fee6359d5941ed1944318) Merge refactor into lorebook no-vector parity ### 📊 Changes **7 files changed** (+292 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/prompts.rs` (+122 -11) 📝 `src-tauri/src/commands/storage/shared.rs` (+8 -0) ➕ `src/engine/contracts/schemas/lorebook.schema.test.ts` (+16 -0) 📝 `src/engine/contracts/types/lorebook.ts` (+1 -1) ➕ `src/engine/generation-core/lorebooks/keyword-scanner.test.ts` (+85 -0) 📝 `src/features/catalog/lorebooks/components/LorebookEditor.tsx` (+59 -12) 📝 `src/features/catalog/lorebooks/types.ts` (+1 -0) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue <!-- Every user-facing PR should reference a feature request or issue report when practical. --> Closes https://github.com/Pasta-Devs/Marinara-Engine/issues/1333 ## Why this change <!-- What user problem, bug, refactor goal, or maintenance need does this solve? --> - Restores legacy lorebook-level No Vector parity that was missing after the refactor. - The refactor had entry-level vector exclusion, but no top-level lorebook flag wired through contracts, editor state, storage defaults, prompt assembly, or Rust vectorization. ## What changed <!-- List the key changes in this PR. --> - Adds `excludeFromVectorization` to lorebook contracts, schema defaults, update schema, and feature types. - Adds a lorebook-level No Vector toggle in the lorebook editor and blocks vectorization until unsaved No Vector changes are saved. - Makes prompt assembly treat every entry in a No Vector lorebook as excluded from semantic retrieval while keeping keyword matching available. - Makes Rust storage/vectorization normalize legacy bool-ish values and skip whole-lorebook vectorization when the lorebook No Vector flag is enabled. - Preserves the vectorization response contract so `total` means vectorizable entries and `skipped` includes excluded/already-vectorized entries. - Adds focused contract, keyword scanner, vectorization response, and Rust storage-default coverage. ## Refactor impact Primary owner: <!-- Examples: app shell, catalog, chat mode, roleplay mode, game mode, runtime generation, world-state, shared API, engine generation, Rust storage, imports, remote runtime. --> Catalog lorebooks UI, engine lorebook contracts/generation, and Rust storage/vectorization commands. Impact areas reviewed: - Lorebook editor save/load state and vectorization controls. - Lorebook contract schema and defaulting behavior. - Prompt assembly lorebook normalization before semantic retrieval. - Rust lorebook defaults and vectorize command behavior. - Keyword scanner behavior for lorebook-level vector exclusion. - Legacy string/number boolean handling for lorebook and lorebook-entry No Vector flags. Boundary notes: <!-- Note engine/shared-api/feature/Rust/remote-runtime boundaries. Say "none" only if you checked. --> - UI changes stay in `src/features/catalog/lorebooks`. - Contract and prompt behavior stay in `src/engine`. - Native persistence/vectorization behavior stays in `src-tauri`. - No new raw Tauri invoke sites or engine-to-feature imports were added. Pressure points touched: <!-- Mention ModeSurface, GameSurface, shared mode UI, src-tauri/src/lib.rs command registration, or import modules if touched. --> - `LorebookEditor` save/load and vectorization controls. - `prompt-assembly` lorebook normalization. - Rust storage defaults and lorebook vectorization command path. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> - [x] `pnpm check` passes locally - [x] `pnpm typecheck` passes locally - [x] `pnpm build` passes locally - [x] `pnpm check:architecture` passes locally - [x] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [x] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app/runtime, step by step. If an AI agent filled this out, verify it yourself before ticking boxes. --> Validation run locally: - `pnpm exec vitest run src/engine/contracts/schemas/lorebook.schema.test.ts src/engine/generation-core/lorebooks/keyword-scanner.test.ts` - `pnpm typecheck` - `pnpm check:architecture` - `cargo test --manifest-path src-tauri/Cargo.toml lorebook_defaults_include_vectorization_enabled` - `cargo test --manifest-path src-tauri/Cargo.toml vectorize_lorebook_ -- --nocapture` - `cargo test --manifest-path src-tauri/Cargo.toml storage_commands::custom_tools::tests::script_execution_type_returns_actionable_error -- --nocapture` - `cargo check --manifest-path src-tauri/Cargo.toml` - `pnpm build` - `cargo nextest run --manifest-path src-tauri/Cargo.toml --workspace --no-fail-fast` was attempted locally; 137/138 tests passed, with the remaining unrelated Windows-only local failure blocked by missing symlink privilege in `marinara-assets tests::rejects_paths_that_escape_root_through_symlinked_directory`. Native Tauri QA: - Launched a separate QA app profile with Tauri dev. - Created a new lorebook from the lorebooks panel. - Opened the lorebook editor, toggled lorebook-level No Vector on, and observed the semantic vectorization section switch to a save-first warning while the lorebook was dirty. - Saved the lorebook and observed the semantic vectorization section switch to the disabled-by-lorebook No Vector message. - Confirmed the persisted lorebook row has `excludeFromVectorization: true`. Not covered: - A real configured embeddings-provider vectorization run was not exercised. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims No docs files were changed. This checkout does not currently have a `CHANGELOG.md`. ## UI evidence <!-- Add before/after screenshots or recordings for visible UI changes. --> - Native Tauri QA was performed locally; no screenshot artifact is attached to this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:12:59 +07:00
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#5075
No description provided.