Based on consolidated PR review, address the following in Type Safety & Validation:
chunk_type Is Unvalidated str Despite Closed Set in Schema: At src/context_library/storage/models.py:98, chunk_type: str = "standard" accepts any string, while schema.sql:63 enforces CHECK (chunk_type IN ('standard', 'oversized', 'table_part', 'code', 'table')). Invalid values pass Pydantic but fail at SQLite with confusing IntegrityError. Should be Literal[...] or enum.
CandidateChunk TypedDict Uses total=False When All Fields Are Always Present: At src/context_library/domains/notes.py:15, total=False makes all fields optional, but every construction site includes all five fields. This weakens the type contract unnecessarily.
ChunkVector.chunk_hash Uses Plain str Instead of Sha256Hash: At src/context_library/storage/vector_store.py:32, the join key between LanceDB and SQLite lacks the Sha256Hash validation applied elsewhere. A malformed hash would silently create orphaned vector records.
Created by PR Review Stage - Consolidation Phase
Concurrent Fix Issues (Same Review Cycle)
The following issues are being fixed simultaneously in this review cycle. Check these issues for any files they modify before making your own changes to avoid introducing conflicts:
Based on consolidated PR review, address the following in Type Safety & Validation:
chunk_typeIs UnvalidatedstrDespite Closed Set in Schema: Atsrc/context_library/storage/models.py:98,chunk_type: str = "standard"accepts any string, whileschema.sql:63enforcesCHECK (chunk_type IN ('standard', 'oversized', 'table_part', 'code', 'table')). Invalid values pass Pydantic but fail at SQLite with confusingIntegrityError. Should beLiteral[...]or enum.CandidateChunkTypedDict Usestotal=FalseWhen All Fields Are Always Present: Atsrc/context_library/domains/notes.py:15,total=Falsemakes all fields optional, but every construction site includes all five fields. This weakens the type contract unnecessarily.ChunkVector.chunk_hashUses PlainstrInstead ofSha256Hash: Atsrc/context_library/storage/vector_store.py:32, the join key between LanceDB and SQLite lacks theSha256Hashvalidation applied elsewhere. A malformed hash would silently create orphaned vector records.Created by PR Review Stage - Consolidation Phase
Concurrent Fix Issues (Same Review Cycle)
The following issues are being fixed simultaneously in this review cycle. Check these issues for any files they modify before making your own changes to avoid introducing conflicts: