alt/agent-ops/rules/project/domain/worker/rules.md

47 lines
1.7 KiB
Markdown

---
domain: worker
last_rule_review_commit: no-commit-yet
last_rule_updated_at: 2026-05-24
---
# worker
## 목적 / 책임
데이터 수집, 정규화, backtest 실행, scheduled jobs처럼 오래 걸리거나 비동기적인 작업의 runtime surface를 담당한다. PostgreSQL과 Redis 연결 정보는 이 경계에서 운영 관점으로 다룬다.
## 포함 경로
- `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.
## 다른 도메인과의 경계
- **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.