Skip to content

[PR Feedback] Type Safety & Validation #69

Description

@tinkermonkey

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions