Skip to content

Tech Debt Backlog #31

@dean0x

Description

@dean0x

Tech Debt Backlog

Auto-maintained by /code-review. Items are added when pre-existing issues are found during code reviews.

How This Works

  • Issues found in code you didn't change are logged here
  • Each item links to the review that found it
  • Items are automatically removed when fixed
  • Check items off manually as you address them

Risk Legend

  • 🟢 Low risk - Safe, isolated change
  • 🟡 Medium risk - Requires careful testing, may have side effects
  • 🔴 High risk - Breaking changes possible, significant refactor, or risky dependencies
  • ⏸️ Deferred - Intentionally delayed due to risk/reward tradeoff

🎯 Pre-v0.4.0 Priorities

Decision: These items should be fixed BEFORE starting v0.4.0 (Task Resumption + Scheduling) to avoid compounding technical debt.

Rationale: v0.4.0 adds new database tables, event handlers, and timer-based execution. Fixing these patterns now prevents copying bad patterns into new code.

Priority Item Why Now? Status
P0 bootstrap() extraction v0.4.0 adds 2+ handlers + timer setup; 417 lines will balloon Fixed in PR #42
P1 findAll() pagination v0.4.0 adds 3 new tables; pattern needed before more unbounded queries Fixed in PR #43
P2 Timing-based test waits Scheduling tests are inherently timing-heavy; flaky test debt compounds Fixed — replaced with waitForEvent() / flushEventLoop() helpers

Deferred (OK to skip for v0.4.0)

  • EventBus any types - Large refactor, can live with it
  • resource-monitor mutable state - Isolated concern
  • Documentation line refs - Fix during v0.4.0 docs

Items

Architecture

  • 🟡 [architecture] src/services/handlers/query-handler.ts:88 - QueryHandler uses findAllUnbounded() as workaround
    → [Review: 2025-12-18](PR feat: add pagination to findAll() methods (P1 pre-v0.4.0) #43)
    Context: QueryHandler.handleTaskStatusQuery() needs all tasks but pagination was added to findAll(). Currently uses findAllUnbounded() to maintain behavior.
    Proper Solution: Add pagination support to TaskStatusQuery event and MCP TaskStatus tool. Allow limit/offset parameters to flow through the event system.
    Why Deferred: Scope creep for PR feat: add pagination to findAll() methods (P1 pre-v0.4.0) #43. Requires MCP interface changes and event schema updates.

  • 🟢 [architecture] src/implementations/task-repository.ts:255 - findByStatus() lacks pagination
    → [Review: 2025-12-21](PR feat: add pagination to findAll() methods (P1 pre-v0.4.0) #43)
    Context: findByStatus() returns all matching tasks without pagination. Could return thousands of tasks for common statuses like 'completed'.
    Proper Solution: Add limit/offset parameters like findAll(). Update findByStatus(status, limit?, offset?).
    Why Deferred: Scope creep for PR feat: add pagination to findAll() methods (P1 pre-v0.4.0) #43. Already documented in JSDoc that it's not paginated.

  • 🟢 [security] src/implementations/*-repository.ts - No input validation for pagination parameters
    → [Review: 2025-12-21](PR feat: add pagination to findAll() methods (P1 pre-v0.4.0) #43)
    Context: findAll(limit, offset) accepts any number without bounds validation. Could pass Number.MAX_SAFE_INTEGER or negative values.
    Proper Solution: Add MAX_LIMIT cap (e.g., 1000) and validate offset >= 0. Return error Result for invalid inputs.
    Why Deferred: Low priority - internal API, SQLite handles edge cases gracefully.

Documentation

  • 🟡 [documentation] docs/architecture/TASK_ARCHITECTURE.md - References outdated line numbers in source files
    Review: 2025-12-13
    Recommendation: Use function/class names instead of line numbers as references to avoid drift with code changes.
  • 🟡 [documentation] docs/TASK-DEPENDENCIES.md - Missing v3 migration documentation, outdated cycle detection reference
    Review: 2025-12-13
    Recommendation: Update database schema section for CHECK constraints. Correct cycle detection implementation reference.
  • ℹ️ [documentation] src/core/interfaces.ts:106 - Missing JSDoc for findByStatus() pagination consideration
    → ✅ Fixed in PR feat: add pagination to findAll() methods (P1 pre-v0.4.0) #43 - Added JSDoc explaining findByStatus() is not paginated
  • ℹ️ [documentation] src/implementations/dependency-repository.ts:489 - Stale findAll() JSDoc example
    → ✅ Fixed in PR feat: add pagination to findAll() methods (P1 pre-v0.4.0) #43 - Updated JSDoc to accurately describe pagination behavior

Tests

  • 🟡 [tests] tests/integration/*.test.ts - 40+ timing-based waits using setTimeout (flaky test risk)
    → ✅ Fixed — All setTimeout waits replaced with event-driven waitForEvent() / flushEventLoop() helpers across integration tests
  • 🟢 [tests] tests/unit/implementations/task-repository.test.ts - No unit test file for task-repository
    → ✅ Fixed in PR feat: add pagination to findAll() methods (P1 pre-v0.4.0) #43 - Added 10 unit tests for pagination, count, and unbounded methods
  • ℹ️ [tests] tests/fixtures/test-doubles.ts:289 - TestTaskRepository ordering differs from production
    → ✅ Fixed in PR feat: add pagination to findAll() methods (P1 pre-v0.4.0) #43 - Added sort by created_at DESC to match production behavior

Summary

Items Added This Review: 1 new architecture item from PR #43

  • Architecture: findByStatus() pagination (deferred, documented in JSDoc)

Items Fixed This Review: 5 items

  • P1: findAll() pagination ✅
  • Documentation: findByStatus() JSDoc ✅
  • Documentation: findAll() stale JSDoc ✅
  • Tests: task-repository unit tests ✅
  • Tests: TestTaskRepository ordering ✅

Current Open Items: 5 (3 architecture, 2 documentation)


Last updated: 2026-03-09
Updated: timing-based test waits verified fixed (zero setTimeout in integration tests)
Original: Issues #25, #28; ongoing code reviews

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtTechnical debt items tracked for future cleanup

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions