feat(storage): add read-only thread store doctor#899
Closed
luoye520ww wants to merge 2 commits into
Closed
Conversation
Collaborator
Author
|
This work is consolidated into #942, which combines the Thread Store Doctor, bounded backups, and schema write guard with one tested scope. Closing the duplicate to keep review focused. |
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.
Problem
Thread persistence spans metadata JSONL, event JSONL, a rebuildable SQLite index, and attachment files. Before this PR there was no read-only scanner that could distinguish missing, invalid, truncated, or mismatched artifacts.
Root cause
The store's normal read paths intentionally tolerate damaged records, which is useful for serving a session but insufficient for data-integrity diagnostics and later repair tooling.
Scope
This stacked PR adds the read-only scanner on top of #897. It does not repair, rewrite, compact, or migrate any user data.
Changes
ok,missing,truncated, orinvalidwithout exposing file contents.Safety
readonlyandfileMustExist.recoverable.Dependency
Depends on #897 (
feat(storage): define thread store doctor contract). After #897 merges, this branch should be rebased ontodevelopand the full test matrix rerun.Typecheck
Both passed after building the local extension workspace packages.
Tests
npm.cmd --prefix kun test -- tests/thread-store-diagnostics.test.ts tests/thread-store-doctor.test.tsResult: 2 files, 9 tests passed, including real temporary SQLite and attachment checks.
Actual validation
npm.cmd run lint,npm.cmd run build, and the Kun build all passed. Tests cover healthy JSONL, truncated final records, interior malformed records, invalid metadata, read-only behavior, SQLite path validation, and missing attachment content.Review performed
thread.jsonPR size
Follow-ups
Thread Store repair, backup, quota, and UI remain separate PRs.