{"record":{"id":"0a61782cd3f47709","repo":"jdx/mise","slug":"other","errorCode":null,"errorMessage":"{other:?}","messagePattern":"\\{other:\\?\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/journal.rs","lineNumber":626,"sourceCode":"        assert_eq!(std::fs::read(&on_disk).unwrap(), big);\n        // content-addressed: storing again is a no-op with the same id\n        let again = Blob::store_in(tmp.path(), &big).unwrap();\n        assert_eq!(again, stored);\n    }\n\n    #[test]\n    fn snapshots_capture_each_kind_of_path() {\n        let tmp = tempfile::tempdir().unwrap();\n        let state = tmp.path().join(\"state\");\n        let file = tmp.path().join(\"file\");\n        std::fs::write(&file, \"content\").unwrap();\n        assert!(matches!(\n            PathSnapshot::capture_with(&state, &tmp.path().join(\"nope\"), Capture::Full),\n            PathSnapshot::Missing\n        ));\n        match PathSnapshot::capture_with(&state, &file, Capture::Full) {\n            PathSnapshot::File { content, .. } => assert_eq!(content.size, 7),\n            other => panic!(\"{other:?}\"),\n        }\n        #[cfg(unix)]\n        {\n            let link = tmp.path().join(\"link\");\n            std::os::unix::fs::symlink(\"file\", &link).unwrap();\n            assert!(matches!(\n                PathSnapshot::capture_with(&state, &link, Capture::Full),\n                PathSnapshot::Symlink { dest } if dest == Path::new(\"file\")\n            ));\n            nix::unistd::mkfifo(&tmp.path().join(\"fifo\"), nix::sys::stat::Mode::S_IRWXU).unwrap();\n            assert!(matches!(\n                PathSnapshot::capture_with(&state, &tmp.path().join(\"fifo\"), Capture::Full),\n                PathSnapshot::Unrecorded { .. }\n            ));\n        }\n        let dir = tmp.path().join(\"dir/nested\");\n        std::fs::create_dir_all(&dir).unwrap();\n        std::fs::write(dir.join(\"a\"), \"a\").unwrap();","sourceCodeStart":608,"sourceCodeEnd":644,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/history/journal.rs#L608-L644","documentation":"A test panic in src/system/history/journal.rs from a `match` on `PathSnapshot::capture_with`. The test expects the `File` variant (with a `content.size` of 7) for a regular file path; any other variant (`Missing`, `Directory`, `Symlink`, etc.) hits the catch-all `other => panic!(\"{other:?}\")`. It indicates the path snapshotter classified a regular file as something else.","triggerScenarios":"`PathSnapshot::capture_with(&state, &file, Capture::Full)` returning a non-`File` variant — e.g. the file does not exist at capture time (Missing), was replaced by a symlink/directory, or capture logic misclassifies the path.","commonSituations":"Test fixture not creating the file before capture; path resolution differences (relative vs absolute); changes to `capture_with` stat/metadata handling; symlinked temp directories (e.g. macOS /tmp) confusing type detection.","solutions":["Verify the file exists and is a regular file at the exact path passed to `capture_with` before capture.","Print the returned `PathSnapshot` variant in the catch-all to see the actual classification.","Check `capture_with` metadata handling (file_type, symlink_follow) for regressions.","Canonicalize temp paths if platform symlinked temp dirs change the observed file type."],"exampleFix":"// before\nmatch PathSnapshot::capture_with(&state, &file, Capture::Full) {\n    PathSnapshot::File { content, .. } => assert_eq!(content.size, 7),\n    other => panic!(\"{other:?}\"),\n}\n// after\nmatch PathSnapshot::capture_with(&state, &file, Capture::Full) {\n    PathSnapshot::File { content, .. } => assert_eq!(content.size, 7),\n    other => panic!(\"expected File snapshot for {file:?}, got {other:?}\"),\n}","handlingStrategy":"validation","validationCode":"// rust\nlet meta = std::fs::symlink_metadata(&file)?;\nif !meta.is_file() {\n    return Err(format!(\"{} is not a regular file\", file.display()));\n}","typeGuard":"fn as_file_snapshot(snap: &PathSnapshot) -> Option<&Content> {\n    match snap {\n        PathSnapshot::File { content, .. } => Some(content),\n        _ => None,\n    }\n}","tryCatchPattern":"// rust\nmatch PathSnapshot::capture_with(&state, &path, Capture::Full) {\n    PathSnapshot::File { content, .. } => /* ... */,\n    other => return Err(anyhow!(\"expected File snapshot, got {other:?}\")),\n}","preventionTips":["Check path existence and type before capturing snapshots.","Handle Missing and Symlink variants explicitly in callers.","Canonicalize paths on platforms with symlinked temp dirs.","Include the offending path and variant in diagnostics."],"tags":["rust","test-assertion","filesystem","snapshot"],"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-14T05:17:10.506Z"}