feat(storage): define thread store doctor contract#897
Closed
luoye520ww wants to merge 1 commit 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 currently has no stable diagnostic contract for reporting metadata, event log, SQLite index, and attachment health. Future doctor and repair code would otherwise invent incompatible result shapes.
Root cause
The hybrid store owns several persistence surfaces, but the runtime contracts only describe thread records and storage ports. There is no versioned, bounded result model for read-only health checks.
Scope
This PR adds the versioned
ThreadStoreDiagnosticcontract only. It does not scan, repair, migrate, or modify any user data.Changes
kun/contracts.Safety
Typecheck
Both passed after installing the locked dependencies in this isolated worktree.
Tests
npm.cmd --prefix kun test -- tests/thread-store-diagnostics.test.tsResult: 1 file, 4 tests passed.
Actual validation
The contract test exercises Zod parsing against a real diagnostic object, an empty report, invalid artifact/timestamp values, and extra fields.
npm.cmd --prefix kun run build,npm.cmd run lint, andnpm.cmd run buildalso passed.Review performed
PR size
Non-goals
Filesystem scanning, repair, backups, UI, and migration are separate follow-up PRs.
Issue
Part of the Thread Store Doctor work in the full engineering plan.