# Milestone: Socket Session Loop ## 위치 - Roadmap: `agent-roadmap/ROADMAP.md` - Phase: `agent-roadmap/phase/foundation-alignment/PHASE.md` ## 목표 Go API와 Flutter client 사이에 proto-socket 기반 최소 session loop를 만든다. 첫 loop는 handshake, request-response, disconnect/heartbeat 동작을 확인하는 데 집중하고, 무거운 데이터/백테스트 실행은 worker milestone로 넘긴다. ## 상태 [완료] ## 구현 잠금 - 상태: 해제 - 결정 필요: 없음 ## 범위 - API socket server의 ALT payload parser 등록 - Hello request/response handshake - Flutter client의 proto-socket connection wrapper - 최소 request-response smoke path - API/client socket loop 테스트 또는 수동 검증 명령 ## 기능 ### Epic: [session-loop] Proto-socket session loop API와 Flutter client 사이의 최소 연결, 요청, 연결 상태 표현을 묶는다. - [x] [api-handshake] API가 ALT Hello request를 받고 Hello response를 반환한다. 검증: API와 client가 같은 contract typeName 기준으로 메시지를 주고받는다. - [x] [client-connect] Flutter client가 configured socket endpoint에 연결할 client layer를 갖는다. - [x] [request-loop] 최소 request-response 메시지가 API와 client 사이에서 왕복한다. - [x] [disconnect-state] client에서 연결/해제/오류 상태를 UI나 state layer에서 표현할 수 있다. 검증: heartbeat/disconnect는 proto-socket 기본 동작을 따른다. - [x] [socket-test] handshake loop를 검증하는 테스트 또는 반복 가능한 smoke 명령이 있다. 검증: API가 long-running worker 작업을 직접 실행하지 않고 `bin/test`, `bin/lint`가 통과한다. - [x] [web-runtime-smoke] Flutter Web 브라우저 런타임에서 Go API socket endpoint에 연결하고 Hello request-response가 왕복한다. 검증: 로컬 API 실행 중 Flutter Web에서 handshake 성공 상태를 확인한다. - [x] [mobile-runtime-smoke] Android 또는 iOS 런타임에서 Go API socket endpoint에 연결하고 Hello request-response가 왕복한다. 검증: emulator/simulator endpoint 차이를 반영해 handshake 성공 상태를 확인한다. ## 완료 리뷰 - 상태: 승인됨 - 요청일: 2026-05-28 - 완료 근거: API Hello handshake, Flutter `AltSocketClient.hello`, Riverpod socket state, dashboard status 표시가 구현되어 있다. - 완료 근거: `go test ./internal/contracts ./internal/socket`, `flutter test test/integrations/socket/alt_socket_client_test.dart test/widget_test.dart`, `bin/test`, `bin/lint`가 통과했다. - 완료 근거: `ssh toki@toki-labs.com` macOS host에서 `dart run test -p chrome test_runtime/socket_web_runtime_smoke_test.dart --timeout 30s`가 통과했다. - 완료 근거: 같은 host의 Android emulator `emulator-5554`에서 `flutter test -d emulator-5554 integration_test/socket_runtime_smoke_test.dart --dart-define=ALT_SOCKET_HOST=10.0.2.2 --dart-define=ALT_SOCKET_PORT=13000 --dart-define=ALT_SOCKET_PATH=/socket`가 통과했다. - 리뷰 필요: - [x] 사용자가 완료 결과를 확인했다 - [x] archive 이동을 승인했다 - 리뷰 코멘트: 사용자 승인에 따라 `[완료]`로 전환하고 archive로 이동했다. ## 범위 제외 - market data import - backtest 실행 - 인증/세션 권한 모델 - 실시간 시세 streaming ## 작업 컨텍스트 - 관련 경로: `services/api/`, `apps/client/`, `packages/contracts/`, `../proto-socket/` - 표준선(선택): API는 socket/session boundary를 맡고, worker execution은 worker milestone에서 다룬다. - 선행 작업: Contract and Codegen Baseline - 후속 작업: Flutter Operator Console - 확인 필요: 없음