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
// SPDX-License-Identifier: Apache-2.0
//! The first check that declares `needs_prior`: a warrant promoted in one
//! change.
//!
//! [Spec 3](../../../../docs/spec/03-authoring-and-lifecycle.md#promotion-is-one-human-one-document-one-diff)
//! states the act and the failure mode in four sentences. "An `asserted`
//! document becomes `accepted` when a person reads it, sets the warrant, and
//! names themselves." Then: "The failure mode is bulk. A script that stamps
//! forty documents writes bytes that are identical to forty real acceptances,
//! and no check can separate them. So the engine does not try to tell one stamp
//! from another. What it can do is count them in a change."
//!
//! # Why a standing population cannot answer this and a change can
//!
//! `taxonomy audit` reports how many documents stand at `asserted`. That figure
//! is a stock rather than a flow, and a bulk stamp lowers it by exactly what
//! forty separate acceptances would. So it answers whether anything is ever
//! promoted and it cannot answer whether one change was a review.
//!
//! A count per change is a different reading, and it needs a different input.
//! One value of a facet cannot say how it was reached, so this check reads the
//! version of the document that stood before the change
//! ([`crate::change::Prior`]). That input is available only in change-scoped
//! evaluation, so every instance of this rule in a full-corpus run is reported
//! as skipped with the reason `change-scoped-only`, which is what
//! [`crate::scope`] does before a view exists.
//!
//! # What separates a promotion from a document that is merely accepted
//!
//! Three states of one document are `accepted` now, and only one of them is a
//! promotion.
//!
//! | before the change | now | this rule |
//! |---|---|---|
//! | `asserted` | `accepted` | a promotion, counted |
//! | nothing: the change adds the document | `accepted` | drafted straight to `accepted`, and no transition |
//! | `accepted` | `accepted` | no movement |
//!
//! A rule that reported every document now standing at `accepted` looks
//! identical to this one in a report over a corpus where every acceptance was a
//! promotion. `tests/promotion.rs` is the corpus that separates them, and it is
//! the failing fixture
//! [spec 12](../../../../docs/spec/12-check-layer.md#testing-a-check-without-a-failing-fixture-does-not-ship)
//! requires.
//!
//! # The severity is `info`, and no bar exists to raise it
//!
//! Spec 3: "Forty in one change is a finding about the review rather than about
//! the documents. The posture is advisory permanently... A threshold teaches
//! people to promote in smaller batches, and nothing declares one." So one
//! promotion is not a defect and this rule reports it at `info`. The count is
//! the reading, and the report states it.
//!
//! [HW-OBL-0119](../../../../docs/obligations/0119-an-audit-reading-carries-no-declared-bar-so-a-distribution-cannot-become-a-finding.md)
//! holds the missing bar. Nothing in a taxonomy says how many promotions in one
//! change is too many, so a number invented here would be a verdict this engine
//! derived from nothing a corpus declared.
//!
//! # It reads a warrant, and it is the first check that does
//!
//! Every other reader of a warrant is a report: the shelf index, `query
//! explain`, and the warrant reading of `taxonomy audit`. This rule reads one
//! through [`headwater_doc::warrant`] rather than by opening the provenance
//! block by key, because a second reader of that block is a second answer to
//! what a warrant is.
use cratePrior;
use crate;
use crateOutcome;
use crate;
use ;
use Mapping;
pub const RULE: &str = "warrant.promoted";
/// The warrant a promotion moves from, and the one it moves to.
///
/// Both are values of the closed set that
/// [spec 3](../../../../docs/spec/03-authoring-and-lifecycle.md#the-warrant-and-what-each-value-requires)
/// declares. They are written here rather than read from a declaration because
/// the promotion act is spec 3's rather than a taxonomy's: no member of the
/// language names a warrant, and `taxonomy audit` writes the same closed set out
/// for the same reason.
pub const FROM: &str = "asserted";
pub const TO: &str = "accepted";
/// The check. It carries no state: the transition it reads is spec 3's, and
/// nothing in a taxonomy parameterizes it.
;
/// The span of the `warrant` key, so a report points at the line a person
/// wrote rather than at the top of the file.
///
/// The provenance block is the fallback, because a block whose shape this
/// engine cannot read is still the right place to send a reader.
/// `facet.value.not_permitted` is the rule that reports the shape.