REQ-048/010 change-req. `--config` 를 이름으로 해석 + `--config-path <dir>` (기본 ./config) + resolve_config_toml(슬래시 포함 값은 하위호환 명시 경로). `.env` 를 config-dir 결정적 해석(--env-file 우선, 없으면 <config_dir>/.env, CWD 무관) + config/.env.example + .gitignore config/* 허용목록. 운영자 CLI 도 --config-path/--env-file 동일 적용. from_env() legacy 루트 .env 폴백 유지로 완전 하위호환. 단위 23 + 전체 375 passed, ruff clean, 라이브 스모크(name·path 동일). REQ-048/010 → Implemented. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3.6 KiB
3.6 KiB
BAT-026 Verification
- Status: approved
- Batch: BAT-026
- Profile: batch-lite
Acceptance Mapping
REQ-048 (CHG-20260609-01) — --config 이름 해석 + --config-path
| AC | Evidence |
|---|---|
AC-7: --config <name> [--config-path <dir>] → <dir or ./config>/<name>.toml(.toml 자동 부착) |
tests/runtime/test_config_resolution.py::test_resolve_name_default_dir / ::test_resolve_appends_toml / ::test_resolve_with_config_path → PASS |
| AC-8: 슬래시 포함(경로형) 값은 명시 경로로 그대로 사용(하위호환) | ::test_resolve_path_form_passthrough → PASS. 라이브: trex-core universe --config config/test.toml 정상(name 형태와 동일 결과) |
AC-9: 운영자 CLI 도 --config-path 수용, _resolve_instance 동일 규칙 |
::test_cli_resolve_instance_honors_config_path → PASS. 라이브: --config test --config-path config → instance=test 라우팅 |
REQ-010 (CHG-20260609-01) — config-dir .env + --env-file
| AC | Evidence |
|---|---|
AC-1(갱신): <config_dir>/.env(또는 --env-file) 로드 → dsn 반영 |
::test_dotenv_loaded_from_config_dir_cwd_independent → PASS |
AC-2: OS env 우선(override=False) |
::test_dotenv_os_env_takes_precedence + 기존 test_config_dotenv.py::test_os_env_takes_precedence_over_dotenv → PASS |
AC-3: .env 부재 시 회귀 없음 |
::test_dotenv_absent_is_noop + 기존 test_no_dotenv_uses_os_env_only → PASS |
AC-4: .gitignore config/* 무시 + *.example.toml/.env.example 추적 |
test_instance_config.py::test_gitignore_excludes_instance_toml(갱신) → PASS |
| AC-6: CWD 무관 결정적 로드 | ::test_dotenv_loaded_from_config_dir_cwd_independent(다른 CWD 로 chdir 후 config-dir .env 로드) → PASS |
AC-7: --env-file 우선 |
::test_dotenv_env_file_wins → PASS |
하위호환 (R-1/R-2)
from_env()의 legacy.env로드(루트.envCWD 폴백) 유지 → config/.env 부재에도 기존 루트.env로 동작. 기존test_config_dotenv.py6건 전부 green(무회귀).- 경로형
--config무중단: 라이브 스모크에서--config config/test.toml와--config test --config-path config가 byte 동일 스냅샷 반환(instance=test).
검증 명령/결과
- 단위(config):
pytest tests/runtime/test_config_resolution.py test_config_dotenv.py test_instance_config.py -q→ 23 passed. - 전체 회귀:
pytest -q --deselect tests/adapters/broker/test_kis.py::test_sandbox_token_and_submit→ 375 passed, 35 skipped, 1 deselected. - lint:
ruff check(config.py/daemon.py/cli.py + 신규/갱신 테스트) → All checks passed. - 라이브 스모크: 실행 중 test 데몬에
trex-core universe --config test --config-path config --json와--config config/test.toml --json→ 동일 응답(instance=test, 라우팅·.env 폴백 정상).
Baseline 문서 동기화
config/.env.example신규(공유 인프라 키 + config-dir 해석 헤더).docs/project-structure.md설정 계층 서술은 후속 정합(흐름 변화 없음 — 인자/해석 규칙 추가) — 구조 영향 없음(Design Gate: no).
결과 요약
- REQ-048 AC-7/8/9 + REQ-010 AC-1/2/3/4/6/7 전부 단위 PASS + 라이브 스모크 무회귀.
- Ready for Release: true.
미검증/한계
- 데몬 진입점(
daemon.py:main)은# pragma: no cover(프로세스 진입점) —resolve_config_toml/from_config(env_file)단위 + CLI 라이브 스모크로 동등 경로 커버. - 실제
.env→config/.env물리 이동은 운영 배포 절차(루트.env폴백으로 무중단) — 본 batch 범위 밖.