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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
//! The Constitution — pr4xis's five guarantees, and the machinery that binds
//! the test suite to them.
//!
//! The `ontology` submodule defines the five guarantees ([`Guarantee`]) as a first-class
//! ontology. This module adds the *self-binding* layer: every test in the
//! workspace declares the guarantee it witnesses with the
//! [`praxis_value`](crate::praxis_value) attribute, which registers a
//! [`GuaranteeTag`] into the [`CONSTITUTION_TESTS`] distributed slice at link
//! time. A `constitution_coverage` meta-test then folds that slice into a
//! per-guarantee partition of the suite — so a guarantee cannot silently lose
//! coverage and a new test cannot escape classification.
//!
//! The classification is declared, not reverse-engineered from test names: a
//! claim's guarantee is first-class and discoverable, the same discipline the
//! rest of pr4xis applies to domain knowledge.
pub use ;
/// How strongly a test witnesses its guarantee.
///
/// An [`Example`](TestKind::Example) is a point-claim: it asserts the property
/// at one chosen input. A [`Property`](TestKind::Property) is a ∀-claim: a
/// `proptest!` that asserts the property for *every* input in a strategy's
/// domain, checked over many generated cases (proptest's default sample budget
/// is 256, configurable via `PROPTEST_CASES`). A property is a stronger witness
/// than an example — the case count is a sampling budget, not a test count, so
/// a property is still **one** test here, distinguished only by its kind.
/// The constitutional guarantee(s) a single test witnesses.
///
/// `primary` is the guarantee the test most directly evidences — the partition
/// key, so every tagged test falls in exactly one bucket. `secondary` records
/// any further guarantees an irreducible test also witnesses (e.g. a property
/// asserting that a mutated `.prx` is always rejected witnesses Honesty
/// primarily, but also Verifiability and Determinism) without forcing an
/// artificial split. `kind` distinguishes a point-claim from a ∀-claim, so
/// coverage can report depth (how many witnesses are properties) as well as
/// breadth.
/// Every test tagged with [`praxis_value`](crate::praxis_value) or
/// [`register_praxis_value!`](crate::register_praxis_value), gathered at link
/// time.
///
/// Native targets only — `linkme` is unsupported on wasm32, where the slice is
/// empty (fail-closed: the coverage meta-test does not run there).
pub static CONSTITUTION_TESTS: ;
/// Register a test's constitutional guarantee(s) without an attribute.
///
/// Companion to the [`praxis_value`](crate::praxis_value) attribute for tests
/// the attribute cannot wrap — chiefly `proptest! { #[test] fn .. }` blocks,
/// where the test function is generated by another macro and so is not an
/// `ItemFn` the attribute can parse. Place the call at module scope, next to
/// the test:
///
/// ```text
/// proptest! {
/// #[test]
/// fn prop_mutated_prx_always_rejected(..) { .. }
/// }
/// pr4xis::register_praxis_value!(prop_mutated_prx_always_rejected, Honest, Verifiable, Deterministic);
/// ```
///
/// The first guarantee is primary; any others are secondary. The named
/// function is not checked to exist here — the completeness gate (registry
/// length vs the live `--list` count) is what catches an untagged test or a
/// tag whose name has no test.
/// Write this binary's registered tag set where the completeness gate expects
/// it.
///
/// `pkg` and `krate` must be the CALLER's `env!("CARGO_PKG_NAME")` and
/// `env!("CARGO_CRATE_NAME")` — they cannot be read here, because `env!` in
/// this file would expand to `pr4xis` no matter who called. They identify the
/// writing binary, and package+crate is what makes that unique: `pr4xis-cli`'s
/// bin target is itself named `pr4xis`, so the crate name alone collides with
/// the `pr4xis` library's.
///
/// Three destinations, in the order the gate uses them:
///
/// - a DIRECTORY — workspace mode. Every binary runs in ONE `cargo nextest
/// run` and each writes its own `<pkg>__<crate>.tags`, so the gate extracts
/// the archive once rather than once per binary.
/// - a FILE — single-crate mode, for running the gate against one crate.
/// - unset — print, for ad-hoc use.
///
/// One function rather than three copies: this is called by
/// [`constitution_coverage_gate!`](crate::constitution_coverage_gate), by
/// pr4xis's own gate below, and by `pr4xis-domains`' richer meta-test, which
/// asserts partition coverage before emitting and so cannot use the macro
/// wholesale.
/// Emit this test binary's registered tag set, for the completeness gate.
///
/// Place one invocation in every test binary the workspace builds:
///
/// ```text
/// #[cfg(all(test, not(target_arch = "wasm32")))]
/// pr4xis::constitution_coverage_gate!();
/// ```
///
/// PER BINARY IS NOT AN IMPLEMENTATION DETAIL — it is the whole reason this
/// macro exists. Tags register through a `linkme` distributed slice, and a
/// distributed slice is assembled by the LINKER, so it holds exactly the tags
/// linked into the binary being run and nothing else. A test binary with no
/// invocation of this macro therefore emits no tags at all, and contributes 0
/// to both sides of the gate's diff — `untagged=0 phantom=0`, which reads as
/// COMPLETE. That arithmetic is what let 156 tests across 11 binaries sit
/// unclassified while the gate reported success, so the gate now also fails
/// loudly on a suite that lists tests but emits nothing.
///
/// The body was hand-copied verbatim into four crates before this macro
/// existed (pr4xis, pr4xis-runtime, pr4xis-chat, pr4xis-domains); adding the
/// remaining binaries by copy would have made eleven. Writing it once means a
/// new test binary opts in with one line, which is the only way "every test
/// declares a guarantee" stays true as the workspace grows.
///
/// Fully-qualified paths throughout: this expands inside `pr4xis` itself
/// (`no_std` + `alloc`) as well as in ordinary `std` crates, so it can rely on
/// nothing being in scope at the call site.
/// Per-crate completeness-gate support: emit pr4xis-core's own tag set so
/// `scripts/constitution-gate.sh pr4xis` can diff it against `--list`. This
/// binds the substrate crate's tests to the constitution exactly as the domains
/// crate is bound — the constitution covers its own foundation, not only the
/// reasoning layer.