Coverage Report

Created: 2026-10-23 22:23

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
super-stt-indexer/src/main.rs
Line
Count
Source
1
// SPDX-License-Identifier: GPL-3.0-only
2
//! `super-stt-indexer`: builds Super STT's backend registry index. The
3
//! indexer is `super_engine_indexer`'s; what is here is what makes it Super
4
//! STT's.
5
6
use super_engine_indexer::Indexer;
7
use super_stt_registry_types::Stt;
8
9
/// Entries that predate the `id` requirement, and the migration backlog.
10
///
11
/// `registry.schema.json` requires an `id` of *every* entry, so an editor
12
/// already flags these six. They are tolerated here so the scheduled index
13
/// build keeps publishing a catalog while they are fixed one at a time —
14
/// removing a name without fixing its backend would take every user's Browse
15
/// listing down with it.
16
///
17
/// Fixing one is not a `registry.toml` edit. An entry that declares an `id`
18
/// pins the release to it, so the order is: add `[backend].id` to that
19
/// backend's own `backend.toml`, cut a release, *then* add the same id here
20
/// and delete the name below. Adding the id here first earns an `IdMismatch`.
21
const GRANDFATHERED: &[&str] = &[
22
    "deepgram",
23
    "mistral",
24
    "openai",
25
    "qwen3_asr",
26
    "voxtral",
27
    "whisper",
28
];
29
30
const INDEXER: Indexer = Indexer {
31
    name: "super-stt-indexer",
32
    user_agent: Stt::USER_AGENT,
33
    grandfathered: GRANDFATHERED,
34
};
35
36
#[tokio::main(flavor = "multi_thread", worker_threads = 4)]
37
2
async fn main() -> anyhow::Result<()> {
38
2
    super_engine_indexer::main::<Stt>(&INDEXER).await
39
2
}
40
41
#[cfg(test)]
42
mod tests {
43
    use super::GRANDFATHERED;
44
    use super_engine_indexer::registry_toml::Registry;
45
46
    /// The shipped file must keep parsing as the `id` requirement lands.
47
    #[test]
48
1
    fn the_in_repo_registry_parses() {
49
1
        let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
50
1
            .parent()
51
1
            .unwrap();
52
1
        let text = std::fs::read_to_string(root.join("registry/registry.toml")).unwrap();
53
1
        Registry::parse(&text, GRANDFATHERED).expect("registry.toml parses");
54
1
    }
55
56
    /// The entries still being migrated keep publishing without an `id`.
57
    #[test]
58
1
    fn accepts_a_grandfathered_entry_without_an_id() {
59
1
        let text = "[voxtral]\n    repo = \"github.com/jorge-menjivar/super-stt-voxtral\"\n    forge = \"github\"\n";
60
1
        Registry::parse(text, GRANDFATHERED).expect("existing entries are exempt");
61
1
    }
62
}