Skip to content

Conversation

@prosdev
Copy link
Contributor

@prosdev prosdev commented Dec 7, 2025

Overview

Implements the local persistence layer for document storage using SQLite as the System of Record, decoupled from Vector DB.

Architecture

  • System of Record pattern: SQLite stores extracted data, decoupled from Vector DB
  • Repository pattern: Dependency injection for testability
  • Lazy migrations: Graceful error handling for locked DB scenarios
  • Cross-platform: Uses XDG_DATA_HOME for data directory

Implementation

  • Drizzle ORM + better-sqlite3
  • Extracted functions (ensureDirectoryExists, getDbPath) for testability
  • Structured logging with @lytics/kero

Testing

  • ✅ 100% statement/function/line coverage
  • ✅ 92.85% branch coverage
  • ✅ 14 tests passing across 3 test files
  • ✅ Tests use tests directory structure
  • ✅ Mock logger and migrator for clean test output

Changes

  • New @doc-agent/storage package
  • DocumentRepository with save/get/list operations
  • Comprehensive test suite
  • Updated workflow documentation for commit preferences

Related

Implement the local persistence layer for document storage with comprehensive test coverage.

Architecture:
- System of Record pattern: SQLite stores extracted data, decoupled from Vector DB
- Repository pattern with dependency injection for testability
- Lazy migrations with graceful error handling
- XDG_DATA_HOME for cross-platform data directory

Implementation:
- Drizzle ORM + better-sqlite3
- Extracted functions (ensureDirectoryExists, getDbPath) for testability
- Structured logging with @lytics/kero

Testing:
- 100% statement/function/line coverage, 92.85% branch coverage
- Tests use __tests__ directory structure
- Mock logger and migrator for clean test output

Issue: #2
Clarify commit best practices with emphasis on atomic commits.

Changes:
- Add 'Atomic Commits (Always)' section emphasizing complete logical units
- Clarify that atomic ≠ small, atomic = complete logical unit
- Default to single commit for cohesive features (still atomic)
- Maintain guidance on when to split commits

Rationale:
- Atomic commits are always required (complete, reviewable, revertible)
- Cohesive features form one atomic unit
- Avoid artificial splitting while maintaining atomicity
- Fix formatting issues in drizzle.config.ts and snapshot.json
- Add full lint check to pre-commit hook (in addition to lint-staged)
- Ensures CI lint checks match local pre-commit checks
@prosdev prosdev merged commit f8fda31 into main Dec 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Foundation: SQLite Database Layer

2 participants