[PR #2207] [MERGED] Restore lorebook schedule missing-state compatibility #5469

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2207
Author: @Promansis
Created: 6/4/2026
Status: ✅ Merged
Merged: 6/4/2026
Merged by: @Promansis

Base: refactor ← Head: issue-2183-lorebook-legacy-gates


📝 Commits (2)

  • 73e6d1c Restore permissive lorebook game-state gates
  • 897c399 Preserve strict lorebook condition gates

📊 Changes

1 file changed (+25 additions, -17 deletions)

View changed files

📝 src/engine/generation-core/lorebooks/keyword-scanner.ts (+25 -17)

📄 Description

Linked issue

Closes #2183

Why this change

  • Lorebook schedule gates drifted from the documented compatibility decision when game state or a relevant schedule field was absent.
  • Review also caught a high-risk regression where missing game state satisfied activation conditions. Condition gates should remain fail-closed unless a future condition operator explicitly documents missing-tolerant behavior.

What changed

  • Schedule gates now skip absent or blank time, date, and location fields, while present mismatching schedule fields still block activation.
  • Activation condition gates now preserve absence as failure when the game-state object is missing or the referenced field is absent/blank.
  • Shared value normalization remains local to the React-free lorebook scanner.

Refactor impact

Primary owner:

  • Engine generation / lorebook keyword scanner.

Impact areas reviewed:

  • Prompt assembly lorebook activation.
  • Active World Info scan output.
  • Scanner preview and debug scan behavior using the shared scanner.
  • Agent and knowledge-router scanner callers.

Boundary notes:

  • Change stays in React-free src/engine/generation-core/lorebooks/keyword-scanner.ts.
  • No React, shared API, Tauri, Rust, or remote-runtime boundary changes.

Pressure points touched:

  • None; no ModeSurface, GameSurface, shared mode UI, command registration, or import modules touched.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • Fresh scratch Vitest proof on the current rebased branch passed locally, then the scratch test file was removed before handoff to keep the PR within the repo rule against submitting *.test.ts proof files:
    • command: pnpm exec vitest run src/engine/generation-core/lorebooks/keyword-scanner.scratch.test.ts
    • result: 1 test file passed, 3 tests passed
    • rows covered: null game state fails condition-gated entry; missing referenced field fails condition-gated entry; populated matching field activates the entry
  • Earlier scratch proof also covered that missing schedule state remains permissive while present schedule mismatch still blocks.
  • pnpm typecheck passed locally after rebasing onto upstream refactor.
  • No browser proof run because the changed behavior is in the shared React-free engine scanner.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Compatibility bugfix in existing lorebook scanning behavior; no new user-discoverable surface.

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

UI evidence

  • N/A; no visible UI change.

🔄 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/2207 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 6/4/2026 **Status:** ✅ Merged **Merged:** 6/4/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `refactor` ← **Head:** `issue-2183-lorebook-legacy-gates` --- ### 📝 Commits (2) - [`73e6d1c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/73e6d1c4a607f30ebf686b968869eef8d7c8780a) Restore permissive lorebook game-state gates - [`897c399`](https://github.com/Pasta-Devs/Marinara-Engine/commit/897c399b866f3c73c1a3173b0b6b0f5f632c91f5) Preserve strict lorebook condition gates ### 📊 Changes **1 file changed** (+25 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation-core/lorebooks/keyword-scanner.ts` (+25 -17) </details> ### 📄 Description ## Linked issue Closes #2183 ## Why this change - Lorebook schedule gates drifted from the documented compatibility decision when game state or a relevant schedule field was absent. - Review also caught a high-risk regression where missing game state satisfied activation conditions. Condition gates should remain fail-closed unless a future condition operator explicitly documents missing-tolerant behavior. ## What changed - Schedule gates now skip absent or blank `time`, `date`, and `location` fields, while present mismatching schedule fields still block activation. - Activation condition gates now preserve absence as failure when the game-state object is missing or the referenced field is absent/blank. - Shared value normalization remains local to the React-free lorebook scanner. ## Refactor impact Primary owner: - Engine generation / lorebook keyword scanner. Impact areas reviewed: - Prompt assembly lorebook activation. - Active World Info scan output. - Scanner preview and debug scan behavior using the shared scanner. - Agent and knowledge-router scanner callers. Boundary notes: - Change stays in React-free `src/engine/generation-core/lorebooks/keyword-scanner.ts`. - No React, shared API, Tauri, Rust, or remote-runtime boundary changes. Pressure points touched: - None; no ModeSurface, GameSurface, shared mode UI, command registration, or import modules touched. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - Fresh scratch Vitest proof on the current rebased branch passed locally, then the scratch test file was removed before handoff to keep the PR within the repo rule against submitting `*.test.ts` proof files: - command: `pnpm exec vitest run src/engine/generation-core/lorebooks/keyword-scanner.scratch.test.ts` - result: 1 test file passed, 3 tests passed - rows covered: null game state fails condition-gated entry; missing referenced field fails condition-gated entry; populated matching field activates the entry - Earlier scratch proof also covered that missing schedule state remains permissive while present schedule mismatch still blocks. - `pnpm typecheck` passed locally after rebasing onto upstream `refactor`. - No browser proof run because the changed behavior is in the shared React-free engine scanner. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Compatibility bugfix in existing lorebook scanning behavior; no new user-discoverable surface. ## 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 ## UI evidence - N/A; no visible UI change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:16:36 +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#5469
No description provided.