- confirm-req: REQ-056~065 Proposed→Approved (CHG-20260610-02 각). srs/index Register Approved. - change-req(forward-looking): REQ-002/003/005/006/007 에 dcy-020 재정의/폐기 예정 기록 (CHG-20260610-01). 현재 코드 불변이라 status Implemented 유지(keep-current); 실제 폐기/재정의·status 전환은 dcy-020 delivery 배치에서 확정. - REQ-002 상태머신/도메인 → REQ-056/057/062 - REQ-003 테스트 계약 → REQ-056/057 - REQ-005 일일 preallocation 폐기 → REQ-058(reconcile)/REQ-060(M) - REQ-006 persistence 스키마 → REQ-056/062/064 - REQ-007 admission/intent → REQ-059/061 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
9.2 KiB
9.2 KiB
req-003: slot 도메인 단위테스트 이식 및 컬럼 계약 가드
- Status: Implemented
- Type: Testing
- Priority: High
- Owner: project maintainers
Intent
- 이식의 정확성(도메인 불변식)과
Slot컬럼 계약을 자동 테스트로 강제해, 테스트 우선 검증(Global Rule 3)을 충족하고 향후 영속화 단계의 계약 드리프트를 막는다.
Requirement
- trex-orbit 의 순수 도메인 단위테스트
test_state.py·test_service.py를tests/domain/slot/로 이식해 통과시키고, 도메인 패키지에 표준 필드 집합EXPECTED_SLOT_FIELDS를 선언한 뒤, 순수 계약 테스트test_contract.py가{f.name for f in dataclasses.fields(Slot)} == EXPECTED_SLOT_FIELDS를 단언하도록 신설한다.
Acceptance Criteria
- Given 이식한 단위테스트, When
pytest tests/domain/slot/test_state.py tests/domain/slot/test_service.py실행, Then 모두 통과한다. (FR-3, NFR-2 검증) - Given
EXPECTED_SLOT_FIELDS선언과test_contract.py, Whenpytest tests/domain/slot/test_contract.py실행, Then 통과한다. (NFR-3) - Given
Slot에 임시 필드를 추가하거나 삭제, When 계약 테스트를 실행, Then 테스트가 실패한다(음성 케이스 재현). - Given 계약 테스트, When 구현을 확인, Then 타입 단언은 하지 않고(이름/존재 중심) 타입 매핑은 dcy-001 부록 A / docs/data-model.md 문서에 둔다.
Impacted Area
- Docs: docs/data-model.md, dcy-001 부록 A (타입 매핑 계약 기준)
- Modules: trex_core/domain/slot (EXPECTED_SLOT_FIELDS 선언; 부록 A 를 가리키는 주석 포함)
- Tests: tests/domain/slot/{test_state,test_service,test_contract}.py
Notes
- NFR-2(불변식 검증)·NFR-3(컬럼 계약 강제)를 본 REQ 로 흡수. FR-3 + FR-5 통합.
- DB-side(information_schema) 드리프트 검사는 이번 범위 밖이며 영속화 REQ 로 인계한다(dcy-001 OQ-2).
- REQ-001(부트스트랩)·REQ-002(도메인 이식) 선행.
- 출처: dcy-001 FR-3, FR-5.
Change Log
CHG-20260603-01
- Date: 2026-06-03
- Author: Justin Ko
Change Summary
- dcy-001 FR-3·FR-5 로부터 최초 생성(Proposed). NFR-2 검증·NFR-3 강제를 흡수.
Intent
- 도메인 테스트 이식 green + 컬럼 계약 가드 요구사항을 backlog 로 정규화.
Acceptance Criteria Delta
- Added:
- 이식 테스트 통과, 계약 테스트 통과, 음성 케이스 실패 재현, 타입 단언 배제 4개 기준
- Updated:
- 없음
- Removed:
- 없음
Impacted Area Delta
- Docs:
- docs/data-model.md, dcy-001 부록 A
- Modules:
- trex_core/domain/slot (EXPECTED_SLOT_FIELDS)
- Tests:
- tests/domain/slot/{test_state,test_service,test_contract}.py
Delivery Trace Delta
- Batches:
- none
- Releases:
- none
Revalidation Impact
- Reverification Needed: no
- Existing Implementation Invalidated: no
- Status Recommendation: keep-current
- Follow-up Action: confirm-req 후 batch 편성
Validation Plan
pytest tests/domain/slotgreen + 필드 변경 시 계약 테스트 실패 재현으로 검증.
CHG-20260603-02
- Date: 2026-06-03
- Author: Justin Ko
Change Summary
- Status Proposed → Approved (confirm-req).
Intent
- 승인 게이트(필수 필드·구체 AC·blocker 없음) 충족, source dcy-001(confirmed, handoff 승인)과 모순 없음 확인.
Acceptance Criteria Delta
- Added:
- 없음
- Updated:
- 없음
- Removed:
- 없음
Impacted Area Delta
- Docs:
- docs/srs/index.md (Register 상태 Approved)
- Modules:
- 없음
- Tests:
- 없음
Delivery Trace Delta
- Batches:
- none (batch 편성 전)
- Releases:
- none
Revalidation Impact
- Reverification Needed: no
- Existing Implementation Invalidated: no
- Status Recommendation: keep-current
- Follow-up Action: suggest-batch-reqs / draft-batch 로 delivery batch 편성
Validation Plan
- 승인 후 batch planning 에서 본 REQ 의 Acceptance Criteria 를 검증 기준으로 사용.
CHG-20260603-03
- Date: 2026-06-03
- Author: Justin Ko
Change Summary
- Status Approved → Implemented (confirm-req-implemented, 근거 batch BAT-001 release-candidate).
Intent
- BAT-001 verification.md 의 evidence(이식 테스트 green / 계약 테스트 green / rogue 필드 음성 케이스 / 타입 단언 배제)로 AC1~AC4 충족 → 구현 완료 동기화.
Acceptance Criteria Delta
- Added:
- 없음
- Updated:
- 없음
- Removed:
- 없음
Impacted Area Delta
- Docs:
- docs/srs/index.md (Register Implemented)
- Modules:
- 없음
- Tests:
- 없음
Delivery Trace Delta
- Batches:
- BAT-001 (release-candidate)
- Releases:
- none
Revalidation Impact
- Reverification Needed: no
- Existing Implementation Invalidated: no
- Status Recommendation: keep-current
- Follow-up Action: draft-release 로 release 편성
Validation Plan
- BAT-001 verification evidence 재참조로 충분.
CHG-20260608-01
- Date: 2026-06-08
- Author: Justin Ko
Change Summary
- (change-req, dcy-012) 컬럼 계약 가드를
entry_price→limit_pricerename 에 맞춰 갱신.EXPECTED_SLOT_FIELDS(REQ-002)와 daily_slot 실제 컬럼(information_schema) 대조가limit_price기준으로 통과. BAT-016 재구현·재검증 완료 → Implemented 유지.
Intent
- 도메인/스키마 rename 후에도 코드 계약 ↔ DB 컬럼 드리프트 가드가 정확히 작동하도록 동기화.
Acceptance Criteria Delta
- Updated:
- 컬럼 계약/드리프트 테스트 기준 필드 entry_price → limit_price.
Impacted Area Delta
- Tests: tests/domain/slot/test_contract.py, tests/adapters/persistence/test_migration_and_drift.py
- Modules: (없음 — 가드는 EXPECTED_SLOT_FIELDS 상수 참조)
Delivery Trace Delta
- Batches: BAT-016
- Releases: none
Revalidation Impact
- Reverification Needed: yes (BAT-016 에서 완료)
- Existing Implementation Invalidated: no (가드 로직 불변, 기대 필드셋만 rename 반영)
- Status Recommendation: Implemented (change-req → BAT-016 재검증)
- Follow-up Action: confirm-req-implemented(BAT-016).
Validation Plan
- BAT-016: 도메인 필드셋 가드 + PG 컬럼 드리프트 가드 green.
CHG-20260609-01
- Date: 2026-06-09
- Author: Justin Ko
Change Summary
- (change-req, dcy-019/issue #18) 슬롯 도메인 변경(REQ-002: entry_count 필드 + closed→pending_buy 전이)에 맞춰 테스트 계약 정합: 상태 머신 전이 카운트 14→15(
closed→pending_buyallowed 이동), 컬럼 계약 가드가entry_count를 포함, entry_count 증분·보존/closed 재할당 selector 단위 테스트(test_slot_entry_count.py) 추가. BAT-025 검증 완료 → Implemented 유지.
Intent
- entry_count + closed 재할당 도메인 변경이 회귀 없이 계약(필드셋·전이 집합)으로 강제되도록 테스트를 동기화.
Acceptance Criteria Delta
- Updated:
- 상태 머신 전이 집합 테스트:
closed→pending_buy를 allowed 로, ALLOWED_TRANSITIONS 크기 14→15 로 단언. - 컬럼 계약 가드:
EXPECTED_SLOT_FIELDS에entry_count포함을 검증.
- 상태 머신 전이 집합 테스트:
- Added:
- entry_count 증분/보존, closed→pending_buy clean-slate, find_allocatable_slot 정렬 단위 테스트.
Impacted Area Delta
- Tests: tests/domain/slot/test_state.py, tests/domain/slot/test_contract.py, tests/domain/slot/test_slot_entry_count.py(신규), tests/application/test_buy_admission_reallocation.py(신규), tests/adapters/persistence/test_migration_and_drift.py(EXPECTED_SLOT_FIELDS 자동 반영)
Delivery Trace Delta
- Batches: BAT-025
- Releases: none
Revalidation Impact
- Reverification Needed: yes (BAT-025 에서 완료)
- Existing Implementation Invalidated: no (계약 테스트 확장 — 기존 단언 보존)
- Status Recommendation: Implemented (change-req → BAT-025 재검증)
- Follow-up Action: confirm-req-implemented(BAT-025).
Validation Plan
- BAT-025: 전이/계약 가드 + 신규 entry_count·reallocation 단위 테스트 green (unit), PG 게이트 드리프트 가드는 test DSN 환경에서 자동 검증.
CHG-20260610-01
- Date: 2026-06-10
- Author: Justin Ko
Change Summary
- (change-req, dcy-020) 슬롯 도메인 계약 가드/단위테스트가 영구 슬롯 모델(REQ-056/057)로 재정의 예정 — 전이 집합(inactive 중심)·
EXPECTED_SLOT_FIELDS(entry_count 제거·instance_key 추가)가 바뀐다. 현재 코드/테스트 불변이라 Implemented 유지(keep-current), dcy-020 delivery 배치에서 테스트 재작성·확정.
Intent
- 영구 슬롯 모델 전환의 테스트 계약 추적성 forward-link.
Acceptance Criteria Delta
- Updated: 없음(dcy-020 delivery 배치에서 재정의)
Impacted Area Delta
- Docs: dcy-020, REQ-056/057
- Modules: (예정) 없음
- Tests: (예정) test_state/test_contract/test_migration_and_drift 재작성
Delivery Trace Delta
- Batches: (예정) dcy-020 상태머신/스키마 배치
- Releases: none
Revalidation Impact
- Reverification Needed: no (현 시점)
- Existing Implementation Invalidated: no (코드 불변)
- Status Recommendation: keep-current
- Follow-up Action: dcy-020 delivery 배치에서 재정의 + status 전환.
Validation Plan
- dcy-020 배치 verification 으로 대체.