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
//! Emits `cfg(models_present)` when a DOWNLOADED model tree is on disk, so
//! `tests/fp16_guards.rs`'s graph sweep is **unignored and runs** exactly when
//! there is a fetched tree to sweep, and reports `ignored` — never a green
//! `ok` over zero models — when there is not.
//!
//! **Downloaded** is the load-bearing word, and it is why this is not simply
//! `Models/.is_dir()` any more. The VAD artifact
//! (`Models/vadkit/silero-vad-unified-256ms-v6.2.1.mlmodelc/`) is COMMITTED —
//! `.gitignore` un-ignores exactly that path — so `Models/` now exists in every
//! fresh clone and in CI's modelless `check`/`features` jobs. Keying the cfg on
//! its bare existence would un-ignore the sweep there, where the sweep's
//! fail-closed vendor manifest (every `KNOWN_DEFECTS` vendor: `alignkit`,
//! `speakerkit`, `argmax-speakerkit`) demands vendors a clone legitimately does
//! not have — turning a fresh `cargo test` red. So the predicate is "a vendor
//! directory other than the committed ones", i.e. somebody actually fetched
//! models.
//!
//! The committed VAD graph is not thereby left unswept. Once the cfg is on the
//! sweep walks `Models/` WHOLE, so CI's model job — which downloads whisper,
//! granite and ced-tiny on every PR — audits the vendored VAD graph too, and
//! its one fp16 guard site is additionally pinned hermetically by the parser
//! test `accepts_vadkits_stft_sqrt_guard`, which runs everywhere with no models
//! at all.
//!
//! Downloaded model families added to `MODELS_LOCK` need no change here, and
//! must not be added to `VENDORED`: `Models/ced/` is gitignored like
//! whisper's and granite's trees, so its presence DOES mean somebody fetched
//! models — exactly what this predicate is asking. Only a path `.gitignore`
//! un-ignores belongs in that list.
//!
//! `rerun-if-changed` on `Models/` re-runs this script when that tree changes,
//! so the cfg flips on as soon as the models are downloaded — a stale `ignored`
//! cannot outlive their arrival.
use ;
/// Vendor directories COMMITTED under `Models/`. Their presence is guaranteed
/// by the checkout and so says nothing about whether anyone fetched models;
/// they must not flip `models_present` on. Adding a vendored model here without
/// adding it to this list fails in the SAFE direction — the sweep switches on
/// for fresh clones and goes red loudly, rather than going quietly dark.
const VENDORED: & = &;
/// The workspace root: the nearest ancestor of this package whose `Cargo.toml`
/// declares a `[workspace]` table. `None` outside a workspace.
///
/// FOUND, not counted. A `../` hop count encodes the package's DEPTH in the
/// repository, so moving the package re-points it — and it fails silently,
/// because `..` always resolves: a wrong count lands on a real directory that
/// merely holds no models, and the whole fp16 graph sweep goes quietly dark
/// instead of red. Searching for Cargo's own definition of the root is
/// depth-independent and carries its own witness.
///
/// The test tree shares this idiom through `tests/support/workspace_root.rs`.
/// It is duplicated here rather than `#[path]`-included because a build script
/// must still compile from the published tarball, where which `tests/` files
/// ship is the packaging manifest's business and not this script's.
/// Whether `manifest` exists and holds a `[workspace]` table header.
///
/// Matched as a whole trimmed line, so the `[workspace.package]` and
/// `[workspace.dependencies]` tables — which a `starts_with` would accept —
/// cannot stand in for the one that actually defines the workspace.
/// Whether `models` holds any vendor directory that is not committed to the
/// repository. Dot-directories are skipped for the same reason the sweep's walk
/// skips them: `hf download` leaves a `.cache/huggingface/` bookkeeping tree
/// that is not a model.