{"record":{"id":"94826b1b1b4ff024","repo":"jdx/mise","slug":"no-baseline","errorCode":null,"errorMessage":"no baseline","messagePattern":"no baseline","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/checkpoint/preimages.rs","lineNumber":280,"sourceCode":"            tempfile::tempdir_in(crate::system::history::sync::layout::Roots::current().home)?;\n        let first = live.path().join(\"first\");\n        let second = live.path().join(\"second\");\n        let sibling = live.path().join(\"sibling\");\n        for path in [&first, &second, &sibling] {\n            std::fs::write(path, \"saved\")?;\n        }\n        let mut policy = FilePolicy::for_mode(FileMode::Track);\n        policy.autosave = false;\n        let entry = TrackedEntry::new(live.path().to_owned(), \"track\", policy);\n        let tracked = TrackedSet {\n            entries: vec![entry.clone()],\n            ..Default::default()\n        };\n        let store = Store::open_in(state.path())?;\n        let mut draft = Draft::new(Trigger::Baseline);\n        draft.explicit_paths.push(live.path().to_owned());\n        let Outcome::Created(baseline) = store.attempt(&tracked, draft)? else {\n            panic!(\"no baseline\")\n        };\n        for path in [&first, &second, &sibling] {\n            std::fs::write(path, \"unsaved\")?;\n        }\n        let mut before = baseline.commit;\n        let mut journal = vec![];\n        for path in [&first, &second, &first] {\n            let prior = PathSnapshot::capture_with(state.path(), path, Capture::Full);\n            if let Some(commit) =\n                store.protect_manual_preimage(&before, &tracked, path, &prior, &journal)?\n            {\n                before = commit.commit;\n            }\n            journal.push(JournalEntry::PathChanged {\n                part: \"dotfiles\".into(),\n                item: \"test\".into(),\n                path: path.clone(),\n                prior,","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/history/checkpoint/preimages.rs#L262-L298","documentation":"A test panic in src/system/history/checkpoint/preimages.rs asserting that creating a baseline via `store.attempt` with `Trigger::Baseline` yields `Outcome::Created`. Any other outcome (no checkpoint produced, e.g. because the draft matched nothing) triggers `panic!(\"no baseline\")`. The baseline is required for subsequent preimage/journal operations in the test.","triggerScenarios":"`store.attempt(&tracked, draft)` with a `Trigger::Baseline` draft whose `explicit_paths` do not produce a created checkpoint — e.g. path not tracked, empty diff, or attempt short-circuiting to a non-Created outcome.","commonSituations":"`explicit_paths` pointing at files outside the tracked set; `tracked` configuration filtering out the live path; regressions in baseline creation that treat the first attempt as a no-op.","solutions":["Ensure the path pushed into `draft.explicit_paths` is covered by the `tracked` set used for the attempt.","Print the returned `Outcome` in the else branch to identify which non-Created variant was returned.","Verify the file at `live.path()` exists and has content before attempting the baseline.","Check `Store::attempt` baseline handling for early returns when explicit_paths are set."],"exampleFix":"// before\nlet Outcome::Created(baseline) = store.attempt(&tracked, draft)? else {\n    panic!(\"no baseline\")\n};\n// after\nlet outcome = store.attempt(&tracked, draft)?;\nlet Outcome::Created(baseline) = outcome else {\n    panic!(\"no baseline, got {outcome:?}\")\n};","handlingStrategy":"validation","validationCode":"// rust\nfor p in &draft.explicit_paths {\n    if !p.exists() {\n        return Err(format!(\"baseline path {} does not exist\", p.display()));\n    }\n}\nif !tracked.covers(&draft.explicit_paths) {\n    return Err(\"baseline paths are not in the tracked set\");\n}","typeGuard":"fn baseline_of(outcome: Outcome) -> Option<Created> {\n    match outcome {\n        Outcome::Created(c) => Some(c),\n        _ => None,\n    }\n}","tryCatchPattern":"// rust\nlet outcome = store.attempt(&tracked, draft)?;\nlet Outcome::Created(baseline) = outcome else {\n    return Err(anyhow!(\"no baseline, got {outcome:?}\"));\n};","preventionTips":["Confirm explicit_paths are tracked and exist before baseline attempts.","Exhaustively match Outcome variants; never assume the happy path.","Include the actual outcome in error messages.","Keep baseline-creation behavior covered by regression tests."],"tags":["rust","test-assertion","history","baseline"],"backgroundTag":"invalid-enum-value","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}