feat(core-B): 운영자 sync/verify CLI + cold-start onboarding (BAT-051, REQ-105/106, PR #32)

dcy-034 마지막 조각. sync(슬롯 qty←브로커+warning해제+OQ-A 전이엣지+FR-7 평단seed)/verify(C 재대조·강제해제없음). core-A QC minor 2건 정리 동봉. QC(opus) PASS, 683 passed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VHtM5Ws1HKCKQ4JGi6GRb5
This commit is contained in:
2026-06-26 09:53:49 +09:00
committed by GitHub
co-authored by Claude Opus 4.8
parent ced7eda682
commit 07b393d27d
19 changed files with 1948 additions and 39 deletions
+6 -1
View File
@@ -134,10 +134,15 @@ class TestTransitHappyPath:
# ----------------------------------------------------------------------------
class TestTransitRejections:
def test_disallowed_transition_raises(self, service, repo):
"""INACTIVE→PENDING_SELL is not an allowed transition (skips intermediate states).
Note: INACTIVE→HOLDING is now allowed (BAT-051/REQ-105 OQ-A sync path),
so we use INACTIVE→PENDING_SELL as the disallowed example instead.
"""
slot = _seed(repo)[0]
with pytest.raises(SlotTransitionError):
service.transit_slot(
slot.slot_id, SlotState.INACTIVE, SlotState.HOLDING,
slot.slot_id, SlotState.INACTIVE, SlotState.PENDING_SELL,
reason="x", actor="a",
)
+29 -4
View File
@@ -2,6 +2,9 @@
`inactive` is the only no-position state. The pool-model `idle`/`closed`
aliases were removed at the cutover (D2); migration 010 rewrites legacy rows.
BAT-051 / REQ-105 OQ-A: (INACTIVE, HOLDING) transition added to _SYNC_TRANSITIONS
for cold-start onboarding (actor=sync only, wire contract unchanged).
"""
from __future__ import annotations
@@ -71,6 +74,8 @@ def test_slot_advisory_lock_id_is_instance_scoped():
# operator resolve out of error
(SlotState.ERROR, SlotState.INACTIVE),
(SlotState.ERROR, SlotState.HOLDING),
# BAT-051 / REQ-105 OQ-A: cold-start onboarding sync (actor=sync only)
(SlotState.INACTIVE, SlotState.HOLDING),
],
)
def test_allowed_transition(from_state: SlotState, to_state: SlotState):
@@ -80,8 +85,7 @@ def test_allowed_transition(from_state: SlotState, to_state: SlotState):
@pytest.mark.parametrize(
"from_state,to_state",
[
# skipping intermediate states
(SlotState.INACTIVE, SlotState.HOLDING),
# skipping intermediate states (INACTIVE→HOLDING now in _SYNC_TRANSITIONS)
(SlotState.INACTIVE, SlotState.PENDING_SELL),
(SlotState.HOLDING, SlotState.INACTIVE),
(SlotState.PENDING_BUY, SlotState.PENDING_SELL),
@@ -103,5 +107,26 @@ def test_self_loops_are_not_allowed():
def test_allowed_transitions_set_size():
"""7 base (incl. dcy-021 holding→pending_buy) + 4 to-error + 2 operator-resolve = 13."""
assert len(ALLOWED_TRANSITIONS) == 13
"""7 base (incl. dcy-021 holding→pending_buy) + 4 to-error + 2 operator-resolve
+ 1 sync-onboarding (REQ-105 OQ-A: INACTIVE→HOLDING) = 14."""
assert len(ALLOWED_TRANSITIONS) == 14
def test_sync_transition_inactive_to_holding_is_allowed():
"""REQ-105 OQ-A: INACTIVE→HOLDING is allowed (cold-start onboarding via sync)."""
assert is_allowed_transition(SlotState.INACTIVE, SlotState.HOLDING)
def test_slot_state_enum_still_5_values():
"""REQ-105 OQ-A / REQ-108 NFR-4: wire contract unchanged — enum still 5 states."""
assert len(list(SlotState)) == 5
assert {s.value for s in SlotState} == {
"inactive", "pending_buy", "holding", "pending_sell", "error"
}
def test_normal_strategy_path_unchanged():
"""REQ-105 OQ-A: normal strategy path (INACTIVE→PENDING_BUY) still allowed;
sync path (INACTIVE→HOLDING) is additive."""
assert is_allowed_transition(SlotState.INACTIVE, SlotState.PENDING_BUY)
assert is_allowed_transition(SlotState.INACTIVE, SlotState.HOLDING)