Files
portfolio-hub/docs/srs/Interface/req-023_daemon-registry-and-service-token-daemon-binding.md
T
genichin e6b6a8715b feat: implement daemon model with registry and single-asset assignment (BAT-010, REQ-023/028)
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
2026-05-13 23:07:24 +00:00

3.9 KiB

REQ-023: Daemon Registry 관리 경로

  • Status: Approved
  • Type: Interface
  • Priority: High
  • Owner: repository-maintainers

Intent

  • service-token issue/rotate가 기존 daemon에만 binding할 수 있으려면, daemon을 사전에 생성·수정할 수 있는 별도 관리 경로(daemon registry CRUD)가 필요하다.
  • daemon provisioning은 service-token issuance와 분리된 경로에서 수행되어야 하며, REQ-005(issuance binding)와 REQ-012(rotate daemon_id 유지)의 전제 조건이 된다.

Requirement

  • 시스템은 daemon을 생성·수정할 수 있는 별도 관리 경로를 제공해야 한다.
  • daemon은 owner user 내에서 unique한 daemon_slug(lowercase kebab-case)와 daemon_display_name(non-empty human-readable label)을 가진다.
  • 동일 owner user 내에서 중복 daemon_slug로 생성 시 명시적으로 거부한다.
  • daemon list 조회는 owner user 범위로 제한된다.

Acceptance Criteria

  1. Given admin context에서 유효한 daemon_slug와 daemon_display_name으로 daemon create를 호출할 때, Then 새 daemon entry가 registry에 생성되고 daemon_id가 반환된다.
  2. Given 기존 daemon에 대해 daemon_display_name 수정을 요청할 때, Then daemon entry가 갱신된다.
  3. Given 동일 owner user 내에 이미 존재하는 daemon_slug로 daemon create를 요청할 때, Then 명시적 오류로 거부되고 중복 entry가 생성되지 않는다.
  4. Given daemon list 조회를 요청할 때, Then 인증된 user 소유의 daemon만 반환된다.

Impacted Area

  • Docs: docs/interface-contract.md, docs/runtime-flows.md
  • Modules: app/domain/models.py, app/repositories/postgres.py, app/api/auth_routes.py 또는 별도 daemon management route, app/cli/commands/ (daemon subcommand 신규)
  • Tests: 신규 tests/test_daemon_registry.py

Notes

  • service-token issuance의 unknown daemon 거부(REQ-005 AC-6), rotate daemon_id 유지 불변식(REQ-012 CHG-20260513-01)은 이 REQ의 daemon registry가 사전 구축된 상태를 전제한다.
  • daemon registry CRUD의 구체적인 transport 형태(HTTP endpoint vs CLI subcommand)는 구현 시 결정한다.
  • canonical 운영 표기: <username>/<daemon_slug>

Change Log

CHG-20260513-02

  • Date: 2026-05-13
  • Author: repository-maintainers

Change Summary

  • Status: Proposed → Approved (confirm-req 게이트 통과)

Intent

  • 필수 필드, AC, blocker 없음 확인 후 승인 전환

Acceptance Criteria Delta

  • Added: 없음
  • Updated: 없음
  • Removed: 없음

Impacted Area Delta

  • Docs: 없음
  • Modules: 없음
  • Tests: 없음

Delivery Trace Delta

  • Batches: 미정
  • Releases: 미정

Revalidation Impact

  • Reverification Needed: no
  • Existing Implementation Invalidated: no
  • Status Recommendation: keep-current
  • Follow-up Action: 없음

Validation Plan

  • 없음 (상태 전환만)

CHG-20260513-01

  • Date: 2026-05-13
  • Author: repository-maintainers

Change Summary

  • dcy-006 FR-1의 daemon provisioning 관리 경로 부분만 추출해 신규 생성 (issuance binding·rotate invariant·fail-closed는 REQ-005/012/006/008에 이미 반영)

Intent

  • service-token issuance(REQ-005)와 rotate(REQ-012)의 전제가 되는 daemon registry CRUD 경로를 별도 REQ로 정의

Acceptance Criteria Delta

  • Added:
    • AC-1~4 전체 신규 추가
  • Updated: 없음
  • Removed: 없음

Impacted Area Delta

  • Docs: docs/interface-contract.md, docs/runtime-flows.md
  • Modules: daemon registry route, CLI subcommand
  • Tests: tests/test_daemon_registry.py

Delivery Trace Delta

  • Batches: 미정
  • Releases: 미정

Revalidation Impact

  • Reverification Needed: no
  • Existing Implementation Invalidated: no
  • Status Recommendation: keep-current
  • Follow-up Action: 없음 (신규 REQ)

Validation Plan

  • pytest로 daemon create/duplicate reject/update/list 시나리오 통과 확인