Files
trex-core/.proofline/criteria/ac-0010.md
T

1.7 KiB

id, status
id status
ac-0010 active

원주문 timeout 기준점과 주문일 영속성

Criterion

주문 dispatch 시 effective timeout_sec, immutable UTC order_submitted_at과 그 시각에서 산출한 KST order_date를 슬롯에 원자적으로 영속화해야 한다. 일반 updated_at 변경, polling, cancel bookkeeping과 broker order ID resolution은 이 anchor를 변경하지 않아야 하며 terminal 전이에서만 정리해야 한다. daemon 재시작과 KST 날짜 rollover 뒤에도 저장된 제출 시각으로 동일 deadline을 계산하고 저장된 원주문 날짜로 KIS 주문을 조회해야 한다. migration 이전 legacy pending row의 원주문 metadata가 없으면 created_at·updated_at 또는 현재 날짜로 추정하지 않고 fail-closed unresolved로 남겨야 하며, in-memory와 PostgreSQL 저장소는 같은 column·CAS·보존 동작을 제공해야 한다.

Verification

  • 성공 조건: dispatch, cancel outcome, replace_dispatch, 반복 poll과 repository 재생성 뒤에도 anchor가 동일하고, 다음 KST 날짜의 poll도 원주문 날짜를 조회한다. terminal 전이에서는 anchor와 cancel metadata가 계약대로 정리된다.
  • 실패·경계 조건: migration이 legacy row에 날짜를 backfill하거나 metadata 없는 일반 주문이 현재 날짜 KIS 조회·terminal 전이·cancel·ledger 기록을 수행하면 FAIL이다. mutable timestamp가 deadline 또는 조회일을 이동시켜도 FAIL이다.
  • 검사 방법: migration SQL discovery, tests/application/test_order_timeout_reconciliation.py의 migration·restart·rollover·legacy adversarial tests, tests/adapters/persistence/test_postgresql_slot_repository_parity.py와 PostgreSQL integration test를 실행한다.