{"record":{"id":"9bd75dea98b6fe8b","repo":"jdx/mise","slug":"expected-a-checkpoint","errorCode":null,"errorMessage":"expected a checkpoint","messagePattern":"expected a checkpoint","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/checkpoint.rs","lineNumber":1171,"sourceCode":"        store.unavailable = Some(\"Git is unavailable\".into());\n        let mut draft = Draft::new(Trigger::Agent);\n        draft.description = Some(\"labeled operation\".into());\n        assert!(matches!(\n            store.attempt(&TrackedSet::default(), draft)?,\n            Outcome::Unavailable(_)\n        ));\n        assert!(store::load_index_in(temp.path())?.entries.is_empty());\n        Ok(())\n    }\n\n    #[test]\n    fn numeric_commit_prefixes_cannot_silently_select_another_checkpoint() -> Result<()> {\n        let temp = tempfile::tempdir()?;\n        let store = Store::open_in(temp.path())?;\n        let Outcome::Created(mut first) =\n            store.attempt(&TrackedSet::default(), Draft::new(Trigger::Agent))?\n        else {\n            panic!(\"expected a checkpoint\");\n        };\n        first.id = 42;\n        first.checkpoint.uuid = \"123abc\".into();\n        let mut second = first.clone();\n        second.id = 123;\n        second.checkpoint.uuid = \"abcdef\".into();\n        let entries = vec![*first, *second];\n        assert!(store::resolve_ref(\"12\", &entries).is_err());\n        assert_eq!(store::resolve_ref(\"42\", &entries)?, 42);\n        assert_eq!(store::resolve_ref(\"123\", &entries)?, 123);\n        assert_eq!(store::resolve_ref(\"commit:12\", &entries)?, 42);\n        assert_eq!(store::resolve_ref(\"commit:123\", &entries)?, 42);\n        assert!(store::resolve_ref(\"commit:\", &entries).is_err());\n        assert!(store::resolve_ref(\"\", &entries).is_err());\n        assert!(store::resolve_ref(\"1234567890123456789012345678901234567890\", &entries).is_err());\n        assert_eq!(store::resolve_ref(\"123abc\", &entries)?, 42);\n        Ok(())\n    }","sourceCodeStart":1153,"sourceCodeEnd":1189,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/history/checkpoint.rs#L1153-L1189","documentation":"A test panic in src/system/history/checkpoint.rs asserting that `Store::attempt` returned `Outcome::Created` (a new checkpoint). Any other `Outcome` variant (e.g. `Outcome::Identical`, `Noop`, or an error-mapped outcome) reaches the else branch and panics with 'expected a checkpoint'. It means the history store did not create a checkpoint where the test requires one.","triggerScenarios":"Calling `store.attempt(&TrackedSet::default(), Draft::new(Trigger::Agent))` on a fresh store and getting a non-`Created` outcome — e.g. the tracked set is empty so nothing is considered changed, or attempt logic classifies the draft as a no-op.","commonSituations":"Default `TrackedSet` matching no files so attempt returns a no-op outcome; changes to checkpoint deduplication/skip logic; tests refactored so a prior checkpoint already covers the draft, making `attempt` return `Identical` instead of `Created`.","solutions":["Verify the `TrackedSet`/draft actually covers changed content so `attempt` has something to checkpoint.","Inspect the returned `Outcome` variant (print it in the else branch) to see which no-op path was taken.","Check recent changes to `Store::attempt` outcome classification (dedup, empty-draft short-circuit).","Seed the store with real file changes before the first attempt if a baseline is required."],"exampleFix":"// before\nlet Outcome::Created(mut first) =\n    store.attempt(&TrackedSet::default(), Draft::new(Trigger::Agent))?\nelse {\n    panic!(\"expected a checkpoint\");\n};\n// after\nlet outcome = store.attempt(&TrackedSet::default(), Draft::new(Trigger::Agent))?;\nlet Outcome::Created(mut first) = outcome else {\n    panic!(\"expected a checkpoint, got {outcome:?}\");\n};","handlingStrategy":"type-guard","validationCode":"// rust\nif tracked.is_empty() {\n    return Err(\"tracked set is empty; attempt cannot create a checkpoint\");\n}","typeGuard":"fn created(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(cp) = outcome else {\n    return Err(anyhow!(\"expected a checkpoint, got {outcome:?}\"));\n};","preventionTips":["Ensure drafts cover actual changes before calling attempt.","Match exhaustively on Outcome instead of assuming Created.","Log unexpected outcome variants in tests for faster diagnosis.","Track regressions in attempt short-circuit paths with dedicated tests."],"tags":["rust","test-assertion","history","checkpoint"],"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"}