{"record":{"id":"7540169c014e3053","repo":"Hmbown/CodeWhale","slug":"tempdir-client","errorCode":null,"errorMessage":"tempdir","messagePattern":"tempdir","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/client.rs","lineNumber":8512,"sourceCode":"        // from model_bound_request_leaves_ordinary_tool_output_unchanged\n        {\n            let client = client_with_config_secret_sentinels();\n            let ordinary = \"tests passed: 42\\nREADME.md updated\\n\";\n            let prepared =\n                client.prepare_model_bound_request(request_with_tool_result(ordinary.to_string()));\n            assert_eq!(tool_result_content(&prepared), ordinary);\n        }\n    }\n\n    /// The `[redaction] model_bound = \"disabled\"` opt-out, once confirmed on\n    /// the startup gate, must let the model see tool output byte-for-byte —\n    /// including configured secrets and credential-shaped values that the\n    /// default masking would have removed (#5546 keeps code quotable; this\n    /// opt-out goes further and keeps credentials quotable too).\n    #[test]\n    fn confirmed_opt_out_keeps_configured_secrets_visible_to_the_model() {\n        let _env_lock = crate::test_support::lock_test_env();\n        let tmp = tempfile::tempdir().expect(\"tempdir\");\n        let home = tmp.path().join(\"home\");\n        std::fs::create_dir_all(&home).expect(\"create isolated home\");\n        let _home = crate::test_support::EnvVarGuard::set(\"HOME\", &home);\n        let _userprofile = crate::test_support::EnvVarGuard::set(\"USERPROFILE\", &home);\n        let codewhale_home = tmp.path().join(\"codewhale-home\");\n        let _codewhale_home =\n            crate::test_support::EnvVarGuard::set(\"CODEWHALE_HOME\", &codewhale_home);\n        std::fs::create_dir_all(&codewhale_home).expect(\"create config home\");\n        std::fs::write(\n            codewhale_home.join(\"config.toml\"),\n            \"[redaction]\\nmodel_bound = \\\"disabled\\\"\\n\",\n        )\n        .expect(\"write opt-out request\");\n        codewhale_config::redaction::record_model_bound_disabled_confirmation(\n            &codewhale_home.join(\"config.toml\"),\n        )\n        .expect(\"record opt-out confirmation\");\n","sourceCodeStart":8494,"sourceCodeEnd":8530,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/client.rs#L8494-L8530","documentation":"This is a Rust `expect` panic on `tempfile::tempdir()`, which fails when the OS cannot create a temporary directory (e.g. missing TMPDIR, no permissions, or disk full). The test helpers in chat_completions.rs panic early rather than continuing without an isolated temp root, because every subsequent config write depends on it.","triggerScenarios":"Calling `app_with_mock_upstream_with_provider_extra`, `app_with_together_mock_upstream`, `app_with_root_deepseek_mock_upstream`, or `app_with_auth_boundary_mock_upstream` in an environment where `tempfile::tempdir()` returns Err: unwritable or nonexistent TMPDIR/tmp, sandboxed CI without /tmp access, or a full temp filesystem.","commonSituations":"CI runners with read-only or restricted /tmp; Docker containers with tiny tmpfs; macOS/Linux environments where TMPDIR points to a deleted directory.","solutions":["Ensure TMPDIR (or /tmp) exists and is writable by the test user before running tests","Free disk space on the partition backing the temp directory","Pass an explicit writable directory via `std::env::set_var(\"TMPDIR\", ...)` in test setup","Replace `expect` with proper error propagation if the helper should fail gracefully"],"exampleFix":"// before\nlet tmp = tempfile::tempdir().expect(\"tempdir\");\n// after\nlet tmp = tempfile::tempdir().expect(\"tempdir: ensure TMPDIR is writable and has free space\");","handlingStrategy":"validation","validationCode":"let tmp = tempfile::tempdir().map_err(|e| panic!(\"tempdir unavailable: {e}; check TMPDIR permissions/disk space\"))?;","typeGuard":null,"tryCatchPattern":"// Rust panics cannot be caught with try/catch; pre-validate the environment\nassert!(std::env::temp_dir().metadata().map(|m| m.is_dir()).unwrap_or(false), \"TMPDIR must be a writable directory\");","preventionTips":["Verify TMPDIR exists and is writable in CI setup steps","Monitor disk space on the temp filesystem","Use tempfile's Builder with explicit .tempdir_in() to a known-writable path"],"tags":["rust","tempdir","filesystem","test-infrastructure"],"backgroundTag":"file-open-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}