update domain rules
This commit is contained in:
parent
1f1527d7c6
commit
8a9181f1f9
6 changed files with 46 additions and 22 deletions
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
domain: api
|
||||
last_rule_review_commit: 3b1be95e625cfd110a42d2ee0d12653dc35f7579
|
||||
last_rule_updated_at: 2026-05-31
|
||||
last_rule_review_commit: 1f1527d7c6b8f115ba12c951c9919d779f071b23
|
||||
last_rule_updated_at: 2026-06-01
|
||||
---
|
||||
|
||||
# api
|
||||
|
|
@ -28,12 +28,14 @@ last_rule_updated_at: 2026-05-31
|
|||
|
||||
## 주요 구성 요소
|
||||
|
||||
- `config.Config` - host, port, socket path, heartbeat interval, heartbeat wait
|
||||
- `config.Config` - host, port, socket path, heartbeat timing, WebSocket origin patterns, and worker socket URL
|
||||
- `config.Load` - environment variable parsing with local fallback defaults
|
||||
- `contracts.ParserMap` - parser registration for generated ALT protobuf messages
|
||||
- `socket.NewServer` - proto-socket `WsServer` construction and session handler registration
|
||||
- `socket.marketHandlers`, `socket.backtestHandlers` - request validation and worker forwarding handlers
|
||||
- `workerclient.WorkerClient` - API-side worker request/response proxy
|
||||
- `socket.marketHandlers` - `ListInstruments` and `ListBars` validation plus worker forwarding
|
||||
- `socket.backtestHandlers` - start, list, detail, result, and compare backtest request validation plus worker forwarding
|
||||
- `workerclient.WorkerClient` - API-side worker request/response proxy for market reads and backtest command/query contracts
|
||||
- `workerclient.sendTyped` - shared worker forwarding path for timeout, unavailable, and context cancellation mapping
|
||||
- `cmd/alt-api/main.go` - signal handling and service lifecycle
|
||||
|
||||
## 유지할 패턴
|
||||
|
|
@ -45,6 +47,7 @@ last_rule_updated_at: 2026-05-31
|
|||
- Keep client-facing command/query handling in API thin: validate request shape, map transport failures to typed contract errors, and route long-running execution or worker-owned reads through the worker boundary.
|
||||
- Keep worker connectivity lifecycle observable and injectable enough for tests; avoid spreading worker connection state through unrelated API packages.
|
||||
- Keep `HelloResponse.capabilities` aligned with actually registered API session handlers.
|
||||
- Bound forwarded worker calls with a context timeout and return typed `ErrorInfo` payloads instead of leaking Go handler errors to clients.
|
||||
|
||||
## 다른 도메인과의 경계
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
domain: client
|
||||
last_rule_review_commit: 3b1be95e625cfd110a42d2ee0d12653dc35f7579
|
||||
last_rule_updated_at: 2026-05-31
|
||||
last_rule_review_commit: 1f1527d7c6b8f115ba12c951c9919d779f071b23
|
||||
last_rule_updated_at: 2026-06-01
|
||||
---
|
||||
|
||||
# client
|
||||
|
|
@ -18,9 +18,13 @@ ALT의 Flutter client surface를 담당한다. web/mobile/desktop targets, appli
|
|||
- `apps/client/lib/src/features/` - feature presentation code
|
||||
- `apps/client/lib/src/generated/` - generated Dart protobuf outputs consumed by the client
|
||||
- `apps/client/lib/src/integrations/` - client-side external integration adapters
|
||||
- `apps/client/android/`, `apps/client/ios/`, `apps/client/linux/`, `apps/client/macos/`, `apps/client/windows/`, `apps/client/web/` - Flutter platform targets and web assets
|
||||
- `apps/client/assets/` - client asset bundle inputs
|
||||
- `apps/client/tool/` - client-local tooling such as Dart protoc plugin wrapper
|
||||
- `apps/client/integration_test/` - Flutter integration tests
|
||||
- `apps/client/test/` - Flutter widget/unit tests
|
||||
- `apps/client/test_runtime/` - runtime smoke test helpers
|
||||
- `apps/client/analysis_options.yaml` - Dart analyzer configuration
|
||||
- `apps/client/pubspec.yaml` - Flutter package dependencies
|
||||
|
||||
## 제외 경로
|
||||
|
|
@ -32,6 +36,7 @@ ALT의 Flutter client surface를 담당한다. web/mobile/desktop targets, appli
|
|||
## 주요 구성 요소
|
||||
|
||||
- `AltClientApp` - Material app shell using Riverpod
|
||||
- `AltClientBootstrapOptions` - boot options for fullscreen mode and optional push initialization
|
||||
- `AltWorkbenchShell` - top titlebar, right-side activity rail, center content switching, and right Agent dock scaffold
|
||||
- `appRouterProvider` - `go_router` configuration
|
||||
- `DashboardScreen` - initial responsive dashboard surface
|
||||
|
|
@ -40,6 +45,8 @@ ALT의 Flutter client surface를 담당한다. web/mobile/desktop targets, appli
|
|||
- `AltSocketEndpoint` - local/default socket endpoint value object
|
||||
- `SocketConnectionController` - Riverpod connection state controller for socket lifecycle
|
||||
- `MattermostPushHostIntegration` - optional external push integration boundary
|
||||
- `MattermostPushClient` and `MattermostPushPluginClient` - host-facing push abstraction and production plugin adapter
|
||||
- `MattermostAuthService` - optional Mattermost auth and FCM token registration service
|
||||
- `bootstrapAltClient` - app bootstrap and platform integration startup
|
||||
|
||||
## 유지할 패턴
|
||||
|
|
@ -56,6 +63,7 @@ ALT의 Flutter client surface를 담당한다. web/mobile/desktop targets, appli
|
|||
- Keep operator shell bootstrapping separable from optional push/Firebase/Mattermost setup so core operator UI can start without external push readiness.
|
||||
- Keep endpoint defaults in `AltSocketEndpoint` or provider/config boundaries; presentation widgets should consume state, not hard-code runtime endpoints.
|
||||
- Keep Mattermost/Firebase/platform-channel behavior under `lib/src/integrations` and out of dashboard presentation widgets.
|
||||
- Keep production access to `NexoMessagingPlugin.instance` behind `MattermostPushPluginClient`; tests and host orchestration should depend on `MattermostPushClient`.
|
||||
|
||||
## 다른 도메인과의 경계
|
||||
|
||||
|
|
@ -68,7 +76,7 @@ ALT의 Flutter client surface를 담당한다. web/mobile/desktop targets, appli
|
|||
## 금지 사항
|
||||
|
||||
- Do not place backend service code or Go module files under `apps/client`.
|
||||
- Do not hand-edit platform generated files unless the Flutter platform integration explicitly requires it.
|
||||
- Do not hand-edit Flutter generated platform files or registrants unless a platform integration explicitly requires it.
|
||||
- Do not hand-edit generated protobuf Dart outputs.
|
||||
- Do not hard-code production endpoint assumptions in presentation widgets.
|
||||
- Do not put ALT-specific quant domain logic into `agent_shell`.
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
---
|
||||
domain: contracts
|
||||
last_rule_review_commit: 711dbb9f0c8287d2b52a034684e8e31d38eb6228
|
||||
last_rule_updated_at: 2026-05-28
|
||||
last_rule_review_commit: 1f1527d7c6b8f115ba12c951c9919d779f071b23
|
||||
last_rule_updated_at: 2026-06-01
|
||||
---
|
||||
|
||||
# contracts
|
||||
|
||||
## 목적 / 책임
|
||||
|
||||
ALT 애플리케이션 레벨 protobuf 계약을 정의한다. proto-socket은 전송 계층으로 두고, ALT 메시지는 `PacketBase.data`에 실릴 payload schema로 관리한다.
|
||||
ALT 애플리케이션 레벨 protobuf 계약을 정의한다. proto-socket은 전송 계층으로 두고, ALT 메시지는 `PacketBase.data`에 실릴 payload schema로 관리한다. market read, backtest lifecycle, and backtest analysis query payloads are versioned here.
|
||||
|
||||
## 포함 경로
|
||||
|
||||
|
|
@ -26,7 +26,9 @@ ALT 애플리케이션 레벨 protobuf 계약을 정의한다. proto-socket은
|
|||
|
||||
- `common.proto` - shared enums, decimal, handshake, and error messages
|
||||
- `market.proto` - instrument, price, quantity, bar, and market query messages
|
||||
- `backtest.proto` - backtest run spec, lifecycle, requests, responses, and result messages
|
||||
- `backtest.proto` - backtest run spec, lifecycle, analysis result, list/detail/compare requests, and responses
|
||||
- `BacktestTrade`, `BacktestPosition`, `BacktestSummaryMetrics`, `BacktestEquityPoint`, `BacktestResult` - backtest analysis result payloads
|
||||
- `ListBacktestRunsRequest`, `GetBacktestRunDetailRequest`, `GetBacktestResultRequest`, `CompareBacktestRunsRequest` - backtest analysis query request surface
|
||||
- `gen/go/alt/v1/*.pb.go` - generated Go message types consumed by Go services
|
||||
|
||||
## 유지할 패턴
|
||||
|
|
@ -36,6 +38,7 @@ ALT 애플리케이션 레벨 protobuf 계약을 정의한다. proto-socket은
|
|||
- Keep `option go_package` aligned with the generated Go package path.
|
||||
- Keep generated Go module path aligned with `git.toki-labs.com/toki/alt/packages/contracts/gen/go`.
|
||||
- Use explicit version/handshake messages because proto-socket protocol `0.1` does not carry an ALT application version field.
|
||||
- Keep request/response contracts additive and update API, worker, and client parser maps when a new ALT protobuf message becomes part of the runtime surface.
|
||||
|
||||
## 다른 도메인과의 경계
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
---
|
||||
domain: domain-model
|
||||
last_rule_review_commit: 711dbb9f0c8287d2b52a034684e8e31d38eb6228
|
||||
last_rule_updated_at: 2026-05-28
|
||||
last_rule_review_commit: 1f1527d7c6b8f115ba12c951c9919d779f071b23
|
||||
last_rule_updated_at: 2026-06-01
|
||||
---
|
||||
|
||||
# domain-model
|
||||
|
||||
## 목적 / 책임
|
||||
|
||||
ALT의 핵심 business vocabulary를 Go 타입으로 표현한다. market, instrument, price, bar, backtest run 같은 개념을 transport나 storage와 분리된 형태로 유지한다.
|
||||
ALT의 핵심 business vocabulary를 Go 타입으로 표현한다. market, instrument, price, bar, backtest run, strategy, portfolio state, and analysis result concepts stay transport- and storage-free here.
|
||||
|
||||
## 포함 경로
|
||||
|
||||
|
|
@ -25,21 +25,26 @@ ALT의 핵심 business vocabulary를 Go 타입으로 표현한다. market, instr
|
|||
## 주요 구성 요소
|
||||
|
||||
- `market.Instrument` - tradable instrument identity and provider symbol mapping
|
||||
- `market.UniverseSelector` - provider import universe vocabulary
|
||||
- `market.Bar` - timeframe OHLCV market data point
|
||||
- `backtest.RunSpec` - strategy, market, timeframe, period inputs for a run
|
||||
- `backtest.Run` - backtest lifecycle state
|
||||
- `backtest.Result` - backtest financial summary
|
||||
- `backtest.Result` - backtest financial summary, trades, positions, summary metrics, and equity curve
|
||||
- `backtest.Strategy`, `backtest.StrategyInput`, `backtest.OrderIntent` - strategy execution vocabulary
|
||||
- `backtest.PortfolioState`, `backtest.Fill`, `backtest.Position` - portfolio accounting state and fill application
|
||||
- `backtest.TotalReturn` - decimal return calculation helper backed by rational arithmetic
|
||||
|
||||
## 유지할 패턴
|
||||
|
||||
- Domain type names should stay concise and market-neutral unless a market-specific rule is unavoidable.
|
||||
- Decimal values are represented as strings through `market.Decimal`; avoid float types for prices and quantities.
|
||||
- Portfolio and return calculations use exact decimal/rational conversion, not floating point arithmetic.
|
||||
- Keep package dependencies inward: domain packages should not import API, worker, CLI, Flutter, protobuf generated code, database drivers, or proto-socket.
|
||||
|
||||
## 다른 도메인과의 경계
|
||||
|
||||
- **contracts**: domain-model owns internal Go vocabulary; contracts owns protobuf wire schema and compatibility.
|
||||
- **worker**: domain-model defines the shapes; worker executes imports, normalization, and backtests.
|
||||
- **worker**: domain-model defines the shapes; worker executes imports, normalization, backtests, persistence, and socket mapping.
|
||||
- **api**: domain-model may be mapped to responses, but API transport details stay outside this module.
|
||||
|
||||
## 금지 사항
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
domain: operations
|
||||
last_rule_review_commit: 3b1be95e625cfd110a42d2ee0d12653dc35f7579
|
||||
last_rule_updated_at: 2026-05-31
|
||||
last_rule_review_commit: 1f1527d7c6b8f115ba12c951c9919d779f071b23
|
||||
last_rule_updated_at: 2026-06-01
|
||||
---
|
||||
|
||||
# operations
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
domain: worker
|
||||
last_rule_review_commit: 3b1be95e625cfd110a42d2ee0d12653dc35f7579
|
||||
last_rule_updated_at: 2026-05-31
|
||||
last_rule_review_commit: 1f1527d7c6b8f115ba12c951c9919d779f071b23
|
||||
last_rule_updated_at: 2026-06-01
|
||||
---
|
||||
|
||||
# worker
|
||||
|
|
@ -15,6 +15,7 @@ last_rule_updated_at: 2026-05-31
|
|||
- `services/worker/cmd/alt-worker/` - worker process entrypoint
|
||||
- `services/worker/cmd/alt-worker-data-check/` - credential-free data pipeline smoke command
|
||||
- `services/worker/cmd/alt-worker-migrate/` - PostgreSQL migration command
|
||||
- `services/worker/README.md` - worker service notes
|
||||
- `services/worker/internal/backtest/` - backtest execution engine
|
||||
- `services/worker/internal/config/` - worker runtime configuration
|
||||
- `services/worker/internal/contracts/` - worker-local ALT protobuf parser map
|
||||
|
|
@ -44,8 +45,11 @@ last_rule_updated_at: 2026-05-31
|
|||
- `socket.Deps` - socket handler dependency bundle for starter, analysis, result, instrument, and bar stores
|
||||
- `jobs.Runner` - registered job handler dispatcher
|
||||
- `jobs.BacktestStarter` - pending run persistence and asynchronous backtest job launch
|
||||
- `jobs.RegisterRunBacktestHandler` - run status transition and execution job handler
|
||||
- `jobs.RegisterDailyBarImportHandler` - provider-specific daily bar import job handler
|
||||
- `backtest.Engine` - strategy loop and result persistence
|
||||
- `storage.Store` - PostgreSQL-backed market/backtest store
|
||||
- `storage.BacktestAnalysisStore` - list/detail/compare read surface for backtest analysis
|
||||
- `storage.Store` - PostgreSQL-backed market/backtest store implementing run, result, analysis, instrument, and bar ports
|
||||
- `marketdata/importer.Importer` - provider-to-store daily bar import flow
|
||||
- `providers/kis` - KIS fixture decode and normalization adapter
|
||||
|
||||
|
|
@ -58,6 +62,7 @@ last_rule_updated_at: 2026-05-31
|
|||
- Wire worker execution dependencies in worker entrypoints or worker-internal constructors; API and client must only observe typed availability/errors.
|
||||
- Keep store-backed socket surfaces tolerant of unavailable dependencies by returning typed contract errors instead of panicking.
|
||||
- Keep provider fixtures secret-free and provider-specific raw payload handling inside provider/marketdata adapters.
|
||||
- Keep backtest start asynchronous: socket handlers record or read state synchronously, while execution runs through worker job handlers.
|
||||
|
||||
## 다른 도메인과의 경계
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue