🐛 Wire authService and projectService into TDD server#149
Conversation
The TDD dashboard Projects and Builds tabs were showing 'Not signed in' even when the user was authenticated via 'vizzly login'. This was because the TDD command only passed configService to the server manager, leaving authService and projectService undefined. - Add auth-service.js wrapping auth operations for HTTP server - Add project-service.js wrapping project operations for HTTP server - Wire both services into TDD command alongside configService - Add unit tests for both new services
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
Address review feedback: - Add comment in run.js explaining why it doesn't need auth/project services - Improve documentation for auth-service error handling behavior - Improve documentation for project-service null handling behavior - Use shared getApiUrl() from environment-config.js instead of duplicating logic
- Fix httpClient recreation in project-service.js (was creating new client per request) - Add injectable dependencies to auth-service and project-service for testing - Rewrite auth-service tests with comprehensive mocking (18 tests) - Rewrite project-service tests with comprehensive mocking (16 tests) - Add comment to TUI tests explaining X11/CI-only behavior
|
@claude rereview please |
|
Claude finished @Robdel12's task in 1m 36s —— View job Code Review Complete ✓I've reviewed the PR changes and the implementation looks solid! This fix properly addresses the root cause by wiring SummaryProblem: TDD dashboard showed "Not signed in" even when authenticated because only Solution: Created two new service wrapper modules ( Code Review Findings✅ Strengths
📝 Observations & Minor Suggestionssrc/services/auth-service.js:
src/services/project-service.js:
src/commands/tdd.js:
src/commands/run.js:
tests/services/auth-service.test.js & project-service.test.js:
tests/tui/cli.test.js:
🎯 Architecture AssessmentThe service layer approach is the right pattern here:
The alternative (accessing global config/auth directly in routers) would create tight coupling and make testing harder. ✅ Test Plan VerificationThe manual test plan is appropriate:
The unit tests are thorough and cover:
RecommendationApprove with optional refinements. The PR solves the stated problem correctly. The only suggestion is considering whether to pass |
Summary
The TDD dashboard Projects and Builds tabs were showing "Not signed in" even when the user was authenticated via
vizzly login. This was because the TDD command only passedconfigServiceto the server manager, leavingauthServiceandprojectServiceundefined.Root cause: In
src/commands/tdd.js:124, onlyconfigServicewas passed tocreateServerManager(). The HTTP server's auth and project routers checked for these services and returned "Service unavailable" when they were undefined.Changes:
auth-service.js- wraps auth operations (isAuthenticated,whoami,initiateDeviceFlow, etc.) for the HTTP serverproject-service.js- wraps project operations (listProjects,listMappings,getRecentBuilds, etc.) for the HTTP serverconfigServiceTest plan
vizzly loginto authenticatevizzly tdd startnode --test tests/services/auth-service.test.js tests/services/project-service.test.js