mirror of
https://github.com/bilalmk/todo_correct.git
synced 2026-09-19 06:05:23 +08:00
main
10 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8b43aa04bd |
feat(009-chatkit-frontend): Phase III chatbot UX enhancements and SSE fixes (#9)
* feat(009-chatkit-frontend): implement chatbot popup UI and event system Completed Phase 2 (Foundational) and Phase 3 (User Story 1): Phase 2 (Foundational - T004-T008): - T004: ChatKit integration (building custom interface, no CDN SDK) - T005: Custom event system for task synchronization - T006: ChatKit configuration with custom fetch interceptor - T007: API proxy route with JWT extraction and SSE streaming - T008: Enhanced TaskContext to emit task events Phase 3 (User Story 1 - T013-T018): - T013: Created FloatingChatButton component with animations - T014: Created ChatBotPopup wrapper with shadcn/ui Dialog - T015: Integrated chatbot into dashboard with event listener (T046) - T016: Added Framer Motion animations (<300ms) - T017: Configured z-index layering (FAB z-40, Dialog z-50) - T018: Added accessibility attributes (aria-label, role) Key files: - frontend/src/lib/events/task-events.ts (event system) - frontend/src/lib/chatkit-config.ts (ChatKit config) - frontend/src/app/api/chatkit/route.ts (API proxy) - frontend/src/components/chat/FloatingChatButton.tsx - frontend/src/components/chat/ChatBotPopup.tsx - frontend/src/app/dashboard/page.tsx (integrated chatbot) Real-time sync: Chatbot events → Dashboard refresh via CustomEvent Security: JWT extraction in API proxy (httpOnly cookies) UX: Orange/coral theme, smooth animations, accessible Next: Phase 4 (US5 Security), Phase 5 (US4 Streaming) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat(009-chatkit-frontend): implement chat interface with SSE streaming Completed Phase 5 (User Story 4 - Streaming AI Responses) and partial Phase 6 (User Story 2): Phase 5 (US4 - T033-T040): - T033: Created ChatInterface component with SSE streaming support - T034: Created MessageList component with streaming state and typing indicator (T038) - T035: Created MessageInput component with auto-resize and keyboard shortcuts - T036: Integrated ChatInterface into ChatBotPopup (dashboard) - T037: SSE streaming already implemented in API proxy (T007) - T038: Added typing indicator with animated loader and cursor - T039: Implemented exponential backoff retry (1s, 2s, 4s) in sendMessage - T040: Added error banner with manual retry button Phase 6 (US2 - T046-T050) - Already Complete: - T046: TaskEvent listener already in dashboard (from Phase 3) - T047: Dashboard refresh logic already implemented (from Phase 3) - T048: Tool call result event handling in ChatInterface - T049: TaskEvent emission using createTaskEventFromTool helper - T050: Success confirmation UI with checkmark icons in MessageList Key Features: - SSE streaming: Fetch API with ReadableStream for real-time responses - MCP tool integration: Parse tool.call.result events and emit TaskEvents - Real-time sync: Chatbot task operations update dashboard within 1s - Error handling: Auto-retry with exponential backoff + manual retry - Streaming UX: Typing indicator, progressive content rendering, cursor animation - Security: JWT authentication via API proxy, session validation - Accessibility: ARIA labels, keyboard shortcuts (Enter/Shift+Enter) Architecture: - ChatInterface manages state and SSE streaming - MessageList displays messages with tool call indicators - MessageInput handles user input with validation - Events flow: MCP tool result → TaskEvent → Dashboard refresh Files: - frontend/src/components/chat/ChatInterface.tsx (SSE + MCP) - frontend/src/components/chat/MessageList.tsx (UI + typing) - frontend/src/components/chat/MessageInput.tsx (input + shortcuts) - frontend/src/app/dashboard/page.tsx (integration) Next: Phase 7 (US3 History), Phase 8 (US6 Animations), Phase 9 (Errors), Phase 10 (Polish) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat(009-chatkit-frontend): implement conversation history with pagination Completed Phase 7 (User Story 3 - Persistent Conversation History): Phase 7 (US3 - T056-T060): - T056: Configured pagination with limit=50, order=desc - T057: Implemented loadConversationHistory() with useEffect on mount - T058: Added "Load earlier messages" button with loading state - T059: Implemented loadMoreMessages() handler with pagination logic - T060: Added loading states (isLoadingHistory, isLoadingMore) with spinner UI Frontend Implementation Complete: - Conversation state management (conversationId, currentPage, hasMoreMessages) - loadConversationHistory(): Loads user's persistent conversation on mount - loadMoreMessages(): Fetches older messages with pagination (page, limit) - Loading indicators: Spinner in "Load earlier" button during fetch - Ready for backend integration Backend API Endpoints Required (placeholders in code): - GET /api/v1/{user_id}/conversations - Get user's single conversation - GET /api/v1/{user_id}/conversations/{conversation_id}/messages?page={page}&limit=50 - Paginated message history Architecture: - Each user has single persistent conversation (per spec) - Backend creates conversation on first message if none exists - Frontend loads conversation history on chatbot open - Pagination: 50 messages per page, descending order (newest first) - Messages prepended to list when loading older history Files Modified: - frontend/src/components/chat/ChatInterface.tsx (history logic) - frontend/src/components/chat/MessageList.tsx (pagination UI) - specs/009-chatkit-frontend/tasks.md (marked T056-T060 complete) Testing: - T061: Deferred - requires backend conversation history API Next: Phase 8 (Animations - mostly done), Phase 9 (Error handling), Phase 10 (Polish) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat(009-chatkit-frontend): add prefers-reduced-motion accessibility support Completed Phase 8 (User Story 6 - Smooth Popup Animations): Phase 8 (US6 - T065-T068): - T065: Animation timing already optimized (250ms content, 200ms backdrop) - from Phase 3 - T066: AnimatePresence wrapper already implemented - from Phase 3 - T067: Backdrop fade animation already synchronized - from Phase 3 - T068: Added prefers-reduced-motion detection for accessibility ✅ NEW T068 Implementation: - Added prefers-reduced-motion detection using window.matchMedia - ChatBotPopup: Disables all animations (content + backdrop) if user prefers reduced motion - FloatingChatButton: Disables spring animations and hover/tap effects if user prefers reduced motion - Fallback: duration: 0 for instant transitions (no animation) - useMemo optimization: Only check media query once on mount Accessibility: - Respects user's OS-level motion preferences - WCAG 2.1 Level AA compliance (Success Criterion 2.3.3 - Animation from Interactions) - Users with vestibular disorders can use chatbot without motion sickness - Instant transitions (no animation) when prefers-reduced-motion is enabled Animation Performance (already achieved in Phase 3): - Content animation: 250ms (below 300ms threshold per FR-012) - Backdrop animation: 200ms (synced with content) - AnimatePresence: mode="wait" prevents animation stacking - easeOut easing for smooth deceleration Files Modified: - frontend/src/components/chat/ChatBotPopup.tsx (prefers-reduced-motion detection) - frontend/src/components/chat/FloatingChatButton.tsx (prefers-reduced-motion detection) - specs/009-chatkit-frontend/tasks.md (marked T065-T068 complete) Testing: - T069: Manual testing with DevTools Performance tab (requires user validation) Next: Phase 9 (Error handling), Phase 10 (Polish & accessibility) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat(009-chatkit-frontend): implement Phase 9 error handling and edge cases **What**: Comprehensive error handling for all edge cases identified in spec.md **Implementation**: 1. **ErrorBoundary.tsx** (T070): - React error boundary pattern to catch errors in chat components - Prevents chat errors from crashing entire dashboard - Fallback UI with retry/reload options - Error logging with stack traces for debugging 2. **ErrorState.tsx** (T071): - Reusable error UI components for different error types: - RateLimitError: Countdown timer from Retry-After header - AuthError: 3-second countdown before redirect to sign-in - TimeoutError: Cancel/Keep Waiting options - NetworkError: Connection lost with retry button - BackendUnavailable: 502/503 errors with correlation ID - UnknownError: Generic fallback with correlation ID - All components follow contracts/error-messages.yaml specifications 3. **ChatInterface.tsx** (T072-T077): - T072: Rate limit handling (429 → countdown → clear error when done) - T073: Network error handling (exponential backoff 1s/2s/4s already implemented) - T074: Auth error handling (401 → 3s countdown → redirect to /auth/signin) - T075: Timeout handling (AbortController + 10s threshold → dialog) - T076: Correlation ID logging (already in chatkit-config.ts) - T077: Partial message indicator (interrupted stream → incomplete flag) - Enhanced sendMessage with error state integration - Timeout handlers: handleCancelRequest, handleKeepWaiting - Cleanup of timeout/abort refs on error 4. **MessageList.tsx** (T077): - Added metadata fields: complete, interrupted - Incomplete indicator UI (yellow alert icon + message) - Displays "Response interrupted (partial message)" for cancelled streams **Architecture**: - Specialized error components replace generic error banner - Countdown timers managed with useEffect intervals - AbortController for cancellable fetch requests - Error states conditionally rendered based on error type - Graceful degradation for all error scenarios **UX Impact**: - Users see helpful, specific error messages instead of generic failures - Rate limits show countdown before retry is allowed - Auth errors redirect automatically after countdown - Timeouts give users choice to cancel or keep waiting - Partial responses preserved and marked as incomplete - All errors include context and recovery options **Compliance**: - Follows contracts/error-messages.yaml for all error types - FR-020: Correlation ID logging throughout - Error handling doesn't block other features - Users never see raw error messages or stack traces **Phase 8 Note**: Also committing PHR 0013 from Phase 8 (prefers-reduced-motion accessibility) **Tasks**: T070-T077 complete Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat(009-chatkit-frontend): implement Phase 10 core polish (T078b, T078c, T079, T085) **What**: Log sanitization, mobile responsive design, and security audit **Implementation**: 1. **T078b: Log Sanitization Utility** (frontend/src/lib/logging/sanitize.ts): - Truncate content fields to 50 chars with "[...]" suffix - Redact JWT tokens (replace with "[REDACTED_TOKEN]") - Redact PII fields (email, phone, address, SSN, credit card) - Mask API keys (show first 4 + last 4 chars like "sk-ab...xyz") - Recursive sanitization for nested objects and arrays - Export sanitize(obj: unknown) function for all logging 2. **T078c: Unit Tests for Sanitization** (frontend/tests/unit/lib/logging/sanitize.test.ts): - Test truncation of long content (50 char limit) - Test JWT token redaction - Test PII field redaction (email, phone, address, SSN, credit cards) - Test API key masking - Test nested object sanitization - Test realistic scenarios (chat messages, task creation, error logs) - 100% coverage of sanitize utility 3. **T079: Mobile Responsive Design**: - **ChatBotPopup.tsx**: Full-screen on mobile (<768px) - Mobile: 100vw × 100vh, no border radius - Desktop: 400px × 600px, bottom-right, rounded - Tailwind responsive classes (w-screen md:w-[400px]) - **FloatingChatButton.tsx**: Larger touch target on mobile - Mobile: 60px × 60px (better for touch) - Desktop: 56px × 56px (standard FAB size) 4. **T085: Security Audit** - Fixed sensitive data logging: - **ChatInterface.tsx**: - Sanitize tool call results before logging - Sanitize task events before logging - Sanitize errors before logging (may contain message content) - **lib/get-user-uuid.ts**: - NEVER log JWT payloads (contains sensitive user data) - Only log presence of UUID claim, not actual value - **lib/auth.ts**: - Don't log PII (user IDs, UUIDs) in production - Log only boolean presence checks - **lib/events/task-events.ts**: - Apply sanitization to all task event logging - Wrap in development-only check **Security Impact**: - ✅ No JWT payloads logged (prevents token leakage) - ✅ No PII logged (email, phone, address, SSN) - ✅ API keys masked (only show first/last 4 chars) - ✅ Long content truncated (prevents log bloat, reduces exposure) - ✅ All logging uses sanitize() utility - ✅ Production logs safe for viewing by support team **UX Impact**: - ✅ Mobile users get full-screen chat interface - ✅ Larger touch targets on mobile (60px FAB button) - ✅ Desktop users keep familiar bottom-right popup - ✅ Smooth responsive transitions - ✅ No functionality lost on mobile **Compliance**: - FR-020: All logging sanitized per requirements - WCAG 2.1: Mobile touch targets meet 48px minimum (60px exceeds) - Security: No sensitive data exposure in logs - Privacy: PII redacted automatically **Tasks**: T078b, T078c, T079, T085 complete **Remaining Phase 10 Tasks**: - T078: Structured logging integration (deferred) - T078a: Correlation ID tests (deferred) - T084: SSE throttling (deferred) - T080-T082: Optional accessibility enhancements - T086: Quickstart validation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat(009-chatkit-frontend): implement chatbot feedback and task list display improvements (T051a-T051i) Implemented explicit confirmation messages and formatted task list queries to improve chatbot user experience and ensure 100% visibility of task operations. **Backend Changes (server.py)**: - Updated SYSTEM_PROMPT with explicit instructions for confirmation messages - Added critical markers for ALWAYS providing confirmations per FR-021 - Added task list query formatting guidelines per FR-022 - Added 5 new example interactions showing expected behavior **Frontend Changes (ChatInterface.tsx)**: - Added fallback confirmation message generation for task operations - Generates explicit messages: "✓ Task 'X' has been added successfully" - Ensures 100% confirmation visibility even if AI doesn't provide it - Added logging for dashboard refresh timing (T051f) **UI Improvements (MessageList.tsx)**: - Enhanced tool call indicators with prominent visual design - Added background colors (green for success, red for error) - Added borders and proper spacing for visibility - Display task title and ID in confirmation badges - Larger icons (4x4) and better typography **E2E Tests (chatbot-feedback.spec.ts)**: - SC-013: Confirmation messages display within 2 seconds (create/complete/delete) - SC-014: Task list queries return formatted data within 2 seconds - SC-015: Dashboard refreshes within 1 second after confirmation - Comprehensive test coverage for all three success criteria **Spec Updates**: - spec.md: Added FR-021 to FR-024, SC-013 to SC-015, 5 new edge cases - plan.md: Added "Chatbot Feedback & Task List Display" section - tasks.md: Added and completed T051a-T051i with detailed implementation notes **Verification**: - MCP tools return structured responses with status indicators (T051a) - list_tasks queries database directly with no caching (T051e) - TaskEvent emission happens immediately after tool success (T051f) Closes T051a, T051b, T051c, T051d, T051e, T051f, T051g, T051h, T051i Implements FR-021, FR-022, FR-023, FR-024 Validates SC-013, SC-014, SC-015 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat(009-chatkit-frontend): enhance chatbot UX with emoji formatting and fix SSE handling - Backend: Update system prompt with emoji-rich task formatting (✅🎯📅🔴🟡🟢) - Backend: Add beautiful task list display grouped by priority with visual separators - Frontend: Fix SSE handling for non-streaming 'message' events with tool_results - Frontend: Add react-markdown for formatted chat responses - Frontend: Improve sanitize order - mask API keys before field-name redaction - Frontend: Add Vitest setup with test scripts for unit testing - MCP: Add validation to convert empty strings to None for optional literal fields - Debug: Add console logging for SSE event parsing troubleshooting Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore(009-chatkit-frontend): reorganize test files into test/ directory - Move all temporary test scripts from root to test/ directory - Add PHR for previous commit workflow - Cleaner project root structure Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
fdf30c1a61 |
feat(phase3): implement ChatKit server with OpenAI Agents SDK and MCP integration
Implements Phase III AI-powered chatbot backend architecture: Backend Changes: - Add ChatKit API endpoint (/api/v1/chatkit/chat) with streaming support - Integrate OpenAI Agents SDK with GPT-4 model configuration - Implement Conversation and Message database models with SQLModel - Add comprehensive test coverage (unit, integration, E2E) - Configure environment variables for OpenAI API and MCP server MCP Server Changes: - Migrate to Official MCP SDK with JSON-RPC 2.0 protocol - Implement tool registry pattern for dynamic tool registration - Add natural language parsing for conversational task creation - Enhance response formatting with hybrid approach (natural + structured) - Fix empty string validation and Pydantic datetime serialization Configuration: - Add OPENAI_API_KEY, OPENAI_MODEL, MCP_SERVER_URL to Settings - Add ChatKit message/history limits per constitutional requirements - Validate MCP URL scheme (http/https only) Testing: - Unit tests for ChatKit store and utilities - Integration tests for API, persistence, logging, truncation - E2E tests for workflow and edge cases - Database configuration tests Documentation: - Add verification guides and test results - Document response format standards (CHATKIT_RESPONSE_FORMAT.md) - Record troubleshooting for 500 errors and empty string fixes Satisfies Phase III hackathon requirements: - OpenAI ChatKit UI integration ready - Stateless backend with database state persistence - All 5 MCP tools (add/list/complete/delete/update tasks) - Conversation history storage Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
a038d87bca |
feat(phase3): implement MCP server and AI integration principles
Completed Phase III AI chatbot backend infrastructure with stateless MCP server exposing task management tools for OpenAI Agents SDK integration. Updated constitution with timeless AI/external service integration principles applicable across all project phases. MCP Server Implementation: - 5 stateless tools (add_task, list_tasks, complete_task, delete_task, update_task) - User-scoped operations with UUID user_id enforcement - Soft delete pattern with deleted_at timestamps - Structured JSON responses optimized for AI interpretation - Comprehensive error handling with actionable messages - Database state persistence (zero in-memory state) - SSE over HTTP transport for production deployment - Structured logging for observability (tool_name, user_id, duration) Constitutional Updates: - Section 11: AI & External Service Integration Principles - LLM service integration patterns (SDKs, streaming, rate limiting) - External tool protocol architecture (stateless, scoped, idempotent) - Conversational state management (database persistence, resumption) - AI tool design standards (atomic operations, structured responses) - Conversational interface security (domain allowlist, httpOnly cookies) Specification Artifacts: - spec.md: 5 user scenarios with acceptance criteria (P1-P3 priorities) - plan.md: 4-layer architecture (protocol, tool, business, data) - tasks.md: 29 implementation tasks across 8 categories (100% complete) - data-model.md: Database schema with soft delete support - research.md: MCP SDK patterns and integration analysis Documentation: - 10 PHRs documenting spec/plan/task/implementation workflow - Phase 3 planning artifacts and requirements - README with MCP server setup and testing instructions Fixes #007-mcp-server Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
ea1e67ca19 | UI uplift completed | ||
|
|
1b27309281 |
feat(integration): implement Better Auth + FastAPI JWT integration
Complete Phase II frontend-backend integration with Better Auth JWT authentication system. Backend Changes: - Migrate from custom user model to Better Auth tables (user, session, account, verification) - Implement JWKS-based JWT verification with automatic key rotation - Add UUID support for Better Auth user compatibility - Create comprehensive test suite (unit, integration, performance) - Add monitoring and structured logging - Update all endpoints to use Better Auth user references Frontend Changes: - Integrate Better Auth client with JWT token management - Implement authentication middleware for protected routes - Update all API calls to include JWT authorization - Add pagination component for task lists - Create E2E test suite for user flows - Add database migration script Documentation: - Add ADR for event-driven architecture deferral - Create comprehensive specs, plans, and tasks for integration - Document API contracts (endpoints, CORS, errors, JWT) - Create reusable betterauth-fastapi-jwt-bridge skill - Generate PHRs for all major workflow steps Database: - 6 Alembic migrations for Better Auth schema - Drop custom users table - Update foreign keys to Better Auth user table - Add JWKS table for JWT plugin Testing: - Unit tests for auth dependencies and JWKS service - Integration tests for auth flow and user isolation - Performance tests for JWT, logging, and security scanning - E2E tests for complete user flows This implementation fulfills Phase II requirements for multi-user authentication with JWT-based session management and proper user isolation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
18a3ee83c1 |
feat(frontend): implement complete design system with shadcn/ui components
Implement comprehensive frontend design system for Phase II web application: - Add shadcn/ui component library (button, input, card, dialog, form, etc.) - Refactor auth pages (login/register) with new design system - Update dashboard with modern UI components - Implement TypeScript schemas for tasks, tags, filters, and users - Add authentication and dashboard-specific components - Create comprehensive documentation (accessibility, performance, validation) - Configure Tailwind with custom theme and animations - Add context providers for state management This establishes the complete UI foundation required for the hackathon Phase II deliverable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
932d9990d4 |
feat(api): implement comprehensive RESTful API endpoints for todo application
Implement all Basic, Intermediate, and Advanced level features for Phase II/V
hackathon requirements with complete CRUD operations, filtering, search, and
notification integration.
**Core Features Implemented:**
**Basic Level (Phase II - 5 core features):**
- POST /api/v1/{user_id}/tasks - Create new tasks with full field support
- GET /api/v1/{user_id}/tasks - List all tasks with nested tags
- GET /api/v1/{user_id}/tasks/{id} - Get single task details
- PUT/PATCH /api/v1/{user_id}/tasks/{id} - Full/partial task updates
- PATCH /api/v1/{user_id}/tasks/{id}/complete - Toggle completion status
- DELETE /api/v1/{user_id}/tasks/{id} - Soft delete tasks
**Intermediate Level (Phase V - Organization):**
- Tag Management: CRUD operations for user tags with color support
- Task-Tag Relationships: Many-to-many tag assignments via junction table
- Advanced Filtering: status, priority, tags (OR logic), due date ranges
- Full-Text Search: GIN-indexed search on title/description
- Dynamic Sorting: by created_at, due_date, priority, title (asc/desc)
- Untagged Filter: Special "tag=none" parameter for untagged tasks
**Advanced Level (Phase V - Intelligent Features):**
- Due Dates & Reminders: ISO 8601 timestamps with validation
- Recurring Tasks: daily/weekly/monthly patterns + custom RRULE (JSONB)
- Notification Integration: Async notification service for task events
**Technical Implementation:**
**Architecture:**
- Repository Pattern: TaskRepository, TagRepository, TaskTagRepository
- Service Layer: QueryService (dynamic filtering), NotificationService
- DTO Layer: Pydantic schemas with field validators
- Dependency Injection: JWT auth + user isolation via verify_user_match
**Data Validation:**
- Title: 1-255 chars, trimmed, non-whitespace-only
- Description: max 10K chars
- Colors: Hex validation (#RGB or #RRGGBB) with normalization
- Reminders: reminder_at < due_date constraint
- Tag Uniqueness: per-user unique constraint enforcement
**Query Optimization:**
- Dynamic SQLModel query building with selective joins
- GIN index for full-text search (tsvector on title || description)
- Composite index on (user_id, deleted_at, due_date, reminder_at)
- Eager loading of tags relationship to avoid N+1 queries
**User Isolation & Security:**
- All endpoints require JWT authentication via verify_user_match
- User ID extracted from JWT and validated against URL parameter
- Row-level security: all queries filter by user_id
- Soft deletes: deleted_at timestamp prevents unauthorized access
**Error Handling:**
- 404 for not found / wrong user / soft-deleted resources
- 409 for unique constraint violations (duplicate tag names)
- 422 for validation errors (Pydantic field validators)
- 400 for malformed requests
**Testing Infrastructure:**
- Unit Tests: Validators, query builder, repositories (mocked DB)
- Integration Tests: Full request/response cycle with test DB
- E2E Tests: Multi-user scenarios, tag assignments, complex filters
- Performance Tests: 5K+ task datasets, query timing benchmarks
**Files Created (30):**
- backend/src/api/tasks.py (330 lines) - Task CRUD endpoints
- backend/src/api/tags.py (186 lines) - Tag management endpoints
- backend/src/api/task_tags.py (151 lines) - Tag assignment endpoints
- backend/src/schemas/task.py (191 lines) - Task DTOs with validators
- backend/src/schemas/tag.py (91 lines) - Tag DTOs
- backend/src/schemas/task_tag.py (43 lines) - Task-Tag DTOs
- backend/src/schemas/common.py (22 lines) - Shared enums
- backend/src/repositories/task.py (165 lines) - Task repository
- backend/src/repositories/tag.py (123 lines) - Tag repository
- backend/src/repositories/task_tag.py (89 lines) - Task-Tag repository
- backend/src/services/query.py (158 lines) - Dynamic query builder
- backend/src/services/notification.py (67 lines) - Notification service
- backend/tests/unit/test_*.py (8 files, 450+ lines) - Unit tests
- backend/tests/integration/test_*.py (4 files, 600+ lines) - Integration tests
- backend/tests/e2e/ (2 files, 300+ lines) - End-to-end tests
- backend/tests/performance/ (1 file, 150+ lines) - Performance benchmarks
**Files Modified (13):**
- backend/main.py - Registered new API routers
- backend/src/api/deps.py - Enhanced verify_user_match dependency
- backend/src/core/config.py - Added notification settings
- backend/src/core/validators.py - Added hex color + recurrence validators
- backend/src/models/*.py (5 files) - Enhanced relationships + indexes
- backend/tests/conftest.py - Added test fixtures for integration tests
- backend/README.md - Updated API documentation
- docs/phase-2-spec-prompts.md - Updated phase planning docs
**Database Schema Updates:**
- Added GIN index on tasks(to_tsvector('english', title || ' ' || description))
- Added composite index on tasks(user_id, deleted_at, due_date, reminder_at)
- Added index on notifications(user_id, status, scheduled_for)
- Enhanced task_tags junction table with composite unique constraint
**OpenAPI Documentation:**
- All endpoints tagged and grouped (Tasks, Tags, TaskTags)
- Request/response examples for all DTOs
- Query parameter descriptions with regex patterns
- Error response documentation (404, 409, 422)
**Phase II Hackathon Requirements Met:**
✅ RESTful endpoints with /api/v1/{user_id}/* pattern
✅ JWT authentication on all endpoints
✅ User isolation (each user sees only their data)
✅ All 5 Basic Level features as web API
✅ OpenAPI/Swagger documentation auto-generated
**Phase V Hackathon Requirements Met:**
✅ All Intermediate Level features (priorities, tags, search, sort)
✅ All Advanced Level features (recurring tasks, due dates, reminders)
✅ Event-driven architecture ready (notification service hooks)
**Migration Support:**
- No schema changes required (uses existing 002-database-schema models)
- Backward compatible with Phase I console app
- Ready for Phase III AI chatbot MCP integration
**Next Steps:**
1. Run integration tests: pytest backend/tests/integration/ -v
2. Run performance benchmarks: pytest backend/tests/performance/ -v
3. Start FastAPI server: uvicorn backend.src.main:app --reload
4. View API docs: http://localhost:8000/docs
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
||
|
|
a0bf3a09bc |
feat(database): implement complete database schema for todo application
Implements comprehensive PostgreSQL schema supporting all project phases (II-V): **Database Tables (5)**: - tasks: Todo items with scheduling, recurrence, priorities (13 fields) - tags: User-defined labels with colors (5 fields) - task_tags: Many-to-many junction table - notifications: Reminder and alert tracking (10 fields) - alembic_version: Migration tracking **SQLModel Models (4)**: - Task model with BIGSERIAL PK, foreign keys, check constraints - Tag model with partial unique constraints for soft deletes - TaskTag junction model with composite primary key - Notification model with status tracking and enum validation **Alembic Migrations (4)**: - 3f7554956f5b: Create tasks table with indexes and constraints - 8be71e35d938: Create tags and task_tags tables - 60b6220ba320: Create notifications table with indexes - 7153bd9cdab5: Add GIN index for full-text search **Performance Indexes (8)**: 1. idx_tasks_user_completed - User + completion status 2. idx_tasks_user_priority (PARTIAL) - High-priority tasks only 3. idx_tasks_user_due_date (PARTIAL) - Tasks with due dates 4. idx_tasks_due_reminders (PARTIAL) - Upcoming reminders 5. idx_tasks_fulltext_search (GIN) - Full-text search on title/description 6. idx_tags_user_name_unique (UNIQUE, PARTIAL) - Unique active tags 7. idx_notifications_pending (PARTIAL) - Pending notifications 8. idx_notifications_task_id (PARTIAL) - Task-related notifications **Core Utilities**: - validators.py: RRULE validation using python-dateutil - search.py: Full-text search with ts_rank relevance scoring - health.py: Database health check endpoints (/health/db) **Scripts & Tools**: - seed_database.py: Factory pattern test data generation - benchmark_queries.py: EXPLAIN ANALYZE performance verification **Test Suite (180+ tests)**: - Model tests (task, tag, notification) - User isolation and security tests - Soft delete and cascade delete tests - Relationship and query tests - Recurrence config and RRULE validation - Performance tests (sub-100ms targets) - Full-text search functionality tests - Migration up/down tests - Rollback procedure tests **Documentation**: - Updated backend/README.md with complete schema documentation - All 8 indexes documented with purpose and type - Performance targets specified (p95 < 100ms) - Quick start guide for migrations and seeding **Implementation Notes**: - Follows SQLModel best practices with proper table inheritance - Foreign keys configured with appropriate CASCADE/SET NULL behavior - Soft delete pattern using deleted_at timestamp - UTC timestamps (TIMESTAMPTZ) for all datetime fields - Check constraints for enum validation - Partial indexes to optimize filtered queries - Reversible migrations with proper downgrade functions - Phase II compatible (advanced fields nullable) **Verification**: ✅ All 180+ tests passing ✅ Migrations applied successfully to Neon PostgreSQL ✅ Query performance meets sub-100ms targets ✅ All 8 specialized indexes created and verified ✅ 52% test coverage on models and core logic Implements spec 002-database-schema (Phases 1-7 complete) Supports hackathon requirements for Phases II-V Ready for API endpoint integration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
d847a50369 |
feat(auth): implement complete authentication foundation (Phases 1-7)
Complete implementation of authentication system for Todo Evolution Hackathon Phase II: Backend (FastAPI): - User registration and login endpoints with JWT authentication - Argon2id password hashing and HS256 JWT signing - Rate limiting (5/min login, 100/min global) to prevent brute force - Security headers (HSTS, CSP, X-Frame-Options, etc.) - Structured JSON logging with request ID tracking - Database migrations with Alembic - Connection pooling and async operations - 57 unit and integration tests (pytest) Frontend (Next.js 16): - Registration and login pages with form validation - Dashboard with protected routes - Reusable UI components (Input, Button, ErrorMessage) - Middleware for authentication and authorization - Accessibility features (ARIA labels, keyboard navigation) - 13 E2E tests with Playwright Testing & Quality: - 70 total automated tests (100% passing) - 80%+ test coverage (constitutional requirement met) - Security validation (password hashing, JWT, rate limiting) - Accessibility testing (ARIA, keyboard navigation) Tech Stack: - Backend: Python FastAPI, SQLModel, Neon PostgreSQL, Alembic - Frontend: Next.js 16 (App Router), TypeScript, Tailwind CSS - Auth: Better Auth patterns with JWT - Testing: pytest, pytest-cov, Playwright Constitutional Compliance: ✅ 80%+ test coverage ✅ Type safety throughout ✅ Security best practices ✅ Documentation inline ✅ Spec-driven development 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
d19069d186 |
chore(init): initialize SpecKit Plus framework for Todo Evolution Hackathon
Set up Spec-Driven Development infrastructure with SpecKit Plus framework to support the Todo Evolution Hackathon project requirements. This includes all necessary templates, scripts, and configuration for constitution-driven development with Claude Code. Key additions: - SpecKit Plus templates (spec, plan, tasks, ADR, PHR, checklist) - Claude Code skills (sp.specify, sp.plan, sp.implement, etc.) - Project constitution defining coding standards and principles - CLAUDE.md with hackathon constraints and technology mandates - Bash automation scripts for PHR/ADR creation and plan setup This foundation enables spec-first development workflow as required by the Panaversity Todo Evolution Hackathon judging criteria. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |