Deliver BAT-001: bootstrap trex-core + port slot pure domain

Implement REQ-001~004 (dcy-001): scaffold the trex-core package
(pyproject, trex_core/, tests/), port the slot pure domain into
trex_core.domain.slot with import rewrites, add the EXPECTED_SLOT_FIELDS
contract guard (test_contract), and port the state/service unit tests.

Verification: 56 passed, ruff clean, import sweep shows zero external
deps, public __all__ exposes no infra symbols, contract negative case
reproduced. Align project-structure/runtime-flows baselines to the real
tree. Sync SDLC tracking: REQ-001~004 → Implemented, BAT-001 →
release-candidate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-04 00:16:07 +09:00
co-authored by Claude Opus 4.8
parent 8b23b89977
commit 20498aa4ce
31 changed files with 2044 additions and 21 deletions
+25 -16
View File
@@ -55,28 +55,36 @@
│ ├── project-structure.md
│ └── runtime-flows.md
├── CLAUDE.md # SDLC governance instructions
└── (planned)
├── pyproject.toml # 패키지 메타 + pytest/ruff 설정
├── trex_core/
│ └── domain/
│ └── slot/ # 이식 대상 순수 도메인
└── tests/
└── domain/slot/ # 도메인 단위 테스트
├── pyproject.toml # 패키지 메타(배포명 trex-core) + pytest/ruff 설정
├── trex_core/
│ ├── __init__.py
│ └── domain/
│ ├── __init__.py
│ └── slot/ # slot 순수 도메인 (BAT-001 이식)
│ ├── __init__.py # 공개 API (인프라 심볼 없음)
│ ├── state.py # SlotState 6상태 + 전이
│ ├── models.py # Slot/SlotCapacity/SlotTransitionRecord + EXPECTED_SLOT_FIELDS
│ ├── errors.py # 도메인 예외 4종
│ ├── repository.py # SlotRepository Protocol
│ ├── service.py # SlotService
│ └── in_memory_repository.py
└── tests/
└── domain/slot/ # test_state / test_service / test_contract
```
> 참고: 위 `(planned)` 항목은 slot 순수 도메인 이관 Batch 에서 생성될 예정 구조다(plan.md). 현재 저장소에는 아직 코드가 없고 governance/문서 스캐폴딩만 존재한다.
> 참고: `trex_core/`·`tests/`·`pyproject.toml` 은 BAT-001(dcy-001 FR-1~FR-5)에서 실제 생성되었다. 영속화·CLI·config 는 이번 범위 밖이다.
## Package / Module Responsibilities
- `trex_core/domain/slot/` (planned)
- 슬롯 생명주기 순수 도메인. 6 상태 머신(`state.py`), 데이터 모델(`models.py`), 예외(`errors.py`), 저장소 계약(`repository.py` Protocol), 도메인 서비스(`service.py`), 테스트용 in-memory 구현(`in_memory_repository.py`).
- 외부 의존 0 — stdlib 와 패키지 내부 참조만 사용.
- `tests/domain/slot/` (planned)
- 상태머신/서비스 단위 테스트. InMemorySlotRepository 기반으로 실제 DB 없이 검증.
- `trex_core/domain/slot/`
- 슬롯 생명주기 순수 도메인. 6 상태 머신(`state.py`), 데이터 모델 + 컬럼 계약(`models.py`, `EXPECTED_SLOT_FIELDS` 포함), 예외(`errors.py`), 저장소 계약(`repository.py` Protocol), 도메인 서비스(`service.py`), in-memory 구현(`in_memory_repository.py`).
- 외부 의존 0 — stdlib 와 패키지 내부 참조만 사용(정적 import 스윕으로 확인됨).
- `tests/domain/slot/`
- 상태머신/서비스 단위 테스트(`test_state`, `test_service`) + 컬럼 계약 가드(`test_contract`). InMemorySlotRepository 기반으로 실제 DB 없이 검증.
- `docs/`
- SDLC baseline(구조/흐름/인터페이스/데이터 모델) 및 active index(discovery/srs/batches/releases).
- `pyproject.toml` (planned)
- 패키지 메타데이터, 의존성, pytest/ruff 설정.
- `pyproject.toml`
- 패키지 메타데이터(배포명 `trex-core`, `requires-python >=3.12`), dev 의존성(pytest/ruff), pytest/ruff 설정.
## Dependency Rules
@@ -94,7 +102,7 @@
- 영속화 구현체(PostgreSQL repository)와 SQL 스키마/마이그레이션은 이번 범위 밖 — 향후 도입.
- CLI / 설정(config) 표면 없음(trex-orbit 의 `trex slot` CLI 미이식).
- 패키지 네임스페이스는 `trex_core.domain.slot` 으로 확정(dcy-001 OQ-1, 배포명 `trex-core`).
- `pyproject.toml` 및 `trex_core/`, `tests/` 스캐폴딩은 이관 Batch 에서 생성 예정.
- 컬럼 계약 드리프트는 `EXPECTED_SLOT_FIELDS` + `test_contract.py` 로 강제(DB-side 검사는 영속화 반복 인계).
## Update Triggers
@@ -106,3 +114,4 @@
- 2026-06-03 :: bootstrap-baseline 으로 초기 구조 baseline 생성(mixed: trex-orbit 코드 관찰 + 이관 계획 선언).
- 2026-06-03 :: dcy-001 OQ-1 결정 반영 — planned 네임스페이스를 `app/` → `trex_core/` 로 정정(배포명 `trex-core`).
- 2026-06-03 :: BAT-001 이식 완료 반영 — `trex_core/`·`tests/`·`pyproject.toml` planned→실제 정합(REQ-004).