alt/agent-ops/rules/project/domain/worker/rules.md
toki a8a0f691cf feat: API-centered proto socket rail milestone completion
- Add socket handler and server implementations for real-time communication
- Add Mattermost integration (auth service, push client, plugin client)
- Add Mattermost push host integration tests
- Update Flutter client app with new app structure and bootstrap
- Update Android build configurations and add Google Services config
- Add asset keep file for Flutter client
- Update agent-roadmap with api-centered-proto-socket-rail milestone
- Update agent-task with planning and code review documents for all groups
- Update domain rules for api, client, worker and project rules
2026-05-30 18:34:50 +09:00

2 KiB

domain last_rule_review_commit last_rule_updated_at
worker 711dbb9f0c 2026-05-28

worker

목적 / 책임

데이터 수집, 정규화, backtest 실행, scheduled jobs처럼 오래 걸리거나 비동기적인 작업의 runtime surface를 담당한다. PostgreSQL과 Redis 연결 정보는 이 경계에서 운영 관점으로 다룬다. worker는 client-facing surface가 아니며 API control plane을 통해 제어된다.

포함 경로

  • services/worker/cmd/alt-worker/ - worker process entrypoint
  • services/worker/internal/config/ - worker runtime configuration
  • services/worker/go.mod - worker module metadata

제외 경로

  • services/api/ - client-facing socket sessions
  • packages/domain/ - shared domain types
  • deployments/local/ - local infra orchestration

주요 구성 요소

  • config.Config - database and Redis URLs
  • config.Load - environment variable parsing with local development defaults
  • cmd/alt-worker/main.go - worker process bootstrap

유지할 패턴

  • Keep external service configuration explicit through DATABASE_URL and REDIS_URL.
  • Put job orchestration and worker-specific adapters under services/worker/internal.
  • Use packages/domain for shared business shapes instead of redefining market/backtest concepts.
  • Expose worker-owned command/query/event runtime boundaries to services/api through proto-socket when crossing process boundaries.

다른 도메인과의 경계

  • domain-model: worker consumes domain-model types; it should not make domain-model depend on worker infrastructure.
  • api: API may request or observe work; worker owns execution.
  • operations: Docker Compose supplies local infrastructure; worker code owns runtime behavior.

금지 사항

  • Do not make worker packages import API internals.
  • Do not hide required infrastructure in package-level globals.
  • Do not store generated contract code in the worker module.
  • Do not expose worker as a direct Flutter/client runtime endpoint.