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
//! What:
//! The one HTTPS call of the standards-review shadow run, made in-process and ended only when it shows no sign of work.
//! Why:
//! The root `mise.toml` task `shadow-review` calls `fetch` with a 30 s signal. This port calls the same endpoint from
//! the wrapper itself, so no `node` or `mise` is started. A call that keeps moving bytes is never cut off for being slow
//! (owner, 2026-11-03: "Stop only on no progress"; pick 9 of `doc/planning/cli-git-shipped-limits-audit.md`, the
//! coordinator's under the owner's delegation and open to the owner's veto). The transport's own idle timeouts do the
//! judging: resolving, connecting, and each read and each write of the connection (TLS handshake, request, response head and
//! body) may stay silent for the quiet window and no longer, and there is no total deadline. The longest quiet gap of every
//! call is measured beside the call and kept in the ledger (`quiet_ledger.rs`, `thread_quiet.rs`). The trust roots are a
//! parameter: production uses the roots embedded in the binary, a test passes the fixture authority of its local TLS server.
//!
//! In TS you'd write (pseudocode):
//! ```ts
//! const response = await fetch(url, { method: 'POST', headers, body, dispatcher: new Agent({ bodyTimeout: 30000, headersTimeout: 30000 }) });
//! ```
/// The measuring of a call's quiet gap, beside the call.
use cratemeasured_quiet;
use Duration;
use ;
/// How long a call may stay silent before it is ended, when the caller sets nothing else (the script's own figure, which
/// was a total timeout there).
/// Citation: none, and **unmeasured as a quiet window**: the script's 30 seconds was inherited and no quiet gap of the call was
/// logged before `quiet_ledger.rs` kept one; the number waits for that measurement.
pub const SCRIPT_QUIET_WINDOW: Duration = from_secs;
/// What:
/// Where and how to call: the URL, the bearer key, the quiet window, and optionally the one trusted authority (PEM).
/// Why:
/// Tests point `url` at a loopback server; production passes `ENDPOINT`, a quiet window and no authority.
///
/// In TS you'd write (pseudocode):
/// ```ts
/// type Gateway = { url: string; apiKey: string; quietWindow: number; trustedPem?: Uint8Array };
/// ```
/// What:
/// The gateway's status and body text.
/// Why:
/// The answer reading decides what a status means; the client only transports.
///
/// In TS you'd write (pseudocode):
/// ```ts
/// type Reply = { status: number; body: string };
/// ```
/// What:
/// POST `body` as JSON with the bearer key; the call ends when it is silent for the quiet window, never for being slow. Any
/// HTTP status is a reply, not an error.
/// Redirects are not followed and no proxy variable is read.
/// Why:
/// The script's failure line names timeouts and transport failures; a redirect or a proxy would send the key and the
/// repository text somewhere the endpoint constant does not name.
///
/// In TS you'd write (pseudocode):
/// ```ts
/// const response = await fetch(url, { method: 'POST', headers: { 'content-type': 'application/json', authorization: 'Bearer ' + key }, body, signal });
/// ```
/// `post_decision` without the measuring thread.
/// What:
/// A failure as the log line prints it: the script's timeout wording, otherwise `fetch failed` and the cause.
/// Why:
/// Node prints only `fetch failed` and hides the cause; the cause is what a person needs.
///
/// In TS you'd write (pseudocode):
/// ```ts
/// error instanceof Error ? error.message : String(error)
/// ```
/// Controls stay out of the release executable.