alt/agent-roadmap/archive/phase/foundation-alignment/milestones/socket-session-loop.md
toki f762d2abd9 feat: worker persistence layer and socket session updates
- Add worker storage layer with PostgreSQL/sqlc setup
- Add migration files for worker backbone schema
- Add job runner and built-in jobs implementation
- Add Redis key definitions for worker state management
- Archive socket-session-loop milestone (completed/renamed)
- Update roadmap current.md and foundation-alignment phase
- Add socket endpoint integration and runtime smoke tests
- Add infra-check, worker-storage-check, worker-storage-gen CLI tools
- Update API socket server and config
- Add pubspec dependencies and client socket endpoint changes
- Add config tests for API and worker services
2026-05-28 19:05:10 +09:00

3.6 KiB

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 사이의 최소 연결, 요청, 연결 상태 표현을 묶는다.

  • [api-handshake] API가 ALT Hello request를 받고 Hello response를 반환한다. 검증: API와 client가 같은 contract typeName 기준으로 메시지를 주고받는다.
  • [client-connect] Flutter client가 configured socket endpoint에 연결할 client layer를 갖는다.
  • [request-loop] 최소 request-response 메시지가 API와 client 사이에서 왕복한다.
  • [disconnect-state] client에서 연결/해제/오류 상태를 UI나 state layer에서 표현할 수 있다. 검증: heartbeat/disconnect는 proto-socket 기본 동작을 따른다.
  • [socket-test] handshake loop를 검증하는 테스트 또는 반복 가능한 smoke 명령이 있다. 검증: API가 long-running worker 작업을 직접 실행하지 않고 bin/test, bin/lint가 통과한다.
  • [web-runtime-smoke] Flutter Web 브라우저 런타임에서 Go API socket endpoint에 연결하고 Hello request-response가 왕복한다. 검증: 로컬 API 실행 중 Flutter Web에서 handshake 성공 상태를 확인한다.
  • [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가 통과했다.
  • 리뷰 필요:
    • 사용자가 완료 결과를 확인했다
    • 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
  • 확인 필요: 없음