Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
595907a
refactor: Remove Socket.IO and consolidate task status naming
Wirasm Aug 28, 2025
61ab403
feat: Add loading states and error handling for UI operations
Wirasm Aug 28, 2025
7283b79
docs: Add comprehensive polling architecture documentation
Wirasm Aug 28, 2025
94a8949
fix: Correct method name for fetching tasks
Wirasm Aug 28, 2025
4179322
docs: Add comprehensive API naming conventions guide
Wirasm Aug 28, 2025
af402c2
docs: Update CLAUDE.md with polling architecture and naming conventions
Wirasm Aug 28, 2025
970ba04
refactor: Remove Socket.IO and implement HTTP polling architecture
Wirasm Aug 28, 2025
6816610
Fix data consistency issue in crawl completion
Wirasm Aug 28, 2025
98c8684
Consolidate API key access to unified LLM provider service pattern
Wirasm Aug 28, 2025
2b08c7b
Fix async/await consistency in source management services
Wirasm Aug 28, 2025
1301516
fix: correct API response handling in MCP project polling
Wirasm Aug 28, 2025
e4a6a68
fix: Optimize project switching performance and eliminate task jumping
Wirasm Aug 28, 2025
75f0e70
fix: Remove race condition anti-pattern and complete Socket.IO removal
Wirasm Aug 28, 2025
c4a7058
Remove remaining Socket.IO and WebSocket references
Wirasm Aug 28, 2025
fb382b3
Add comprehensive unit tests for polling architecture
Wirasm Aug 28, 2025
ea4e9cf
Remove WebSocket functionality from service files
Wirasm Aug 28, 2025
785d347
Fix memory leaks in mutation hooks
Wirasm Aug 28, 2025
2e4e5fa
Document ETag implementation and limitations
Wirasm Aug 28, 2025
496c3ca
Remove all WebSocket event schemas and functionality
Wirasm Aug 28, 2025
3219447
Fix progress field naming inconsistency
Wirasm Aug 28, 2025
39779dd
Fix tasks polling data not updating UI
Wirasm Aug 28, 2025
86b2873
Fix incorrect project title in pin/unpin toast messages
Wirasm Aug 28, 2025
2376cdc
Remove over-engineered tempProjects logic
Wirasm Aug 28, 2025
42275c8
Optimize task count loading with parallel fetching
Wirasm Aug 28, 2025
bc08810
Fix TypeScript timer type for browser compatibility
Wirasm Aug 28, 2025
791f116
Add explicit status mappings for crawl progress states
Wirasm Aug 28, 2025
3dd46b7
Fix TypeScript timer types in pollingService for browser compatibility
Wirasm Aug 28, 2025
73e1933
Remove unused pollingService.ts dead code
Wirasm Aug 28, 2025
800ffd4
Fix TypeScript timer type in progressService for browser compatibility
Wirasm Aug 28, 2025
579e7c3
Fix TypeScript timer type in projectCreationProgressService
Wirasm Aug 28, 2025
d1e2023
Add proper error handling to project creation progress polling
Wirasm Aug 28, 2025
346a1cf
Fix documentation accuracy in API conventions and architecture docs
Wirasm Aug 28, 2025
1240001
Fix type annotations in recursive crawling strategy
Wirasm Aug 28, 2025
e99038d
Improve error logging in sitemap parsing
Wirasm Aug 28, 2025
f0972ad
Remove all Socket.IO remnants from task_service.py
Wirasm Aug 28, 2025
302f055
Complete WebSocket/Socket.IO cleanup across frontend and backend
Wirasm Aug 29, 2025
6b0ee67
Remove MCP log display functionality following KISS principles
Wirasm Aug 29, 2025
e3a9e9b
Add Claude Code command for analyzing CodeRabbit suggestions
Wirasm Aug 29, 2025
8886ad9
Add in-flight guard to prevent overlapping fetches in crawl progress …
Wirasm Aug 29, 2025
5a19446
Remove unused progressService.ts dead code
Wirasm Aug 29, 2025
987f554
Remove unused project creation progress components
Wirasm Aug 29, 2025
6c5a597
Update POLLING_ARCHITECTURE.md to reflect current state
Wirasm Aug 29, 2025
1f1dc4a
Update API_NAMING_CONVENTIONS.md to reflect current state
Wirasm Aug 29, 2025
2e2fdee
Remove unused optimistic updates code and references
Wirasm Aug 29, 2025
33d95cb
Add optimistic_updates.md documenting desired future pattern
Wirasm Aug 29, 2025
4e0044b
Fix test robustness issues in usePolling.test.ts
Wirasm Aug 29, 2025
15f9544
Fix all timing issues in usePolling tests
Wirasm Aug 29, 2025
b2248f0
Fix FastAPI dependency injection and HTTP caching in API routes
Wirasm Aug 29, 2025
43b1902
Add missing ETag and Cache-Control header assertions to 304 test
Wirasm Aug 29, 2025
965f60d
Remove dead Socket.IO era progress tracking code
Wirasm Aug 29, 2025
5b87191
Fix project features endpoint to return 404 instead of 500 for non-ex…
Wirasm Aug 29, 2025
5b94932
Complete frontend cleanup for Socket.IO removal
Wirasm Aug 29, 2025
c3b4526
Remove WebSocket infrastructure from threading service
Wirasm Aug 29, 2025
d134962
Remove entire test execution system
Wirasm Aug 29, 2025
29e8a15
Fix tasks not loading automatically on project page navigation
Wirasm Aug 29, 2025
17cb94c
Fix critical issues in threading service
Wirasm Aug 29, 2025
36a6234
Reduce logging noise in both backend and frontend
Wirasm Aug 29, 2025
7273728
Remove remaining test system UI components
Wirasm Aug 29, 2025
e75a55f
Remove obsolete WebSocket delays and fix exception type
Wirasm Aug 29, 2025
85be1a3
Fix project creation service issues identified by CodeRabbit
Wirasm Aug 29, 2025
3d31669
Fix TypeScript types and Vite environment checks in MCPPage
Wirasm Aug 29, 2025
b39627f
Fix dead code bug and update gitignore
Wirasm Aug 29, 2025
fa753c4
Fix typo in gitignore: .myp_cache -> .mypy_cache
Wirasm Aug 29, 2025
1ba8777
Remove duplicate createProject method in projectService
Wirasm Aug 29, 2025
fe68762
Refactor project deletion to use mutation and remove duplicate code
Wirasm Aug 29, 2025
0248832
Fix browser compatibility: Replace NodeJS.Timeout with browser timer …
Wirasm Aug 29, 2025
551ef9b
Fix staleTime bug in usePolling for 304 responses
Wirasm Aug 29, 2025
4b2d478
Complete removal of crawlProgressService and migrate to HTTP polling
Wirasm Aug 29, 2025
a8c703d
Fix duplicate progress items and invalid progress values
Wirasm Aug 29, 2025
064082a
Remove UI-only fields from CreateProjectRequest payload
Wirasm Aug 29, 2025
ce4183d
Fix documentation accuracy issues identified by CodeRabbit
Wirasm Aug 29, 2025
9146778
Fix document upload progress tracking
Wirasm Aug 29, 2025
198c4aa
Add standardized error tracking to crawl orchestration
Wirasm Aug 29, 2025
b5f82bd
Use credential service instead of environment variable for API key
Wirasm Aug 29, 2025
a576b91
Fix tests to handle missing Supabase credentials in test environment
Wirasm Aug 29, 2025
2672109
Merge main into refactor-remove-sockets: preserve Socket.IO removal a…
Wirasm Aug 29, 2025
aad773e
fix: resolve test failures after merge by fixing async/sync mismatch
Wirasm Aug 29, 2025
0933e70
fix: use async chunking and standardize knowledge_type defaults
Wirasm Aug 29, 2025
819a6a5
fix: update misleading WebSocket log message in stop_crawl_task
Wirasm Aug 29, 2025
55e5fbf
fix: ensure crawl errors are reported to progress tracker
Wirasm Aug 29, 2025
f6d0ce5
fix: add stack trace logging to crawl orchestration exception handler
Wirasm Aug 29, 2025
7fa3e97
fix: add stack trace logging to all exception handlers in document_st…
Wirasm Aug 29, 2025
125dd6e
fix: add stack trace logging to document extraction exception handler
Wirasm Aug 29, 2025
b23523a
refactor: remove WebSocket-era leftovers from knowledge API
Wirasm Aug 29, 2025
86b536d
Complete WebSocket/Socket.IO cleanup from codebase
Wirasm Aug 29, 2025
848a43d
Improve API error handling for document uploads and task cancellation
Wirasm Aug 29, 2025
1ed2d88
Fix source_id collision bug in document uploads
Wirasm Aug 29, 2025
f526181
Remove unused disconnectScreenDelay setting from health service
Wirasm Aug 29, 2025
190a686
Update stale WebSocket reference in JSDoc comment
Wirasm Aug 29, 2025
da5f32b
Remove all remaining WebSocket migration comments
Wirasm Aug 29, 2025
7252aa9
Update progress tracker when cancelling crawl tasks
Wirasm Aug 29, 2025
a816410
Update WebSocket references in Python docstrings to HTTP polling
Wirasm Aug 29, 2025
f82eee2
Clarify distinction between crawl operation and page concurrency limits
Wirasm Aug 29, 2025
b0cc601
Add stack trace logging to document upload error handler
Wirasm Aug 29, 2025
91d2eb9
fix: validate tags must be JSON array of strings in upload endpoint
Wirasm Aug 29, 2025
d2455ce
perf: replace 500ms delay with frame yield in chat panel init
Wirasm Aug 29, 2025
8022d40
fix: resolve duplicate key warnings and improve crawl cancellation
Wirasm Aug 29, 2025
af7c59a
fix: support multiple concurrent crawls with independent progress tra…
Wirasm Aug 29, 2025
1079205
fix: prevent infinite loop in CrawlingProgressCard useEffect
Wirasm Aug 29, 2025
0ed2d47
chore: remove unused extractDomain helper function
Wirasm Aug 29, 2025
eaa5e17
fix: unify progress payload shape and enable frontend to use backend …
Wirasm Aug 29, 2025
58149a5
fix: prevent UI flicker by showing failed status before removal
Wirasm Aug 29, 2025
37bd48b
fix: merge progress updates instead of replacing to preserve retry pa…
Wirasm Aug 29, 2025
f42f79a
chore: remove dead setActiveProgressId call
Wirasm Aug 29, 2025
d3080fa
fix: prevent canonical field overrides in handleStartCrawl
Wirasm Aug 29, 2025
e113939
fix: add proper type hints for crawling service callbacks
Wirasm Aug 29, 2025
f35f09d
fix: prevent concurrent crawling interference
Wirasm Aug 29, 2025
c6fb8af
fix: optimize UI performance with batch task counts and memoization
Wirasm Sep 1, 2025
d15d8aa
Merge branch 'main' into refactor-remove-sockets
Wirasm Sep 1, 2025
17a39e4
chore: update uv.lock after merging main's dependency group structure
Wirasm Sep 1, 2025
3f67fc1
fix: apply CodeRabbit review suggestions for improved code quality
Wirasm Sep 1, 2025
ed43182
fix: handle None values in document validation and update test expect…
Wirasm Sep 1, 2025
ff6b067
fix: implement task status verification to prevent drag-drop race con…
Wirasm Sep 1, 2025
534868b
feat: implement true optimistic updates for kanban drag-and-drop
Wirasm Sep 1, 2025
c41eefb
fix: add force parameter to task count loader and remove temp-ID filt…
Wirasm Sep 1, 2025
511b5cf
refactor: comprehensive code cleanup and architecture improvements
Wirasm Sep 1, 2025
a7809d8
remove: delete PRPs directory from frontend
Wirasm Sep 1, 2025
ec79f86
fix: resolve task jumping and optimistic update issues
Wirasm Sep 1, 2025
6198f12
resolve merge conflict in .gitignore
Wirasm Sep 1, 2025
624f70a
fix: resolve task ordering and UI issues from CodeRabbit review
Wirasm Sep 1, 2025
116c909
chore: remove deprecated socket.io dependencies
Wirasm Sep 1, 2025
30c3698
fix: resolve task drag-and-drop issues
Wirasm Sep 2, 2025
9b199c3
feat: comprehensive progress tracking system refactor
Wirasm Sep 2, 2025
c1770e7
fix: resolve failing backend tests and improve project UX
Wirasm Sep 2, 2025
027bf22
fix: improve crawling progress tracking and cancellation
Wirasm Sep 2, 2025
071a88d
test: fix tests for cancellation_check parameter
Wirasm Sep 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 41 additions & 14 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def process_batch(items):
Archon V2 Alpha is a microservices-based knowledge management system with MCP (Model Context Protocol) integration:

- **Frontend (port 3737)**: React + TypeScript + Vite + TailwindCSS
- **Main Server (port 8181)**: FastAPI + Socket.IO for real-time updates
- **Main Server (port 8181)**: FastAPI with HTTP polling for updates
- **MCP Server (port 8051)**: Lightweight HTTP-based MCP protocol server
- **Agents Service (port 8052)**: PydanticAI agents for AI/ML operations
- **Database**: Supabase (PostgreSQL + pgvector for embeddings)
Expand Down Expand Up @@ -167,19 +167,28 @@ uv run pytest tests/test_service_integration.py -v

### Projects & Tasks (when enabled)

- `GET /api/projects` - List projects
- `GET /api/projects` - List all projects
- `POST /api/projects` - Create project
- `GET /api/projects/{id}/tasks` - Get project tasks
- `POST /api/projects/{id}/tasks` - Create task

## Socket.IO Events

Real-time updates via Socket.IO on port 8181:

- `crawl_progress` - Website crawling progress
- `project_creation_progress` - Project setup progress
- `task_update` - Task status changes
- `knowledge_update` - Knowledge base changes
- `GET /api/projects/{id}` - Get single project
- `PUT /api/projects/{id}` - Update project
- `DELETE /api/projects/{id}` - Delete project
- `GET /api/projects/{id}/tasks` - Get tasks for project (use this, not getTasks)
- `POST /api/tasks` - Create task
- `PUT /api/tasks/{id}` - Update task
- `DELETE /api/tasks/{id}` - Delete task

## Polling Architecture

### HTTP Polling (replaced Socket.IO)
- **Polling intervals**: 1-2s for active operations, 5-10s for background data
- **ETag caching**: Reduces bandwidth by ~70% via 304 Not Modified responses
- **Smart pausing**: Stops polling when browser tab is inactive
- **Progress endpoints**: `/api/progress/crawl`, `/api/progress/project-creation`

### Key Polling Hooks
- `usePolling` - Generic polling with ETag support
- `useDatabaseMutation` - Optimistic updates with rollback
- `useProjectMutation` - Project-specific operations

## Environment Variables

Expand Down Expand Up @@ -226,6 +235,24 @@ Key tables in Supabase:
- `tasks` - Task tracking linked to projects
- `code_examples` - Extracted code snippets

## API Naming Conventions

### Task Status Values
Use database values directly (no UI mapping):
- `todo`, `doing`, `review`, `done`

### Service Method Patterns
- `get[Resource]sByProject(projectId)` - Scoped queries
- `get[Resource](id)` - Single resource
- `create[Resource](data)` - Create operations
- `update[Resource](id, updates)` - Updates
- `delete[Resource](id)` - Soft deletes

### State Naming
- `is[Action]ing` - Loading states (e.g., `isSwitchingProject`)
- `[resource]Error` - Error messages
- `selected[Resource]` - Current selection

## Common Development Tasks

### Add a new API endpoint
Expand Down Expand Up @@ -273,7 +300,7 @@ When connected to Cursor/Windsurf:

- Projects feature is optional - toggle in Settings UI
- All services communicate via HTTP, not gRPC
- Socket.IO handles all real-time updates
- HTTP polling handles all updates (Socket.IO removed)
- Frontend uses Vite proxy for API calls in development
- Python backend uses `uv` for dependency management
- Docker Compose handles service orchestration
163 changes: 163 additions & 0 deletions PRPs/ai_docs/API_NAMING_CONVENTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# API Naming Conventions

## Overview
This document defines the naming conventions used throughout the Archon V2 codebase for consistency and clarity.

## Task Status Values
**Database values only - no UI mapping:**
- `todo` - Task is in backlog/todo state
- `doing` - Task is actively being worked on
- `review` - Task is pending review
- `done` - Task is completed

## Service Method Naming

### Project Service (`projectService.ts`)

#### Projects
- `listProjects()` - Get all projects
- `getProject(projectId)` - Get single project by ID
- `createProject(projectData)` - Create new project
- `updateProject(projectId, updates)` - Update project
- `deleteProject(projectId)` - Delete project

#### Tasks
- `getTasksByProject(projectId)` - Get all tasks for a specific project
- `getTask(taskId)` - Get single task by ID
- `createTask(taskData)` - Create new task
- `updateTask(taskId, updates)` - Update task with partial data
- `updateTaskStatus(taskId, status)` - Update only task status
- `updateTaskOrder(taskId, newOrder, newStatus?)` - Update task position/order
- `deleteTask(taskId)` - Delete task (soft delete/archive)
- `getTasksByStatus(status)` - Get all tasks with specific status

#### Documents
- `getDocuments(projectId)` - Get all documents for project
- `getDocument(projectId, docId)` - Get single document
- `createDocument(projectId, documentData)` - Create document
- `updateDocument(projectId, docId, updates)` - Update document
- `deleteDocument(projectId, docId)` - Delete document

#### Versions
- `createVersion(projectId, field, content)` - Create version snapshot
- `listVersions(projectId, fieldName?)` - List version history
- `getVersion(projectId, fieldName, versionNumber)` - Get specific version
- `restoreVersion(projectId, fieldName, versionNumber)` - Restore version

## API Endpoint Patterns

### RESTful Endpoints
```
GET /api/projects - List all projects
POST /api/projects - Create project
GET /api/projects/{project_id} - Get project
PUT /api/projects/{project_id} - Update project
DELETE /api/projects/{project_id} - Delete project

GET /api/projects/{project_id}/tasks - Get project tasks
POST /api/tasks - Create task (project_id in body)
GET /api/tasks/{task_id} - Get task
PUT /api/tasks/{task_id} - Update task
DELETE /api/tasks/{task_id} - Delete task

GET /api/projects/{project_id}/docs - Get project documents
POST /api/projects/{project_id}/docs - Create document
GET /api/projects/{project_id}/docs/{doc_id} - Get document
PUT /api/projects/{project_id}/docs/{doc_id} - Update document
DELETE /api/projects/{project_id}/docs/{doc_id} - Delete document
```
Comment on lines +63 to +68
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use consistent camelCase for document route params.

Move from snake_case to camelCase and keep names distinct.

-GET    /api/projects/{project_id}/docs          - Get project documents
-POST   /api/projects/{project_id}/docs          - Create document
-GET    /api/projects/{project_id}/docs/{doc_id} - Get document
-PUT    /api/projects/{project_id}/docs/{doc_id} - Update document
-DELETE /api/projects/{project_id}/docs/{doc_id} - Delete document
+GET    /api/projects/{projectId}/documents               - Get project documents
+POST   /api/projects/{projectId}/documents               - Create document
+GET    /api/projects/{projectId}/documents/{docId}       - Get document
+PUT    /api/projects/{projectId}/documents/{docId}       - Update document
+DELETE /api/projects/{projectId}/documents/{docId}       - Delete document
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
GET /api/projects/{project_id}/docs - Get project documents
POST /api/projects/{project_id}/docs - Create document
GET /api/projects/{project_id}/docs/{doc_id} - Get document
PUT /api/projects/{project_id}/docs/{doc_id} - Update document
DELETE /api/projects/{project_id}/docs/{doc_id} - Delete document
```
GET /api/projects/{projectId}/documents - Get project documents
POST /api/projects/{projectId}/documents - Create document
GET /api/projects/{projectId}/documents/{docId} - Get document
PUT /api/projects/{projectId}/documents/{docId} - Update document
DELETE /api/projects/{projectId}/documents/{docId} - Delete document
🤖 Prompt for AI Agents
In PRPs/ai_docs/API_NAMING_CONVENTIONS.md around lines 63 to 68, the route
parameter names use snake_case and are inconsistent; change them to camelCase
(e.g., projectId, docId) and ensure each route uses distinct, consistent param
names across the file; update the listed endpoints to use
/api/projects/{projectId}/docs and /api/projects/{projectId}/docs/{docId} for
GET/POST/GET/PUT/DELETE and search the document (and any linked examples) to
replace any other snake_case occurrences so all references remain consistent.


### Progress/Polling Endpoints
```
GET /api/progress/{operation_id} - Generic operation progress
GET /api/knowledge/crawl-progress/{id} - Crawling progress
GET /api/agent-chat/sessions/{id}/messages - Chat messages
```

## Component Naming

### Hooks
- `use[Feature]` - Custom hooks (e.g., `usePolling`, `useProjectMutation`)
- Returns object with: `{ data, isLoading, error, refetch }`

### Services
- `[feature]Service` - Service modules (e.g., `projectService`, `crawlProgressService`)
- Methods return Promises with typed responses

Comment on lines +83 to +86
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Aug 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Remove reference to deprecated crawlProgressService.

Docs should point to hooks (useCrawlProgressPolling) per the consolidation decision.

-– `[feature]Service` - Service modules (e.g., `projectService`, `crawlProgressService`)
+– `[feature]Service` - Service modules (e.g., `projectService`)
+Note: prefer hooks like `useCrawlProgressPolling` over service wrappers for progress.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
### Services
- `[feature]Service` - Service modules (e.g., `projectService`, `crawlProgressService`)
- Methods return Promises with typed responses
### Services
- `[feature]Service` - Service modules (e.g., `projectService`)
Note: prefer hooks like `useCrawlProgressPolling` over service wrappers for progress.
- Methods return Promises with typed responses
🧰 Tools
🪛 LanguageTool

[grammar] ~84-~84: There might be a mistake here.
Context: ...projectService, crawlProgressService`) - Methods return Promises with typed respo...

(QB_NEW_EN)

🤖 Prompt for AI Agents
In PRPs/ai_docs/API_NAMING_CONVENTIONS.md around lines 83 to 86, remove the
deprecated reference to `crawlProgressService` and update the Services section
to point readers to the consolidated hook `useCrawlProgressPolling` instead;
replace the example text so it references hooks (e.g., mention
`useCrawlProgressPolling`) and ensure the sentence about methods returning
Promises remains accurate for service modules while clarifying that crawl
progress is handled via the hook.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Wirasm Thanks for the quick fix! The documentation now properly reflects the architectural decision to use the consolidated useCrawlProgressPolling hook instead of the deprecated service wrapper.


🧠 Learnings used
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/services/crawlProgressService.ts:35-39
Timestamp: 2025-08-28T13:07:24.766Z
Learning: The crawlProgressService.ts in the Archon codebase should be deprecated in favor of the existing useCrawlProgressPolling hook from usePolling.ts, which already includes ETag support, 304 handling, tab visibility detection, and proper React lifecycle integration. This consolidation reduces code duplication and improves performance.

### Components
- `[Feature][Type]` - UI components (e.g., `TaskBoardView`, `EditTaskModal`)
- Props interfaces: `[Component]Props`

## State Variable Naming

### Loading States
- `isLoading[Feature]` - Boolean loading indicators
- `isSwitchingProject` - Specific operation states
- `movingTaskIds` - Set/Array of items being processed

### Error States
- `[feature]Error` - Error message strings
- `taskOperationError` - Specific operation errors

### Data States
- `[feature]s` - Plural for collections (e.g., `tasks`, `projects`)
- `selected[Feature]` - Currently selected item
- `[feature]Data` - Raw data from API

## Type Definitions

### Database Types (from backend)
```typescript
type DatabaseTaskStatus = 'todo' | 'doing' | 'review' | 'done';
type Assignee = 'User' | 'Archon' | 'AI IDE Agent';
```

### Request/Response Types
```typescript
Create[Feature]Request // e.g., CreateTaskRequest
Update[Feature]Request // e.g., UpdateTaskRequest
[Feature]Response // e.g., TaskResponse
```

## Function Naming Patterns

### Event Handlers
- `handle[Event]` - Generic handlers (e.g., `handleProjectSelect`)
- `on[Event]` - Props callbacks (e.g., `onTaskMove`, `onRefresh`)

### Operations
- `load[Feature]` - Fetch data (e.g., `loadTasksForProject`)
- `save[Feature]` - Persist changes (e.g., `saveTask`)
- `delete[Feature]` - Remove items (e.g., `deleteTask`)
- `refresh[Feature]` - Reload data (e.g., `refreshTasks`)

### Formatting/Transformation
- `format[Feature]` - Format for display (e.g., `formatTask`)
- `validate[Feature]` - Validate data (e.g., `validateUpdateTask`)

## Best Practices

### ✅ Do Use
- `getTasksByProject(projectId)` - Clear scope with context
- `status` - Single source of truth from database
- Direct database values everywhere (no mapping)
- Polling with `usePolling` hook for data fetching
- Async/await with proper error handling
- ETag headers for efficient polling
- Loading indicators during operations

## Current Architecture Patterns

### Polling & Data Fetching
- HTTP polling with `usePolling` and `useCrawlProgressPolling` hooks
- ETag-based caching for bandwidth efficiency
- Loading state indicators (`isLoading`, `isSwitchingProject`)
- Error toast notifications for user feedback
- Manual refresh triggers via `refetch()`
- Immediate UI updates followed by API calls

### Service Architecture
- Specialized services for different domains (`projectService`, `crawlProgressService`)
- Direct database value usage (no UI/DB mapping)
- Promise-based async operations
- Typed request/response interfaces
Loading