# Carousel Dashboard Plan Verification Checklist Use this checklist to comprehensively audit the Carousel Dashboard Plan in a single pass. Each item includes verification steps to confirm accuracy. --- ## ⚠️ CLARIFICATION: Plan vs Checklist Discrepancies Resolved After thorough analysis, the following discrepancies have been resolved: ### 1. Preview Endpoint - **IS in the plan** - **Checklist concern**: "Missing Collection Preview Endpoint" - **Reality**: Endpoint is specified in **Phase 4.5** of the plan - **Why required**: Web UI custom section builder + future mobile apps need to preview filter rules before saving - **Location**: `internal/handlers/collections.go` - `PreviewCollection` method - **Route**: POST `/api/collections/preview` - **Documentation**: Explained in Phase 4.5 why client-side preview is a bad idea ### 2. Custom Section Builder - **IS in the plan** - **Checklist concern**: "Missing Custom Builder sections 10.5.2 and 10.5.3" - **Reality**: Both sections exist in the plan: - **10.5.2**: Custom Section Builder Template (`templates/custom_section.templ`) - **10.5.3**: Custom Section Builder TypeScript (`web/src/custom-section-builder.ts`) - This is a major feature with 13+ filter fields ### 3. Service Method Names - **Plan is correct** - **Checklist expects**: `GetSectionItems`, `filterHiddenSections`, `reorderSections` - **Plan implements**: `GetDashboardSections`, `filterHiddenCollections`, `reorderCollections` - **Plan names are better**: More descriptive, uses "collections" terminology consistently - **Action taken**: Updated checklist to match plan's actual method names ### 4. Config Struct Updates - **Documented with line numbers** - **Concern**: "Touching Config breaks dozens of functions" - **Reality**: Only 3 files need updates, all with exact line numbers specified: - `internal/router/router.go` line 58-59 - `cmd/server/main.go` lines 123-124, 172-173 - `cmd/server/tests/test_helpers.go` lines 419-420, 458-459 - **18 router functions** accept `*Config` but don't need changes (just receive pointer) ### 5. DashboardService in Config - **Why both Service and Handler?** - **DashboardService**: Used by SSR routes (frontend.go) for data fetching - **DashboardHandler**: Used by API routes (dashboard.go) for JSON endpoints - **Mobile apps**: Will use DashboardHandler - **Web UI**: Uses both (SSR via Service, interactions via Handler) --- ## ⚠️ CRITICAL DISTINCTION: Type Duplication **Before using this checklist, understand this important guideline:** ### ❌ UNACCEPTABLE: Duplicate Go Types ```go // WRONG: Creating duplicate types in Go templates package package templates type SectionData struct { ... } // DON'T DO THIS - duplicates handlers.SectionData ``` ### ✅ ACCEPTABLE: TypeScript Type Recreation (MUST BE COMPLETE) ```typescript // OKAY: Recreating types in TypeScript .d.ts files // Go's pgtype fields cannot auto-convert, so manual recreation is necessary // CRITICAL: Must include ALL fields from Go handler (no partial types) interface SectionData { id: string; // matches Go's json:"id" is_system: boolean; // matches Go's json:"is_system" (was "type" string) title: string; // matches Go's json:"title" description: string; // matches Go's json:"description" icon: string; // matches Go's json:"icon" items: BookInfo[]; // matches Go's json:"items" view_all_url: string; // matches Go's json:"view_all_url" priority: number; // matches Go's json:"priority" } // All 8 fields from Go struct included - COMPLETE TYPE MATCHING interface BookInfo { media_item_id: string; // matches Go's json:"media_item_id" (NOT "id") title: string; // matches Go's json:"title" author: string; // matches Go's json:"author" cover_image_path: string; // matches Go's json:"cover_image_path" } // All 4 fields from Go struct included - COMPLETE TYPE MATCHING ``` ### ❌ UNACCEPTABLE: Partial TypeScript Types ```typescript // WRONG: TypeScript interface with only subset of Go fields (breaks type safety) interface SectionData { id: string; type: string; // WRONG: should be is_system: boolean title: string; items: BookInfo[]; // Missing: description, icon, view_all_url, priority // This is a PARTIAL type and violates type safety guidelines } // WRONG: Using wrong field name for BookInfo interface BookInfo { id: string; // WRONG: should be media_item_id title: string; author: string; cover_image_path: string; } ``` **Key Points:** - **In Go**: Templates MUST use `handlers.*` types directly (no duplication) - **In TypeScript**: `.d.ts` files recreate **complete** handler JSON structure (all fields) - **Reason**: Go's `pgtype.Text`, `pgtype.UUID`, etc. don't map cleanly to TypeScript - **Type Safety**: Partial TypeScript types break type safety and can cause runtime errors - **Verification**: Field counts must match (Go struct has N fields = TypeScript has N fields) This checklist enforces **NO Go duplication** while **requiring complete TypeScript duplication**. --- ## 1. Prerequisites Verification ### 1.1 Verify TypeScript Conversion Plan Completed **Before starting Carousel Dashboard:** - [ ] TypeScript Conversion Plan (20-25.5 days) is fully completed - [ ] All infrastructure modules exist in `web/src/`: - [ ] `api.ts` - Centralized API client with auth - [ ] `toast.ts` - Toast notification system - [ ] `events.ts` - Event delegation utilities - [ ] `storage.ts` - localStorage wrapper - [ ] `dom.ts` - DOM utilities (escapeHtml, etc.) - [ ] `types/api.d.ts` - Type definitions for all API responses - [ ] Event delegation pattern established (data attributes) - [ ] TypeScript compilation pipeline working (`npm run build:ts`) - [ ] All inline JavaScript removed from templates - [ ] Progressive enhancement maintained across all features **Verification Commands:** ```bash # Verify TypeScript modules exist ls -la web/src/{api,toast,events,storage,dom}.ts # Verify type definitions exist ls -la web/src/types/api.d.ts # Verify build works npm run build:ts # Check for remaining inline JavaScript rg '