feat: add ticket solution closure loop

This commit is contained in:
hailin
2026-07-02 10:11:30 +08:00
parent 0ea4a3c853
commit a6df96ebb0
18 changed files with 435 additions and 68 deletions

View File

@@ -11,7 +11,7 @@ class TicketStatusError(ValueError):
ALLOWED_TRANSITIONS: dict[str, set[str]] = {
"pending_info": {"pending", "closed"},
"pending": {"in_progress", "closed"},
"in_progress": {"pending_confirm", "resolved", "closed"},
"in_progress": {"pending_confirm"},
"pending_confirm": {"resolved", "in_progress", "closed"},
"resolved": {"closed"},
"closed": set(),

View File

@@ -7,6 +7,16 @@ def test_pending_ticket_can_move_to_in_progress():
validate_status_transition("pending", "in_progress")
def test_in_progress_ticket_must_not_close_directly():
with pytest.raises(TicketStatusError, match="in_progress -> closed"):
validate_status_transition("in_progress", "closed")
def test_in_progress_ticket_must_not_resolve_directly():
with pytest.raises(TicketStatusError, match="in_progress -> resolved"):
validate_status_transition("in_progress", "resolved")
def test_resolved_ticket_cannot_move_back_to_in_progress():
with pytest.raises(TicketStatusError, match="resolved -> in_progress"):
validate_status_transition("resolved", "in_progress")