stance_ablation: read the round before making ablation-<n>, so a refused ablation writes nothing
367c56c moved the round check below the folder and store reset. Test: a refused
ablation of an absent round makes no folder and keeps an earlier ablation's store.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
eb2d220a56
commit
f04946ced6
2 changed files with 24 additions and 2 deletions
|
|
@ -1428,6 +1428,8 @@ impl RunStores {
|
|||
) -> Result<AblationOutcome, RunError> {
|
||||
let store = |_| RunError::Store;
|
||||
check_drift(self, model, scorer)?;
|
||||
// A refused round writes nothing: the round is read before any folder is made.
|
||||
let mut splits = self.held_splits(n, &[Split::Train, Split::Validation])?;
|
||||
let inventory = self.inventory.inventory().map_err(store)?;
|
||||
let ontology = self.ontology.ontology().map_err(store)?;
|
||||
|
||||
|
|
@ -1444,8 +1446,6 @@ impl RunStores {
|
|||
PacketStore::open(&dir.join("permute.cc")).map_err(store)?,
|
||||
];
|
||||
|
||||
let mut splits = self.held_splits(n, &[Split::Train, Split::Validation])?;
|
||||
|
||||
let mut waiting: Vec<String> = Vec::new();
|
||||
let mut readings = Vec::new();
|
||||
// Texts per split: (item text, recorded, replay, [drop, permute]).
|
||||
|
|
|
|||
|
|
@ -4121,6 +4121,28 @@ fn a_stance_ablation_refuses_a_cycle_round_and_missing_round_answers() {
|
|||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_refused_stance_ablation_creates_no_folder_and_wipes_no_store() {
|
||||
let (dao, _) = recorded_dao(|_| {});
|
||||
let (mut rec, mut model) = (Lowerer::new(reader), Lowerer::new(reader));
|
||||
// No round 99: no folder appears.
|
||||
assert!(matches!(
|
||||
dao.run.stance_ablation(99, &mut rec, &mut model, &Scorer::new(Bag)),
|
||||
Err(RunError::Malformed("round"))
|
||||
));
|
||||
assert!(!dao.run.ablation_dir(99).exists(), "a refused ablation makes no folder");
|
||||
// An earlier ablation of a refused n keeps its stores byte for byte.
|
||||
let kept = dao.run.ablation_dir(2);
|
||||
std::fs::create_dir_all(&kept).unwrap();
|
||||
std::fs::write(kept.join("base.cc"), b"earlier ablation").unwrap();
|
||||
assert!(matches!(
|
||||
dao.run.stance_ablation(2, &mut rec, &mut model, &Scorer::new(Bag)),
|
||||
Err(RunError::Malformed("round"))
|
||||
));
|
||||
assert_eq!(std::fs::read(kept.join("base.cc")).unwrap(), b"earlier ablation");
|
||||
assert_eq!(std::fs::read_dir(&kept).unwrap().count(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_stance_ablation_refuses_a_cycle_round() {
|
||||
let mut dao = dao();
|
||||
|
|
|
|||
Loading…
Reference in a new issue