What does Zero-Ticket Interfaces and Self-Service State Machines conclude, in numbers, about “The Self-Service Correction State Machine: Guards, Idempotency and Exhaustive Checking”?

Answer: Chapter 3 writes delivery and correction as a state machine, enumerates 234 reachable configurations, proves there is no deadlock and no endless resending with a person one step away, and shows an idempotency key removing the 30.3 duplicate e-mails per thousand requests caused by retries.

Scope of the numbers: Parameters are illustrative and all calculations come from the book's programs; the book is general business analysis, not individual or legal advice. Marked boxes separate published evidence, runnable Python calculations (22 programs), classical sources and the author's hypotheses.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 234

variant configs edges dead human loops recmp
correct234 512 0 1 0 1
forget116 233 0 1 12 1
no_once342 749 0 1 0 3
correct machine: longest event sequence 17 steps
most resends on any run2
Show the full program
# Chapter 3. p32: exhaustive exploration of the p31 machine
# A configuration is (state, resends, fails, recomputes, window open).
# Breadth-first search enumerates every reachable configuration with
# R = 2 resends and F = 3 verification failures, then checks deadlock,
# distance to a human, resend cycles and the length of the longest run.
# Two faulty variants show what the checks catch.
from collections import deque

R, F, CAP = 2, 3, 3


def moves(c, bug=None):
    s, rs, fl, used, win = c
    out = []
    if s not in ("HUMAN", "CLOSED"):
        out.append(("ask_human", ("HUMAN", rs, fl, used, win)))
    if win and s != "CLOSED":
        out.append(("window_close", (s, rs, fl, used, False)))
    if s == "ORDERED":
        out.append(("paid", ("DELIVERED", rs, fl, used, win)))
    if s in ("DELIVERED", "RECOMPUTED"):
        out.append(("not_received", ("UNRECEIVED", rs, fl, used, win)))
    if s in ("DELIVERED", "COOLDOWN", "RECOMPUTED"):
        out.append(("received", ("CLOSED", rs, fl, used, win)))
    if s == "UNRECEIVED":
        nxt = "RESENDING" if rs < R else "HUMAN"
        out.append(("verify_ok", (nxt, rs, fl, used, win)))
        nxt = "UNRECEIVED" if fl < F - 1 else "LOCKED"
        out.append(("verify_fail", (nxt, rs, fl + 1, used, win)))
    if s == "RESENDING":
        out.append(("sent", ("COOLDOWN", rs + 1, fl, used, win)))
    if s == "COOLDOWN":
        keep = 0 if bug == "forget" else rs
        out.append(("cool_end", ("DELIVERED", keep, fl, used, win)))
    if s == "DELIVERED" and win:
        once = used < CAP if bug == "no_once" else used == 0
        if once:
            out.append(("recompute",
                        ("RECOMPUTED", rs, fl, used + 1, win)))
    if s == "HUMAN":
        out.append(("resolved", ("CLOSED", rs, fl, used, win)))
    return out


def explore(bug=None):
    start = ("ORDERED", 0, 0, 0, True)
    seen = {start: 0}
    q = deque([start])
    edges = []
    while q:
        c = q.popleft()
        for ev, d in moves(c, bug):
            edges.append((c, ev, d))
            if d not in seen:
                seen[d] = len(seen)
                q.append(d)
    return seen, edges


def reach(adj, a, b):
    seen = {a}
    q = deque([a])
    while q:
        x = q.popleft()
        if x == b:
            return True
        for y in adj.get(x, []):
            if y not in seen:
                seen.add(y)
                q.append(y)
    return False


def report(tag, bug=None):
    seen, edges = explore(bug)
    adj = {}
    for a, ev, b in edges:
        adj.setdefault(a, []).append(b)
    dead = [c for c in seen if c[0] != "CLOSED" and not adj.get(c)]
    far = 0
    for c in seen:
        if c[0] in ("HUMAN", "CLOSED"):
            continue
        d = 1 if any(b[0] == "HUMAN" for b in adj.get(c, [])) else 9
        far = max(far, d)
    loops = 0
    for a, ev, b in edges:
        if ev == "sent" and reach(adj, b, a):
            loops += 1
    most = max(c[3] for c in seen)
    print("{:<8} {:>7} {:>5} {:>5} {:>6} {:>6} {:>5}".format(
        tag, len(seen), len(edges), len(dead), far, loops, most))
    return seen, adj, loops


print("variant  configs edges dead human loops recmp")
seen, adj, loops = report("correct")
report("forget", "forget")
report("no_once", "no_once")
memo = {}


def longest(c):
    if c not in memo:
        memo[c] = 0
        best = 0
        for d in adj.get(c, []):
            best = max(best, 1 + longest(d))
        memo[c] = best
    return memo[c]


print("correct machine: longest event sequence {} steps".format(
    longest(("ORDERED", 0, 0, 0, True))))
print("most resends on any run: {}".format(max(c[1] for c in seen)))

Single source and citation

Fan, Y. (2026). Zero-Ticket Self-Repairing Order Interfaces, Self-Service Correction State Machines and Pre-Emptive Support Elimination (Version 1.0.0), Chapter 3: The Self-Service Correction State Machine: Guards, Idempotency and Exhaustive Checking. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-401 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026401,
  author    = {Fan, Yafu},
  title     = {Zero-Ticket Self-Repairing Order Interfaces, Self-Service Correction State Machines and Pre-Emptive Support Elimination},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book