{"record":{"id":"863bbce8f93dd96a","repo":"Hmbown/CodeWhale","slug":"tempdir-check","errorCode":null,"errorMessage":"tempdir","messagePattern":"tempdir","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/release/src/check.rs","lineNumber":217,"sourceCode":"        let entry = UpdateCheckCache {\n            checked_at_unix: 1_000_000,\n            latest_tag: None,\n        };\n        assert!(!entry.is_fresh(1_000_000, 0));\n    }\n\n    #[test]\n    fn a_future_timestamp_is_stale_not_permanently_fresh() {\n        let entry = UpdateCheckCache {\n            checked_at_unix: 2_000_000,\n            latest_tag: Some(\"v9.9.9\".to_string()),\n        };\n        assert!(!entry.is_fresh(1_000_000, 24));\n    }\n\n    #[test]\n    fn store_then_load_round_trips_and_survives_an_existing_file() {\n        let dir = tempfile::tempdir().expect(\"tempdir\");\n        let path = cache_path_in(dir.path());\n        assert_eq!(path.file_name().unwrap(), UPDATE_CHECK_CACHE_FILE);\n\n        let first = UpdateCheckCache {\n            checked_at_unix: 42,\n            latest_tag: Some(\"v0.9.5\".to_string()),\n        };\n        first.store(&path).expect(\"store\");\n        assert_eq!(UpdateCheckCache::load(&path), Some(first));\n\n        // Overwriting in place must not leave the temp file behind.\n        let second = UpdateCheckCache {\n            checked_at_unix: 99,\n            latest_tag: None,\n        };\n        second.store(&path).expect(\"overwrite\");\n        assert_eq!(UpdateCheckCache::load(&path), Some(second));\n        assert!(!path.with_extension(\"json.tmp\").exists());","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/release/src/check.rs#L199-L235","documentation":"Test panic from `tempfile::tempdir().expect(\"tempdir\")` in the release crate's update-check tests: the tempdir helper failed to create a temporary directory. This is environmental, not logic — the test cannot even set up its scratch home directory.","triggerScenarios":"Calling tempfile::tempdir() in store_then_load_round_trips_and_survives_an_existing_file: panics when the OS temp directory is missing/unwritable (TMPDIR pointing at a removed path), the disk is full, or sandboxed CI restricts temp directory creation.","commonSituations":"CI runners with read-only or full /tmp; TMPDIR set to a nonexistent path; container sandboxes without /tmp; exhausted inodes or disk space on build machines.","solutions":["Verify the system temp directory exists and is writable: check TMPDIR/TMP env vars and `ls -ld $TMPDIR /tmp`.","Free disk space or inodes on the partition backing the temp directory.","Set TMPDIR to a writable path (e.g. TMPDIR=$(mktemp -d) cargo test -p codewhale-release) and rerun the test."],"exampleFix":"// before\ncargo test -p codewhale-release\n// after — point the test harness at a guaranteed-writable temp dir\nTMPDIR=$(mktemp -d) cargo test -p codewhale-release store_then_load_round_trips","handlingStrategy":"try-catch","validationCode":"// check the temp root is usable before running the suite\nstd::env::temp_dir()\n    .exists()\n    .then_some(())\n    .expect(\"system temp directory must exist; check TMPDIR\");","typeGuard":"fn tempdir_usable() -> bool {\n    let probe = std::env::temp_dir().join(\".cw-probe\");\n    std::fs::write(&probe, b\"x\").is_ok() && std::fs::remove_file(&probe).is_ok()\n}","tryCatchPattern":"let dir = tempfile::tempdir()\n    .unwrap_or_else(|e| panic!(\"tempdir unavailable — check TMPDIR/disk space: {e}\"));","preventionTips":["Keep TMPDIR pointing at an existing writable directory in CI configuration.","Monitor disk/inode headroom on build agents.","Run filesystem-touching tests on local tmpfs rather than network mounts."],"tags":["rust","test-environment","tempdir","filesystem"],"backgroundTag":"file-not-found","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"}