Repository navigation
fix(novel): 删除大纲时不再重写派生记忆 - #87
Merged
Merged
Conversation
大纲快照不参与派生记忆重放。删除时只移除该快照,并按章号撤回时间线和伏笔记录,避免用章节快照覆盖手改的人物状态、认知和时间线。 Co-authored-by: darknessomi <darknessomi@users.noreply.github.com>
darknessomi
marked this pull request as ready for review
October 20, 2026 07:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
删除大纲会调用
deleteChapterSnapshots,其中无条件执行rebuildDerivedMemoryFromSnapshots。派生记忆重放不读取负数章号的大纲快照,结果是用全部章节快照重写:.novel/character-states.json.novel/cognition-state.json.novel/foreshadowing-tracker.json.novel/timeline.json手改或清理过的内容会被盖回去。没提取过的大纲也会触发这次重写。
改动
章节快照删除仍按章节快照全量重放。大纲快照(章号为负)改为:
人物状态和认知没有逐条来源,删除大纲时不再改这两个文件。
验证
npx vitest run src/lib/novel/timeline.spec.ts src/lib/novel/foreshadowing-ingest.spec.ts src/lib/novel/chapter-ingest.sync.test.ts src/lib/novel/delete-source-memory.spec.ts4 files, 39 tests passed. 补断言后重跑前三个文件:3 files, 25 tests passed。