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
//! **Fixture worlds** (bl-8741): named, deterministic world states an external
//! client harness can dial and render.
//!
//! A seat's snapshot harness and an emulator screencap loop both need the same
//! thing and neither can reach for it: a yog serving a *known* world, at an
//! address they can dial, laid the same way every run. The suite has fabricated
//! substrate for a long time — `test_support`, and the integration crate's
//! `AgentFixture` — but both are `#[cfg(test)]` and crate-internal, so nothing
//! outside this repository has ever been able to spend them. **This module is
//! that machinery, reached by a verb**, for the reason `wire-certs.sh` became
//! `yog wire-certs` (REMOTE §8): *"an installed binary has no repository to find
//! a script in"*, and every consumer of this one is in another repository.
//!
//! # The contract
//!
//! ```text
//! root=$(yog fixture busy | jq -r .root) # lay the state, take the root
//! XDG_DATA_HOME="$root" yog & # boot an engine on it
//! # …dial the address, render, compare…
//! kill %1 && rm -rf "$root" # tear it down
//! ```
//!
//! **It lays and prints; it does not boot.** The consumer owns the engine
//! process because the consumer is the one that has to kill it — a verb that
//! parked would hand a harness a live child to parse stdout from, which is
//! worse at exactly the moment it matters. Booting is `XDG_DATA_HOME=<root>
//! yog` and nothing else: §16.2's anchor is the whole of the nesting, so
//! pointing it at a scratch root is what keeps a fixture off the operator's own
//! world. `make fixture STATE=<name>` is the one-command door over the pair.
//!
//! # What makes it deterministic
//!
//! Every byte a state contains is a `&'static str` in [`roster`]; every commit,
//! message and step is dated from the recipe's own offsets rather than from the
//! laying machine's clock; and the address is **stated** before the engine
//! binds, because self-provisioning writes `127.0.0.1:0` and only the listener
//! ever learns what that became ([`crate::wire::provision`]).
//!
//! The residual is named rather than hidden. yog serves derived ages
//! (`age_secs` on a conversation row is `now - last_action_unix`), and the
//! engine's clock is the system's — there is no environment seam that fakes it
//! and this module does not add one, because a product that can be told to lie
//! about the time is worse than a harness that normalises. So [`Laid::origin`]
//! reports the second every offset was measured from, and a harness that wants
//! an exact age computes it.
//!
//! # Two premises the tree corrects
//!
//! - **A *speaking* conversation is not a file.** `AgentState::InFlight` is
//! derived from an open `response.json` write fd and a held executor lock
//! (§3.5), so no static tree can be one. A `Streaming` step lays the bytes
//! and [`Laid::hold`] names the two paths a harness opens to complete it —
//! one line of shell (`exec 9<dir`), in the process that already owns the
//! engine.
//! - **`wound_grace` is the seat's, not the server's.** The window left with
//! bl-7942 and [`WoundGrace`](crate::app::WoundGrace) has had no consumer in
//! this crate since; what yog serves is the wound itself. A fixture can lay
//! the wound — the `wound` state does — and the grace window is the
//! rendering client's own gate over it.
/// How a byte gets written — the four primitives every writer here spends.
/// The disk writer: a recipe onto a scratch root, through the production folds.
/// Where a laid state's pieces go — the path arithmetic, and no effect.
/// What a named state IS — the declarative vocabulary, and nothing more.
/// The named states themselves, and the whole of what a consumer may ask for.
/// `yog fixture` — the verb, its two environment readings and its refusals.
use PathBuf;
/// What one `yog fixture <state>` laid — the whole consumer contract, printed
/// as one JSON object because a harness in another language should need no
/// parser of its own and no second document to look a path up in.