{"record":{"id":"88836b837427ccc6","repo":"Hmbown/CodeWhale","slug":"write-junk","errorCode":null,"errorMessage":"write junk","messagePattern":"write junk","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/release/src/check.rs","lineNumber":253,"sourceCode":"        assert!(!path.with_extension(\"json.tmp\").exists());\n    }\n\n    #[test]\n    fn store_creates_a_missing_home_directory() {\n        let dir = tempfile::tempdir().expect(\"tempdir\");\n        let path = cache_path_in(&dir.path().join(\"nested\").join(\"home\"));\n        UpdateCheckCache::now(Some(\"v1.0.0\".to_string()))\n            .store(&path)\n            .expect(\"store into a fresh directory\");\n        assert!(path.exists());\n    }\n\n    #[test]\n    fn a_corrupt_or_absent_cache_reads_as_none() {\n        let dir = tempfile::tempdir().expect(\"tempdir\");\n        let path = cache_path_in(dir.path());\n        assert_eq!(UpdateCheckCache::load(&path), None);\n        std::fs::write(&path, b\"{ not json\").expect(\"write junk\");\n        assert_eq!(UpdateCheckCache::load(&path), None);\n    }\n\n    #[test]\n    fn falsey_flag_values_do_not_count_as_set() {\n        for value in [\"\", \"0\", \"false\", \"FALSE\", \" no \", \"off\"] {\n            assert!(\n                !flag_value_is_truthy(value),\n                \"{value:?} should not read as set\"\n            );\n        }\n        for value in [\"1\", \"true\", \"yes\", \"azure-pipelines\"] {\n            assert!(flag_value_is_truthy(value), \"{value:?} should read as set\");\n        }\n    }\n\n    #[test]\n    fn suppression_reason_names_the_responsible_variable() {","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/release/src/check.rs#L235-L271","documentation":"Test panic from `std::fs::write(&path, b\"{ not json\").expect(\"write junk\")`: the test could not write its deliberately corrupt cache fixture to disk. This is a raw std::fs::write failure inside the test, independent of the library's own store logic.","triggerScenarios":"Calling std::fs::write on the cache path inside the tempdir: fails when the file exists but is not writable (permission change), the directory was removed mid-test, the disk filled, or another process holds the path exclusively locked.","commonSituations":"Shared TMPDIR with concurrent test runs deleting each other's directories; antivirus/backup software locking newly created files; read-only remounts or quota exhaustion during a test run.","solutions":["Ensure tests do not share a fixed TMPDIR path concurrently; use a unique tempdir per run.","Check filesystem permissions and free space at the temp location.","Look for file-locking agents (AV, sync clients) on the machine and exclude the temp directory from scanning."],"exampleFix":"// before\nstd::fs::write(&path, b\"{ not json\").expect(\"write junk\");\n// after — verify the directory still exists before writing\nassert!(path.parent().map(|d| d.exists()).unwrap_or(false));\nstd::fs::write(&path, b\"{ not json\").expect(\"write junk\");","handlingStrategy":"validation","validationCode":"// confirm the fixture path is writable before writing the junk payload\nassert!(path.parent().map(|d| d.exists()).unwrap_or(false), \"fixture dir vanished mid-test\");","typeGuard":"fn writable_file(p: &Path) -> bool {\n    p.metadata().map(|m| !m.permissions().readonly()).unwrap_or(true) // absent files are writable if the dir is\n}","tryCatchPattern":"std::fs::write(&path, b\"{ not json\")\n    .unwrap_or_else(|e| panic!(\"could not write corrupt-cache fixture: {e}\"));","preventionTips":["Give each test run its own unique tempdir; never share fixed paths across parallel runs.","Exclude CI temp directories from antivirus/backup/sync scanning.","Re-check disk space if raw fs::write fails inside an otherwise passing suite."],"tags":["rust","filesystem","test-panic","io"],"backgroundTag":"file-write-failed","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}