Project setup: Next.js, Clean Architecture, Husky, CI, SonarCloud#3
Conversation
…up-node action version
… update API call parameters
…eference in API client
…pdated SonarQube scan action
…ketClient tests with new connection handling scenarios
…gurations, and update coverage report settings
|
/review |
Code Review by Qodo
1. Reconnect blocked after disconnect
|
- Add URL normalization utility to ensure consistent trailing slashes - Simplify 401 error handling and redirect logic - Prevent duplicate WebSocket connections during CONNECTING state - Update test mocking approach for location object - Set default API URL in environment example
|
|
/review |
|
Persistent review updated to latest commit b43c82b |
| disconnect(): void { | ||
| if (this.reconnectTimeoutId) { | ||
| clearTimeout(this.reconnectTimeoutId); | ||
| this.reconnectTimeoutId = null; | ||
| } | ||
| this.reconnectAttempts = this.config.maxReconnectAttempts; | ||
| if (this.socket) { | ||
| this.socket.close(1000, 'Client disconnect'); | ||
| this.socket = null; | ||
| } |
There was a problem hiding this comment.
1. Reconnect blocked after disconnect 🐞 Bug ✓ Correctness
WebSocketClient.disconnect() sets reconnectAttempts to maxReconnectAttempts, which prevents any subsequent unclean close (after a later connect()) from scheduling reconnect attempts until an onopen successfully resets the counter. This can cause the client to stop reconnecting after a normal disconnect/reconnect cycle if the next connection fails before opening.
Agent Prompt
### Issue description
`WebSocketClient.disconnect()` sets `reconnectAttempts` to `maxReconnectAttempts`, which blocks future reconnect scheduling (`reconnectAttempts < maxReconnectAttempts`) after a later `connect()` if that new connection closes before `onopen` resets the counter. This makes the instance unsafe to reuse across disconnect/connect cycles.
### Issue Context
- `reconnectAttempts` is used both for state labeling (`connecting` vs `reconnecting`) and for enforcing the max retry limit.
- `disconnect()` should prevent reconnect for that specific close, but should not poison the instance for subsequent manual `connect()` calls.
### Fix Focus Areas
- src/architecture/api/ws.client.ts[47-56]
- src/architecture/api/ws.client.ts[88-101]
- src/architecture/api/ws.client.ts[109-119]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



PR Type
chore
Summary
Project setup: Next.js (App Router), architecture (api + gateways), quality (Husky, Prettier, lint-staged), CI (lint, format, typecheck, build, SonarCloud), and documentation.
Description
src/architecture/api(HTTP client, WebSocket client, types);src/architecture/gatewaysfor API calls;src/typesfor shared generics.main/develop), Prettier, ESLint.mainanddevelop— lint, format check, typecheck, build; SonarCloud job after check succeeds.components/uiandcomponents/dashboardstructure; components readme (shadcn, Tremor, Figma MCP).docs/architecture.md,docs/dependance.md,docs/sonar.md, PR template.No product features: foundation only for the robot dashboard.
What's Changed
Screen
N/A — no significant UI change (test page + 404).