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
//! Telling the operator which declared pass-through variables this machine does not
//! carry.
//!
//! # Why this is written, and not logged
//!
//! It was `tracing::warn!` first, and that was a silent failure wearing a warning's
//! clothes. The report is produced while the launch is being resolved — inside
//! [`crate::harness::resolve_declared`], reached from the verb's preparation — and the
//! agent worker does not install a tracing subscriber until it is already inside its
//! serve loop. Nothing was listening, so the warning went to the floor. On the `--check`
//! path it was worse: that path returns before the serve loop exists at all, so the
//! subscriber was never installed on that run in any form.
//!
//! Moving the subscriber earlier would have fixed one instance of the problem and left
//! the shape of it in place: a report whose delivery depends on which branch the caller
//! took, and which no test can observe. So the report is a VALUE written to a writer the
//! caller supplies. The verb hands it stderr, which exists from the first instruction of
//! the process; a test hands it a buffer and reads what an operator would have read.
//!
//! # Why it is a warning and not a refusal
//!
//! A declared name the box does not carry is not necessarily a mistake. A document can
//! legitimately name a credential that only some deployments set, and refusing the
//! launch would make one machine's optional variable another machine's outage. But it is
//! never a detail to swallow either: the agent is about to run without it, and the
//! failure that produces surfaces inside the agent's own error message, three layers
//! from the cause. So it is said out loud, by name, before anything is spawned.
use Write;
use ChildEnvironment;
use ;
/// Writes the absence report for `environment` to `writer`, or nothing at all when every
/// declared variable is present.
///
/// Silence is the correct output for a complete environment: a line saying "nothing is
/// missing" on every start would train an operator to skip the one that matters.
///
/// # Errors
///
/// Returns an error when the report cannot be written — a closed stderr is a broken
/// promise to the operator, not a detail to swallow.
pub