Freeze unseen music stress corpus and independently verified gated DTW experiment

This commit is contained in:
karl committed 2026-10-13 18:51:50 +02:00
1 parent 5ab24518b4
commit d27be302c8
14 files changed
+1305 -6

No files matched your search

+66
View File
@@ -374,6 +374,10 @@ fn main() -> Result<()> {
report["alignment_policy"] = asr["alignment_policy"].clone();
report["alignment_policy_sha256"] = asr["alignment_policy_sha256"].clone();
report["alignment_contract_sha256"] = asr["alignment_contract_sha256"].clone();
if asr.get("combination_policy").is_some() {
report["combination_policy"] = asr["combination_policy"].clone();
report["combination_policy_sha256"] = asr["combination_policy_sha256"].clone();
}
}
report["phase"] = json!("document_encoding");
checkpoint(&output, &report)?;
@@ -487,6 +491,68 @@ mod tests {
.is_err());
}
#[test]
fn frozen_gated_dtw_pool_requires_all_sources_windows_and_policy_bytes() {
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../..");
let path = root.join(".searchi/speech/gated-base-results.json");
if !path.exists() {
return;
}
let fixture: Value =
serde_json::from_slice(&fs::read(root.join("fixtures/media/fixture.json")).unwrap())
.unwrap();
let mut report: Value = serde_json::from_slice(&fs::read(path).unwrap()).unwrap();
let plan = include_str!("../../speech-vad/gated-dtw-policy.json");
report["combination_policy_utf8"] = json!(plan);
report["combination_policy"] = json!(alignment::COMBINATION_POLICY);
report["combination_policy_sha256"] = json!(alignment::COMBINATION_SHA);
report["alignment_policy"] = json!(alignment::DTW_POLICY);
report["alignment_policy_sha256"] = json!(alignment::DTW_POLICY_SHA);
report["alignment_contract_sha256"] = json!(alignment::DTW_CONTRACT_SHA);
// Explicitly synthetic token points test the coverage/protocol path,
// not actual alignment or quality. Original frozen VAD windows unchanged.
for row in report["rows"].as_array_mut().unwrap() {
for window in row["windows"].as_array_mut().unwrap() {
for segment in window["actual_whisper_json"]["transcription"]
.as_array_mut()
.unwrap()
{
segment["tokens"] = json!([{"id":100,"text":segment["text"],"offsets":segment["offsets"],"t_dtw":number(&segment["offsets"]["from"]).unwrap()/10}]);
}
window["aligned_segments"] = json!(alignment::reconstruct_mode(
&window["actual_whisper_json"],
number(&window["offset_ms"]).unwrap(),
number(&window["duration_ms"]).unwrap(),
true
)
.unwrap());
}
}
assert!(eligible(&report, &fixture).unwrap().1.is_empty());
let mut changed = report.clone();
changed["combination_policy_utf8"] = json!(format!("{plan}\n"));
assert!(eligible(&changed, &fixture).is_err());
let mut changed = report.clone();
changed["rows"].as_array_mut().unwrap().pop();
assert!(eligible(&changed, &fixture).is_err());
let mut changed = report.clone();
changed["rows"][0]["windows"].as_array_mut().unwrap().pop();
assert!(eligible(&changed, &fixture).is_err());
let mut changed = report.clone();
let no_speech = changed["rows"]
.as_array_mut()
.unwrap()
.iter_mut()
.find(|row| row["status"] == "no_speech")
.unwrap();
no_speech["asr_not_run"] = json!(false);
assert!(eligible(&changed, &fixture).is_err());
let mut changed = report;
changed["rows"][0]["windows"][0]["actual_whisper_json"]["transcription"][0]["tokens"][0]
["t_dtw"] = json!(-1);
assert!(eligible(&changed, &fixture).is_err());
}
#[test]
fn aligned_pool_preserves_all_competitors_and_marks_real_failures_ineligible() {
let hash = "a".repeat(64);