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
231
232
233
// Not every integration-test binary that includes `mod common;` uses every
// helper below (`model_io.rs` uses the model-path + sha helpers; the parity
// and state suites use the audio/fnv helpers). Each test file is its own
// crate, so an unused helper is dead code *in that crate* — allow it here so
// the shared module compiles clean under the workspace's `-D warnings` gate.
// The workspace-root anchor every `models_dir()` below resolves against, and
// the sibling-checkout anchor the oracle gates read. FOUND by searching upward
// for the `[workspace]` manifest, never counted in `../` hops — see its module
// doc for why a count is the wrong shape here. Re-exported so the binaries
// that pull this `common` in share the one resolver.
pub use ;
use ;
use ;
// The `coremlit_dir` hop that keeps every crate-relative fixture path below
// correct from BOTH packages that compile this shared module (`coremlit`'s own
// test binaries and `coremlit-parity`'s oracle binaries, which `#[path]`-include
// this very file). Kept in one place — see its module doc.
use coremlit_path;
/// The compiled VAD artifact's directory name within [`models_dir`] — the
/// FluidInference `silero-vad-unified-256ms-v6.2.1` `.mlmodelc` (design spec
/// §5; the v6.2.1 artifact ships pre-compiled, so this loads directly with no
/// `coremlcompiler` step). Its HF revision + per-file SHA-256 are pinned in
/// `tests/model_io.rs` — the alignkit/speakerkit convention for adopted models,
/// NOT `MODELS_LOCK` (which a whisperkit hermetic gate holds to exactly the
/// tables CI actually downloads; vad is not among them).
pub const ARTIFACT: &str = "silero-vad-unified-256ms-v6.2.1.mlmodelc";
/// Directory containing the vadkit model artifact.
///
/// Overridable via `VADKIT_TEST_MODELS`; otherwise falls back to
/// `<workspace>/Models/vadkit` (mirroring `speakerkit`'s
/// `SPEAKERKIT_TEST_MODELS`/`Models/speakerkit` and `alignkit`'s
/// `ALIGNKIT_TEST_MODELS`/`Models/alignkit`, one directory level down for this
/// crate's own model set).
///
/// Unlike every sibling kit's, that fallback needs NO download: the artifact
/// is COMMITTED at
/// `Models/vadkit/silero-vad-unified-256ms-v6.2.1.mlmodelc/` — 1.1 MiB, MIT,
/// un-ignored by name in `.gitignore` — so a fresh clone resolves it and CI
/// runs the vad model gates with no fetch step (`.github/workflows/ci.yml`,
/// the `check` job). To re-fetch it from the Hub instead (a re-vendor, or to
/// verify the committed bytes against the source):
///
/// ```text
/// hf download FluidInference/silero-vad-coreml \
/// --include "silero-vad-unified-256ms-v6.2.1*" \
/// --revision b419383c55c110e2c9271fa6ee0ea83d03c70d96 \
/// --local-dir Models/vadkit
/// ```
///
/// That download also writes a `Models/vadkit/.cache/huggingface/` bookkeeping
/// tree, which stays gitignored — only the `.mlmodelc` is committed.
/// Path to the compiled VAD `.mlmodelc` artifact.
/// A committed parity fixture: a short 16 kHz mono clip borrowed by relative
/// path from the `speakerkit` crate's fixtures (dia's parity corpus), plus its
/// provenance. Borrowed rather than re-committed — both crates live in this
/// workspace and move together, exactly as `alignkit` borrows whisperkit's
/// `ted_60.wav`.
/// The Swift-trace parity fixture set (spec §6 model-layer gate). Two real-
/// speech clips from dia's parity corpus: `02_pyannote_sample` is pyannote's
/// canonical multi-speaker demo (30.0 s → 118 chunks); `07_yuhewei_dongbei_
/// english` is a second real conversational clip (25.26 s → 99 chunks) that
/// exercises the short-final-chunk padding path. Together: 217 chunks across
/// 2 clips (the gate requires ≥ 40 chunks over ≥ 2 clips). Speaker counts are
/// deliberately NOT claimed here beyond "multi-speaker demo" — the fixture
/// names in dia's corpus do not reliably encode speaker counts, and VAD only
/// needs real speech with speech/non-speech transitions.
pub const FIXTURES: & = &;
/// Absolute path to a borrowed fixture WAV by basename.
/// Directory holding this crate's committed Swift-trace goldens.
/// Loads a 16 kHz mono WAV as `f32` samples — the single source of truth both
/// the Swift dumper (`tests/vad/swift/.../DumpVadTraces.swift`'s `readPcm16Mono16k`)
/// and the Rust gate feed their models, so the two sides are input-identical by
/// construction; the [`fnv1a_f32`] recorded in each golden re-proves it at
/// replay time (the alignkit/speakerkit Gate-1 lesson: prove the inputs match).
///
/// 16-bit PCM is scaled by `1 / 32768`; float WAVs pass through.
///
/// # Panics
/// If the file is missing, not 16 kHz mono, or an unsupported bit depth.
/// FNV-1a-64 over the little-endian bytes of `samples` — byte-for-byte the
/// same construction as `coremlit::audio::speaker::tests::common::fnv1a_f32` and the Swift
/// dumper's `fnv1aHex`, so the golden's recorded input hash proves both sides
/// fed the model element-identical audio.
/// Lowercase 16-hex-digit rendering of a [`fnv1a_f32`] hash for JSON storage.
/// Lowercase-hex SHA-256 digest of a file's contents — the provenance/
/// integrity pin over the downloaded model artifacts (`tests/model_io.rs`).
// ── Host-class provenance for the committed-Swift-golden parity gate ────────
//
// The gate stamps each golden with the host-class it was generated on and
// enforces its tight bound only against a matching host, because CoreML floats
// are not contracted portable across macOS builds or chips (#36). The
// predicate, the verdict enum and the two diagnosis strings live in ONE file
// under `tests/support/` — the `coremlit_dir` convention — because the speaker
// and vad `common/mod.rs` used to carry byte-identical copies of them and
// whisper needed a third. Re-exported here so `common::HostClass` and friends
// keep their existing spelling; this suite's hermetic tests drive the shared
// copy.
// Named rather than glob-re-exported so the shared surface is legible here, and
// `allow`ed for the same reason this file's top-level `allow(dead_code)` exists:
// every test binary that says `mod common;` compiles this whole module, and the
// ones with no golden to host-gate reference none of these four.
pub use ;
// ── Model-gate visibility (#61) ─────────────────────────────────────────────
//
// NOT `#[ignore]`d, deliberately. This is the ordinary-run half of the gate
// accounting: an ignored-ONLY run (`-- --ignored`, what every CI gate uses)
// never selects it, and it never appears in an ignored-only `--list`, so the
// anti-vacuum counts those gates take are unchanged. What it adds is the case
// no gate covers — a plain, modelless run — where the skipped gates otherwise
// say nothing but `ignored`. Mechanism, and what it does and does not refuse,
// in the shared module.
/// Reports how many of this binary's tests are `#[ignore]`d vadkit model gates
/// that did not run, and whether the models root they read is on disk.