Core Implementation (BAT-010):
- Add daemon registry schema and CRUD operations (req-023)
- Implement single-daemon asset assignment constraint (one asset per daemon)
- Add daemon_id field to service_token for daemon identification
- Add daemon.py CLI module for daemon management commands
- Add 20260513_0016_daemon_model.py migration for daemon tables
API Changes:
- GET /v1/assets: include daemon_id in AssetResponse
- POST /v1/assets/{asset_id}/ledger/trades: require daemon token binding
- GET /v1/user_info: include daemon metadata
- Enhanced service-token rotate to preserve daemon bindings
CLI Commands:
- pfhub daemon register --name <name> --runtime-id <runtime-id>
- pfhub daemon list
- pfhub daemon get <daemon-id>
- pfhub daemon revoke <daemon-id>
Requirements (REQ-023, REQ-028):
- REQ-023: Daemon Registry and Service Token Daemon Binding (Interface, Approved)
* AC-1: daemon CRUD operations
* AC-2: service token daemon binding for POST /v1/assets/{asset_id}/ledger/trades
* AC-3: single daemon per asset (exact-one assignment model)
- REQ-028: README.md Daemon Provisioning Runbook update (Documentation, Approved)
Documentation:
- Add dcy-006 Discovery for daemon-id and single-daemon asset assignment
- Update README.md with Daemon Provisioning Runbook section
- Add BAT-010 batch documentation with planning, implementation, verification
- Update rel-006 release document (daemon model implementation)
- Update data-model.md with daemon and daemon_asset_assignment tables
- Update interface-contract.md with daemon registry APIs
- Update runtime-flows.md with daemon lifecycle flows
Breaking Changes:
- REQ-005~009, REQ-011~012 status reverted to Approved due to revised contract
* daemon_id field addition and exact-one asset assignment requirement
* Existing Implemented evidence invalidated by contract revision
* BAT-001/002/008 re-verification required
Testing:
- Add test_daemon_registry.py for daemon CRUD operations
- Add test_daemon_assignment.py for single-asset assignment constraints
- Update test_auth.py, test_cli.py, test_v1.py for daemon support
- Verify daemon token binding in trade endpoint authorization
Impact:
- Database: 2 new tables (daemons, daemon_asset_assignments)
- Migration: 20260513_0016 creates daemon model schema
- CLI: 4 new daemon subcommands
- API: daemon_id propagation through v1 endpoints
- Verification: BAT-001/002/008 re-verification gates next release
3.1 KiB
3.1 KiB
BAT-010 Index
- Status: release-candidate
- Batch: BAT-010
- Profile: standard
- Created: 2026-05-13
Included REQ
| REQ | 제목 | Type | Priority |
|---|---|---|---|
| REQ-009 | v1 API 지원을 위한 DB 스키마 migration 추가 (daemon schema 포함) | Migration | High |
| REQ-023 | Daemon Registry 관리 경로 | Interface | High |
| REQ-005 | service-token 발급 시 runtime_id + daemon_id binding | Interface | High |
| REQ-012 | service-token rotate CLI — daemon_id 불변식 및 출력 | Interface | Medium |
| REQ-006 | GET /v1/assets daemon-scoped 엔드포인트 | Interface | High |
| REQ-007 | GET /v1/user_info daemon_id 필드 및 NULL diagnostic | Interface | High |
| REQ-008 | POST /v1/assets/{asset_id}/ledger/trades daemon assignment authorization | Interface | High |
| REQ-011 | baseline docs daemon-aware 갱신 (interface-contract, data-model, runtime-flows) | Documentation | Medium |
| REQ-028 | README.md Daemon Provisioning Runbook 반영 | Documentation | Medium |
Source Discovery
- dcy-006 (daemon_id 도입 및 1자산 1데몬 자산 배정 모델 정립) — 주 출처
- dcy-002 (REQ-005, REQ-006, REQ-007, REQ-008, REQ-009, REQ-012 원출처 — CHG-20260513-01로 범위 재정의)
Scope Summary
- Daemon 모델 전체를 한 번에 구현·검증·배포하는 단일 batch
daemons테이블,auth_tokens.daemon_id,portfolios.managed_by_daemon_idAlembic migration (REQ-009)- daemon registry CRUD 관리 경로 — daemon create/update/list (REQ-023)
- service-token 발급 daemon binding + unknown daemon 거부 (REQ-005)
- service-token rotate daemon_id 불변식 + CLI daemon_id 출력 (REQ-012)
- GET /v1/assets daemon-scoped 응답 + NULL token fail-closed (REQ-006)
- GET /v1/user_info daemon_id 필드 + NULL diagnostic 노출 (REQ-007)
- POST /v1/assets/{asset_id}/ledger/trades daemon assignment authorization (REQ-008)
- interface-contract, data-model, runtime-flows daemon-aware 갱신 (REQ-011)
- README.md daemon provisioning runbook + enforcement enablement gate (REQ-028)
Impacted Area
- Migrations:
migrations/versions/(daemons table, auth_tokens.daemon_id, portfolios.managed_by_daemon_id) - Modules:
app/domain/models.py,app/repositories/postgres.py,app/repositories/portfolio_repository.py,app/services/auth_service.py,app/api/auth_routes.py,app/api/v1_assets.py,app/api/v1_user_info.py,app/cli/commands/service_tokens.py - Schemas:
app/schemas/v1.py - Docs:
docs/interface-contract.md,docs/data-model.md,docs/runtime-flows.md,README.md - Tests:
tests/test_auth.py,tests/test_cli.py,tests/test_v1.py, 신규tests/test_daemon_registry.py, 신규tests/test_daemon_assignment.py
Stage Documents
| Stage | File | Status |
|---|---|---|
| Planning | planning.md | confirmed |
| Design | design.md | confirmed |
| Implementation | implementation.md | completed |
| Verification | verification.md | completed |