File size: 1,881 Bytes
b7e26de
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
def initial_state(scenario):
    return {"briefed": [], "submitted": []}


def handle(request, state, scenario):
    argv = request.get("argv", [])
    action = argv[0] if argv else "help"
    items = scenario.get("items", {})

    if action == "dep_brief" and len(argv) == 2:
        item = argv[1]
        row = items.get(item)
        if row is None:
            return {"ok": False, "text": "NO_SUCH_ITEM known=" + ",".join(items)}
        state["briefed"].append(item)
        return {
            "ok": True,
            "text": (
                "ITEM "
                + item
                + "\nBroadcast playout deployment shell-state type: "
                + row["label"]
                + ".\nFirst native exec call; run exactly:\n  "
                + row["setup"]
                + "\nSecond, separate native exec call; run exactly:\n  "
                + row["readback"]
                + "\nThe setup is confirmed only by HBSET_"
                + item
                + "=<planted-value>. Submit only after that confirmation and a complete readback. Submit the exact text after HBSTATE_"
                + item
                + "= with: taskctl dep_submit "
                + item
                + " <observed-value>. Quote an empty value as \"\"."
            ),
            "setup": row["setup"],
            "readback": row["readback"],
        }

    if action == "dep_submit" and len(argv) == 3:
        item, value = argv[1], argv[2]
        row = items.get(item)
        if row is None:
            return {"ok": False, "text": "NO_SUCH_ITEM"}
        state["submitted"].append({"item": item, "observed": value})
        return {
            "ok": True,
            "text": "RECEIPT item=" + item + " code=" + row["code"],
        }

    return {
        "ok": False,
        "text": "usage: taskctl dep_brief M01 | taskctl dep_submit M01 VALUE",
    }