Skip to content

SQLite storage layer #13202

Closed as not planned
Closed as not planned

Description

@florianleibert

Task: SQLite storage layer

Description

Create the SQLite storage layer for the quality monitoring system using bun:sqlite. This includes database initialization, schema creation, migrations, CRUD operations for responses and regressions, query helpers for aggregations, and automatic retention cleanup.

Acceptance Criteria

  • packages/opencode/src/quality/store.ts created with full SQLite wrapper
  • Database initialized at configurable path (default .opencode/quality.db)
  • responses table with columns: id, session_id, model_id, provider_id, timestamp, prompt_hash, response_hash, composite_score, correctness_score, feedback_score, analysis_score, diagnostic_notes (JSON), is_collaborative, tokens_input, tokens_output, cost
  • regressions table with columns: id, response_id, detected_at, score_delta, severity, component, description
  • Indexes on: responses(session_id), responses(model_id), responses(timestamp), regressions(severity)
  • CRUD operations: insertResponse, updateResponseScore, insertRegression, getResponsesBySession, getResponsesByModel, getRecentResponses(limit)
  • Aggregation queries: getModelAverages, getRollingAverage(windowSize), getScoreTrend(days)
  • Retention cleanup: deleteOlderThan(days) runs on DB init
  • Schema version tracking for future migrations
  • Graceful error handling — DB failures logged, never crash main workflow

Technical Details

  • Use bun:sqlite (built-in, zero dependencies)
  • Use Database class from bun:sqlite with WAL mode for performance
  • Store DB path resolved relative to project directory via Instance.directory
  • Follow existing Instance.state() pattern for per-project DB lifecycle
  • Create packages/opencode/src/quality/schema.ts with Zod schemas for type safety on insert/query results

Dependencies

  • None — this is a foundation task

Effort Estimate

  • Size: M
  • Hours: 6-8
  • Parallel: true

Activity

  1. github-actions commented on Feb 11, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • This issue uses a custom "Task" format instead of one of the three required templates: Bug Report, Feature Request, or Question
    • Every issue must use one of these standard templates for consistent triage and processing

    Please edit this issue to follow one of the required templates within 2 hours, or it will be automatically closed.

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. github-actions commented on Feb 11, 2026

    @github-actions
    Contributor

    This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

    Feel free to open a new issue that follows our issue templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

needs:complianceThis means the issue will auto-close after 2 hours.

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions