Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Added query processing to route federation queries to domain services: - Created query parser to extract intent and parameters from query strings - Route queries to TasksService, EventsService, and ProjectsService - Return actual data instead of placeholder responses - Added workspace context validation Implemented query types: - Tasks: "get tasks", "show tasks", etc. - Events: "get events", "upcoming events", etc. - Projects: "get projects", "show projects", etc. Added 5 new tests for query processing (20 tests total, all passing): - Process tasks/events/projects queries - Handle unknown query types - Enforce workspace context requirements Updated FederationModule to import TasksModule, EventsModule, ProjectsModule. Fixes #297 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2.7 KiB
2.7 KiB
Issue #297: Implement actual query processing
Objective
Route federation queries to actual domain services (tasks, events, projects) instead of returning placeholder data.
Current State
- Query message type returns placeholder:
{ message: "Query received and processed" } - Location:
apps/api/src/federation/query.service.ts:167-169 - Blocks dashboard from showing real federated data (#92)
Approach
- Create query parser to extract intent and parameters from query string
- Route to appropriate service based on query type
- Return actual data from services
- Add authorization checks (workspace-scoped)
- Add comprehensive tests
Query Types to Support
- Tasks - "get tasks", "show my tasks", "tasks in progress"
- Events - "upcoming events", "calendar this week", "show events"
- Projects - "active projects", "show projects", "project status"
Implementation Plan
- Create scratchpad
- Write tests for query processing (TDD)
- Implement query parser
- Route queries to services
- Update handleIncomingQuery to use real data
- Add TasksService, EventsService, ProjectsService to QueryService
- Update FederationModule to import required modules
- All tests passing (20/20)
- Type check passing
- Test with actual federation connection (deferred to #298)
- Verify dashboard shows real data (deferred to #298)
Changes Made
query.service.ts
Added actual query processing:
- Imported TasksService, EventsService, ProjectsService
- Added
processQuery()method - routes queries to appropriate services - Added
parseQueryType()method - extracts query type from string - Added
parseQueryParams()method - extracts parameters from context - Added
processTasksQuery(),processEventsQuery(),processProjectsQuery()methods - Modified
handleIncomingQuery()to callprocessQuery()instead of placeholder
query.service.spec.ts
Added 5 new tests:
- should process 'get tasks' query and return tasks data
- should process 'get events' query and return events data
- should process 'get projects' query and return projects data
- should handle unknown query type gracefully
- should enforce workspace context in queries
All 20 tests passing.
federation.module.ts
- Added QueryService to providers and exports
- Imported TasksModule, EventsModule, ProjectsModule
Testing Strategy
- Unit tests for query parser
- Integration tests for service routing
- E2E tests with federation connection
- Security tests for workspace isolation
Notes
- Must use workspace context for RLS
- Parser should be extensible for future query types
- Error handling for malformed queries
- Consider caching frequently requested queries