calibrate: degraded lines built in the lib and pinned by the arm-and-language test

Soul arms s1 re-check: CLI-only mutants M7 and M10 (offsets zipped against the wrong language or label) survived.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Weksa 2026-11-13 14:53:32 +00:00
commit e94563b020
2 changed files with 30 additions and 14 deletions

View file

@ -1299,20 +1299,8 @@ fn main() -> Result<()> {
run.labelled(&format!("calibrate class={} prompted-{side} {}", c.name, k.line()))
);
}
for ((label, d), offsets) in degraded.iter().zip(&t.degraded).zip(&t.degraded_offset) {
let offsets: String = c
.languages
.iter()
.zip(offsets)
.map(|(l, o)| format!(" offset {}={o:+.4}", l.language))
.collect();
println!(
"{}",
run.labelled(&format!(
"calibrate class={} degraded={label} trials={} regressed={}{offsets}",
c.name, d.trials, d.regressed
))
);
for line in c.degraded_lines(&degraded) {
println!("{}", run.labelled(&format!("calibrate class={} {line}", c.name)));
}
println!(
"{}",

View file

@ -2044,6 +2044,25 @@ pub struct ClassTrials {
pub trials: Trials,
}
impl ClassTrials {
/// The text after `calibrate class=NAME ` of each degraded arm's line, one
/// per `labels` entry: its Regressed count and its composite offset from the
/// prompted mean in each language of the class.
pub fn degraded_lines(&self, labels: &[String]) -> Vec<String> {
let t = &self.trials;
labels
.iter()
.zip(&t.degraded)
.zip(&t.degraded_offset)
.map(|((label, d), offsets)| {
let offsets: String =
self.languages.iter().zip(offsets).map(|(l, o)| format!(" offset {}={o:+.4}", l.language)).collect();
format!("degraded={label} trials={} regressed={}{offsets}", d.trials, d.regressed)
})
.collect()
}
}
#[derive(Debug)]
pub enum CalibrateOutcome {
/// Draw labels with the number of prompts each has no answer to.
@ -3145,6 +3164,15 @@ mod tests {
assert_eq!(level.accepted, 0);
assert_eq!(low.regressed, 60);
assert_eq!(t.candidate, high.plus(level).plus(low));
// The printed lines keep each arm with its label and each offset with its language.
let class = ClassTrials {
name: "all".into(),
languages: ["en-US", "ja-JP"].map(|l| ClassLanguage { language: l.into(), n: 8, skipped: 0 }).into(),
trials: t,
};
let lines = class.degraded_lines(&["mild-1".to_string(), "mild-2".to_string()]);
assert_eq!(lines[0], "degraded=mild-1 trials=60 regressed=60 offset en-US=-0.1333 offset ja-JP=-0.4167");
assert_eq!(lines[1], "degraded=mild-2 trials=60 regressed=60 offset en-US=-0.5333 offset ja-JP=-0.2167");
}
#[test]