Skip to content

Tests for quality monitoring system #13206

Closed as not planned
Closed as not planned

Description

@florianleibert

Task: Tests for quality monitoring system

Description

Write comprehensive tests for all quality monitoring modules: store, scorer, collector, detector, logger, and the quality-stats command. Tests use bun test following existing project patterns. Focus on unit tests for each module and one integration test for the full scoring pipeline.

Acceptance Criteria

  • packages/opencode/test/quality/store.test.ts — SQLite CRUD, aggregation queries, retention cleanup, migration
  • packages/opencode/test/quality/scorer.test.ts — sub-score computation, composite weighting, weight normalization, partial scoring, edge cases (all zeros, all 100s, missing LSP data)
  • packages/opencode/test/quality/detector.test.ts — rolling average computation, severity classification, diagnostic reasoning generation, edge cases (< windowSize responses, first response)
  • packages/opencode/test/quality/logger.test.ts — log level filtering, rotation trigger, file I/O error handling
  • packages/opencode/test/quality/collector.test.ts — event subscription, signal aggregation, user feedback inference (revert, redo, edit-after-apply)
  • packages/opencode/test/quality/integration.test.ts — full pipeline: event → collector → scorer → store → detector → logger
  • All tests pass with bun test
  • No regressions in existing test suite

Technical Details

  • Use bun:test (describe, it, expect) following existing test patterns in packages/opencode/test/
  • Use in-memory SQLite database (:memory:) for store tests — fast and isolated
  • Mock event bus subscriptions for collector tests
  • Mock file I/O for logger tests
  • Integration test: create in-memory DB, simulate a sequence of scored responses, verify regression detection fires correctly
  • Test edge cases: empty DB, single response, exactly windowSize responses, score of 0, score of 100

Dependencies

  • All previous tasks (001-007) must be complete

Effort Estimate

  • Size: L
  • Hours: 8-10
  • Parallel: false (depends on all other tasks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions