refactor: remove Phase X terminology from source code comments

Remove planning document phase references from code comments:

app_test.go:
- Remove Phase 5 references from 8 test function comments

querier.go & queries.sql.go:
- Remove Phase 1, 2, 3, 4, 6 references from section headers
- Clean up week numbers (Weeks 5-6, Week 3-4, etc.)

queries.sql:
- Remove Phase 4 references from Kobo queries

kobo.go:
- Remove Phase 6 references from ContentId mapping comments

progress.go:
- Remove Phase 1 reference from route comment

media_scanner.go & media_scanner_library_type_test.go:
- Remove Phase 2 references from library type scanning comments

schema.sql:
- Remove Phase 1, 2, 3, 4, 5, 7 references from table/section comments
- Clean up: Format Detection, Progress Tracking, Device Registry,
  Sync Queue, Conflict Resolution, Reading History, Indexes, etc.

test_helpers.go:
- Remove Phase 6 reference from handler setup comment

These phase numbers were from internal planning documents and have no
meaning in the codebase. Removing them makes the code self-documenting.
This commit is contained in:
2026-02-13 21:50:29 -05:00
parent 80dcdfdd71
commit 2706ae52c1
9 changed files with 96 additions and 96 deletions
+23 -23
View File
@@ -119,14 +119,14 @@ CREATE TABLE IF NOT EXISTS media_items (
added_by_admin_id UUID REFERENCES users(id) ON DELETE SET NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
-- Universal Sync Format Detection (Phase 1)
-- Universal Sync Format Detection
format_group VARCHAR(20) NOT NULL DEFAULT 'reflowable',
format_mimetype VARCHAR(100),
is_reflowable BOOLEAN DEFAULT TRUE,
has_fixed_layout BOOLEAN DEFAULT FALSE,
total_characters BIGINT,
chapter_count INTEGER,
-- Kobo-Specific Metadata (Phase 4)
-- Kobo-Specific Metadata
entitlement_id VARCHAR(255) UNIQUE,
revision_number INTEGER DEFAULT 1,
kobo_content_id VARCHAR(255),
@@ -154,7 +154,7 @@ CREATE TABLE IF NOT EXISTS reading_progress (
total_pages INTEGER,
last_read_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
UNIQUE(media_item_id, user_id),
-- Universal Progress Tracking (Phase 1)
-- Universal Progress Tracking
percentage FLOAT CHECK (percentage >= 0 AND percentage <= 1),
character_offset BIGINT,
epubcfi TEXT,
@@ -167,7 +167,7 @@ CREATE TABLE IF NOT EXISTS reading_progress (
scroll_position_y FLOAT DEFAULT 0,
panel_number INTEGER,
reading_mode VARCHAR(20),
-- Device Sync Metadata (Phase 1)
-- Device Sync Metadata
last_sync_device VARCHAR(50),
last_sync_source VARCHAR(20),
last_sync_timestamp TIMESTAMP WITH TIME ZONE,
@@ -195,7 +195,7 @@ CREATE TABLE IF NOT EXISTS media_notes (
position VARCHAR(100), -- optional position (page:offset or CFI) for standalone notes
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
-- Location Enhancements (Phase 1)
-- Location Enhancements
percentage_location FLOAT,
character_start INTEGER,
character_end INTEGER,
@@ -217,7 +217,7 @@ CREATE TABLE IF NOT EXISTS media_highlights (
note_id UUID REFERENCES media_notes(id) ON DELETE SET NULL, -- optional associated note
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
-- Location Enhancements (Phase 1)
-- Location Enhancements
percentage_start FLOAT,
percentage_end FLOAT,
character_start INTEGER,
@@ -232,7 +232,7 @@ CREATE TABLE IF NOT EXISTS media_highlights (
);
-- ============================================
-- DEVICE REGISTRY (Phase 1)
-- DEVICE REGISTRY
-- ============================================
CREATE TABLE IF NOT EXISTS devices (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
@@ -252,7 +252,7 @@ CREATE TABLE IF NOT EXISTS devices (
);
-- ============================================
-- SYNC QUEUE FOR OFFLINE SUPPORT (Phase 1)
-- SYNC QUEUE FOR OFFLINE SUPPORT
-- ============================================
CREATE TABLE IF NOT EXISTS sync_queue (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
@@ -270,7 +270,7 @@ CREATE TABLE IF NOT EXISTS sync_queue (
);
-- ============================================
-- CONFLICT RESOLUTION (Phase 1)
-- CONFLICT RESOLUTION
-- ============================================
CREATE TABLE IF NOT EXISTS sync_conflicts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
@@ -286,7 +286,7 @@ CREATE TABLE IF NOT EXISTS sync_conflicts (
);
-- ============================================
-- KOBO SHELF MANAGEMENT (Phase 4)
-- KOBO SHELF MANAGEMENT
-- ============================================
CREATE TABLE IF NOT EXISTS kobo_shelves (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
@@ -304,7 +304,7 @@ CREATE INDEX IF NOT EXISTS idx_kobo_shelves_media_item_id ON kobo_shelves(media_
CREATE INDEX IF NOT EXISTS idx_kobo_shelves_shelf_name ON kobo_shelves(shelf_name);
-- ============================================
-- KOBO ENTITLEMENTS TRACKING (Phase 4)
-- KOBO ENTITLEMENTS TRACKING
-- ============================================
CREATE TABLE IF NOT EXISTS kobo_entitlements (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
@@ -329,7 +329,7 @@ CREATE INDEX IF NOT EXISTS idx_kobo_entitlements_entitlement_id ON kobo_entitlem
CREATE INDEX IF NOT EXISTS idx_kobo_entitlements_content_id ON kobo_entitlements(content_id);
-- ============================================
-- READING HISTORY (Phase 1)
-- READING HISTORY
-- ============================================
CREATE TABLE IF NOT EXISTS reading_history (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
@@ -386,7 +386,7 @@ CREATE INDEX IF NOT EXISTS idx_media_highlights_user_id ON media_highlights(user
CREATE INDEX IF NOT EXISTS idx_media_highlights_note_id ON media_highlights(note_id);
-- ============================================
-- NEW TABLE INDEXES (Phase 1)
-- NEW TABLE INDEXES
-- ============================================
-- Device registry indexes
@@ -404,22 +404,22 @@ CREATE INDEX IF NOT EXISTS idx_sync_conflicts_media_item_id ON sync_conflicts(me
CREATE INDEX IF NOT EXISTS idx_sync_conflicts_user_id ON sync_conflicts(user_id);
CREATE INDEX IF NOT EXISTS idx_sync_conflicts_status ON sync_conflicts(resolution_status);
-- Composite indexes for sync queue performance (Phase 7)
-- Composite indexes for sync queue performance
CREATE INDEX IF NOT EXISTS idx_sync_queue_device_status_priority ON sync_queue(device_id, status, priority ASC, created_at ASC);
CREATE INDEX IF NOT EXISTS idx_sync_queue_status_priority_created ON sync_queue(status, priority ASC, created_at ASC);
CREATE INDEX IF NOT EXISTS idx_sync_queue_device_created_at ON sync_queue(device_id, created_at DESC);
-- Composite indexes for reading progress performance (Phase 7)
-- Composite indexes for reading progress performance
CREATE INDEX IF NOT EXISTS idx_reading_progress_user_last_sync ON reading_progress(user_id, last_sync_timestamp DESC);
CREATE INDEX IF NOT EXISTS idx_reading_progress_media_last_sync ON reading_progress(media_item_id, last_sync_timestamp DESC);
CREATE INDEX IF NOT EXISTS idx_reading_progress_user_sync_source ON reading_progress(user_id, last_sync_source, last_sync_timestamp DESC);
-- Composite indexes for devices (Phase 7)
-- Composite indexes for devices
CREATE INDEX IF NOT EXISTS idx_devices_user_sync_enabled ON devices(user_id, sync_enabled, auto_sync);
CREATE INDEX IF NOT EXISTS idx_devices_user_type ON devices(user_id, device_type);
CREATE INDEX IF NOT EXISTS idx_devices_last_seen ON devices(last_seen DESC) WHERE sync_enabled = true;
-- Composite indexes for annotations (Phase 7)
-- Composite indexes for annotations
CREATE INDEX IF NOT EXISTS idx_media_notes_user_media ON media_notes(user_id, media_item_id);
CREATE INDEX IF NOT EXISTS idx_media_highlights_user_media ON media_highlights(user_id, media_item_id);
@@ -430,7 +430,7 @@ CREATE INDEX IF NOT EXISTS idx_reading_history_created_at ON reading_history(cre
CREATE INDEX IF NOT EXISTS idx_reading_history_user_device_created ON reading_history(user_id, device_id, created_at DESC);
-- ============================================
-- TRIGGER FUNCTIONS (Phase 1)
-- TRIGGER FUNCTIONS
-- ============================================
-- Update updated_at timestamp for devices
@@ -476,7 +476,7 @@ COMMENT ON COLUMN media_items.google_books_id IS 'Google Books identifier for in
-- - Highlights can have associated notes for detailed annotations
-- ============================================
-- PERFORMANCE OPTIMIZATION (Phase 7)
-- PERFORMANCE OPTIMIZATION
-- ============================================
-- NOTE: ALTER SYSTEM commands are commented out for sqlc compatibility.
-- These should be run manually by DBA or via init script:
@@ -513,7 +513,7 @@ COMMENT ON COLUMN media_items.google_books_id IS 'Google Books identifier for in
-- REINDEX TABLE CONCURRENTLY reading_progress;
-- ============================================
-- SYNC HELPER FUNCTIONS (Phase 1)
-- SYNC HELPER FUNCTIONS
-- ============================================
-- Detect format group based on mimetype and file path
@@ -680,7 +680,7 @@ END;
$$ LANGUAGE plpgsql;
-- ============================================
-- KOREADER SYNC FUNCTIONS (Phase 3)
-- KOREADER SYNC FUNCTIONS
-- ============================================
-- Bulk update progress from KOReader sync data
@@ -799,7 +799,7 @@ END;
$$ LANGUAGE plpgsql;
-- ============================================
-- PHASE 1: UNIVERSAL BOOK IDENTIFIERS (Week 1)
--: UNIVERSAL BOOK IDENTIFIERS
-- ============================================
-- Add universal identifier columns to media_items table
@@ -937,7 +937,7 @@ ALTER TABLE kobo_shelves ADD COLUMN IF NOT EXISTS collection_id UUID REFERENCES
ALTER TABLE kobo_shelves ADD COLUMN IF NOT EXISTS position_in_collection INTEGER;
-- ============================================
-- PHASE 6: UNLINKED BOOKS TRACKING (Week 3-4)
--: UNLINKED BOOKS TRACKING
-- ============================================
-- Create unlinked_books table to track books that couldn't be auto-matched