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
//! **Strict field reads**, shared by everything that decodes JSON here.
//!
//! The wire and the operator's document are both **instructions**, never
//! observations: a missing field, a mistyped value and a value of the wrong
//! shape each refuse with the offending key rather than defaulting. That is
//! yog's `docs/REMOTE.md` §3 discipline — *"an unknown `op`, a missing field, a
//! mistyped value each refuse with a reason"* — held at the one place fields
//! are read, so no caller carries a forgiving branch.
//!
//! **And strict is not the same as frozen: readers here GROW** (yog's
//! `docs/REMOTE.md` §3.2). Since bl-e598 the wire's integer is a *major* and an
//! addition ships without one, stamped an edition in the corpus ledger instead
//! — so a reader must take a frame from an engine of another edition without
//! refusing it. Four rules, and this file is where the next field meets them:
//!
//! 1. **An unknown key is ignored.** Structural here and nothing to keep: every
//! read below indexes by key and nothing enumerates an object.
//! 2. **A key stamped ABOVE the ledger's floor reads as its default when
//! absent, and the default is the fact before the field existed.** No such
//! key exists in a shape a foot decodes — every path it vendors is at or
//! under the floor, which `corpus::ledger::tests` holds — so [`bool_of`] and
//! [`str_of`] are required for the reason stated on them and stay that way.
//! The FIRST post-floor field a foot reads is the one that must not use
//! them: it gets a reader of its own, named for the fact it defaults to,
//! and the projection replay (`corpus::replay`) is what goes red until it
//! does.
//! 3. **An unknown word maps to a named catch-all**, carrying the word and
//! rendered honestly — never to the nearest known word, and never to a
//! refusal of the row it sits in. Nothing here decodes a vocabulary today:
//! the wire's only closed word set a foot reads is the reply `kind`, which
//! is rule 4's exception. A field that arrives spelling one is decoded to an
//! enum with an `Unknown(String)` arm, not matched to a `_ => Err(…)`.
//! 4. **The reply `kind` stays strict** (`gestures::decode`): a reader asks
//! only what it paints, so a kind it has never heard of means an ask started
//! being answered differently — which is a major, not an addition.
//!
//! **Why a hand codec and not a derive.** `serde_json` is linked for the
//! grammar; `serde`'s derive is not on the approved dependency set, and the
//! surface here is small and closed enough that the refusals are worth writing
//! by hand: a derive's error text names a Rust field, and an operator editing a
//! JSON document by hand needs the key they typed.
use ;
/// One string field.
/// One string field the operator may leave out. Absent is an answer; present
/// and mistyped is not.
/// One boolean field, required.
///
/// Required rather than defaulted, because the fields that wear this shape are
/// *readings* — `wrote` on the advertisement's receipt says whether the far end
/// changed anything (REMOTE §5.1) — and a reading defaulted to `false` is a
/// foot inventing the reassuring answer for an engine that said nothing. An
/// optional flag the operator may leave out is a different thing and is read
/// where it is declared (`tools::of_one`'s `subject_cwd`).
/// One array-of-strings field. An element that is not a string refuses the
/// whole field: an argv with a number in it is not an argv with a gap.