Files
SubMiner/backlog/tasks/task-179 - Tune-immersion-tracker-SQLite-pragmas-and-maintenance-defaults.md
sudacode 48f10dbb03 chore(backlog): maintain task backlog and add changelog fragments
- Move completed tasks (85, 117, 118, 155) to backlog/completed/
- Delete superseded task files (166 verification, 172 drilldown)
- Add stats dashboard milestone m-1
- Add new tasks (190, 194)
- Update task metadata across remaining backlog items
- Add changelog fragments for stats, mpv args, and subtitle filtering
2026-03-18 02:25:07 -07:00

59 lines
2.5 KiB
Markdown

---
id: TASK-179
title: Tune immersion tracker SQLite pragmas and maintenance defaults
status: Done
assignee:
- codex
created_date: '2026-03-17 15:15'
updated_date: '2026-03-18 05:28'
labels:
- sqlite
- immersion-tracking
- performance
dependencies: []
documentation:
- >-
/Users/sudacode/projects/japanese/SubMiner/docs/plans/2026-03-17-sqlite-tuning.md
priority: medium
ordinal: 111500
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Apply low-risk SQLite tuning improvements for the immersion tracker: add modern recommended maintenance/tuning pragmas where appropriate, cover them with regression tests, and update user-facing docs to reflect the actual tuning policy. Scope limited to low-risk local-DB changes already discussed: keep WAL + synchronous=NORMAL, add optimize path, consider WAL growth control, and document workload-dependent knobs left at defaults.
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Immersion tracker applies the agreed low-risk SQLite tuning changes without regressing current behavior
- [x] #2 Regression tests cover the new pragma/maintenance behavior
- [x] #3 Immersion tracking docs describe the tuning policy and notable defaults left unchanged
<!-- AC:END -->
## Implementation Plan
<!-- SECTION:PLAN:BEGIN -->
1. Add regression coverage for connection pragmas and verify the new WAL growth cap fails before implementation.
2. Add regression coverage for maintenance-time PRAGMA optimize and verify the test fails before implementation.
3. Implement the minimal SQLite tuning changes.
4. Update immersion-tracking docs for the new tuning policy.
5. Run targeted SQLite verification lanes and record results.
<!-- SECTION:PLAN:END -->
## Implementation Notes
<!-- SECTION:NOTES:BEGIN -->
Verification: `bun test src/core/services/immersion-tracker/storage-session.test.ts src/core/services/immersion-tracker/maintenance.test.ts` passed (15 tests).
Verification: `bun run test:immersion:sqlite:src` passed (37 tests).
Verification: `bun run typecheck`, `bun run docs:test`, `bun run docs:build`, `bun run test:fast`, `bun run test:env`, and `bun run build` all passed.
<!-- SECTION:NOTES:END -->
## Final Summary
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Added low-risk SQLite tuning improvements for the immersion tracker: `journal_size_limit` now bounds WAL growth, periodic maintenance runs `PRAGMA optimize`, regression tests cover both behaviors, and the immersion-tracking docs explain the maintained pragmas plus workload-dependent defaults left unchanged.
<!-- SECTION:FINAL_SUMMARY:END -->