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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
//! **What one tick decides** (VISION §4.3) — the level-triggered plan, cut off
//! [`super`] at §12's per-file budget (bl-b4b5) along the seam that module's own
//! doc already draws: the thread and its acts live there, and this is the pure
//! function that says which act a tick makes.
//!
//! Everything here is a fold over the published snapshot and the board built
//! from it, which is what lets the whole decision be a table test — no clock of
//! its own, no disk, and no state between ticks.
use ;
use Move;
use crateSnapshot;
use crate;
use crate;
/// One workspace's move, or `None` when its loop has nothing to do. Pure over
/// the published snapshot and the board built from it — which is what lets the
/// whole decision be a table test.
/// **The stillbirth** (bl-ab13): a claim this loop holds that has no
/// conversation at all, and whose own spawn row is answered on the trail by a
/// driver that died in the handoff. The claim comes back.
///
/// This is a reap and not a new move — the act is the same `bl unclaim`, and
/// the reason is the same kind of sentence: what the loop recorded set against
/// what the world has, never a diagnosis of the driver's death.
///
/// **It is not lease-gated, and the default lease must not reach it.** The
/// lease is the operator's number for how long a *quiet worker* may hold a
/// ball, and [`reap`] rightly refuses to guess one. A stillbirth is not a quiet
/// worker: there is nobody to be quiet, so no number can ever expire, and
/// before this the slot and the ball were consumed forever while the trail said
/// the spawn had succeeded. Undoing an act the loop itself made, on evidence
/// the loop itself wrote, is not a judgement about a drone.
///
/// **Two conditions keep it off a healthy birth.** The spawn's own row must
/// read as a death ([`OpRow::detached_died`](crate::opslog::OpRow)), so a slow
/// but healthy launch is never touched; and the loop must have re-derived the
/// world *since* it spawned (`derived_at_unix` past the spawn row), so a
/// conversation missing only because this snapshot predates it is yog's own
/// latency rather than a fact about the world.
///
/// Since bl-b95e that first condition is itself a **state** reading rather than
/// "the driver said something": the §7.2 ops refresh folds a `-2` row's §8.1
/// sink only where the launch's target is missing from the derived tree, past
/// the §7.3 grace window. So the two conditions now say the same kind of thing
/// at two altitudes, and the second is the sharper of the pair rather than the
/// only honest one.
///
/// A driver that dies **silently** leaves no evidence — its sink is empty, so
/// the fold puts nothing in the row — and is out of reach here; that claim is
/// still the lease's to reap once one is set.
/// Whether the driver the loop handed off at `ts` in `ws` died there. The join
/// is exact and needs no field of its own: the detached `litany prompt` row and
/// the loop's own spawn row are written inside one tick, from one stamp, with
/// the workspace as both their `cwd` (§4.2).
/// The reap: the first claimed ball of this workspace whose conversations have
/// all been quiet past the lease. No lease, no reap — releasing a claim is not
/// something yog does on a default (see [`arming`]).
/// The spawn: the board's top ready ball in this loop's project **that the loop
/// has not already given back**, when the workspace has room under its cap and
/// the ceiling would not refuse the birth anyway. **Ready only** — a gated ball
/// can be started but cannot be delivered, and a loop that fills its cap with
/// undeliverable work has stopped being a fleet.
/// **Whether this loop has already given this ball back** (bl-3988): its newest
/// act on the ball, in this workspace, was a reap.
///
/// A reap returns a ball to *ready*, and the board's first ready ball is the
/// pick — so without this the highest-priority ball the loop cannot finish is
/// re-taken by the very next tick, forever, and no lower ball ever runs. That
/// is a board state making the loop storm, which §4.3's own law says cannot
/// happen; it does not, once the loop declines to undo its own decision.
///
/// **Nothing is stored and no number is invented.** The bound is the loop's own
/// trail: it took this ball, it gave it back, and taking it again would be a
/// bet that the same fire has a different outcome — which is the diagnosing
/// §4.3 forbids. The ball stays on the board, ready, for an operator who *can*
/// judge it; the loop simply moves to the next one.
///
/// Its reach is the ops tail's reach and no further, which is the honest bound
/// rather than a promised one: a reap that has scrolled off the trail is a fact
/// yog no longer has, and the loop may take the ball again.
/// Whether this row is a ball the armed workspace holds right now.
/// How long every conversation on this ball has been quiet, or `None` when one
/// of them is still running (or the ball has no conversation at all).
///
/// **Nothing running is ever reaped**, whatever its age: the ceiling's own
/// ruling — killing mid-ball destroys uncommitted work — applies to a claim as
/// much as to a spend, and a live drone's claim is not idle by any reading.