{"record":{"id":"6663d67144f99023","repo":"Hmbown/CodeWhale","slug":"credential-fixture","errorCode":null,"errorMessage":"credential fixture","messagePattern":"credential fixture","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/client.rs","lineNumber":8250,"sourceCode":"                .is_empty()\n        );\n    }\n\n    const CONFIG_SECRET_SENTINELS: [&str; 8] = [\n        \"deepseek-config-secret-001\",\n        \"arcee-config-secret-002\",\n        \"moonshot-config-secret-003\",\n        \"openrouter-config-secret-004\",\n        \"together-config-secret-005\",\n        \"xiaomi-config-secret-006\",\n        \"zai-active-config-secret-007\",\n        \"sakana-config-secret-008\",\n    ];\n\n    #[test]\n    fn codex_client_uses_one_coherent_external_credential_snapshot() {\n        let _env = crate::test_support::lock_test_env();\n        let temp = tempfile::tempdir().expect(\"credential fixture\");\n        let path = temp\n            .path()\n            .canonicalize()\n            .expect(\"canonical temp root\")\n            .join(\"auth.json\");\n        let token_a = crate::test_support::future_test_jwt(\"a\");\n        std::fs::write(\n            &path,\n            serde_json::to_vec(&serde_json::json!({\n                \"tokens\": {\"access_token\": token_a.clone(), \"account_id\": \"account-a\"}\n            }))\n            .expect(\"serialize fixture\"),\n        )\n        .expect(\"write fixture\");\n        let _auth_path = crate::test_support::EnvVarGuard::set(\"OPENAI_CODEX_AUTH_FILE\", &path);\n        let _access = crate::test_support::EnvVarGuard::remove(\"OPENAI_CODEX_ACCESS_TOKEN\");\n        let _legacy_access = crate::test_support::EnvVarGuard::remove(\"CODEX_ACCESS_TOKEN\");\n        let config = Config {","sourceCodeStart":8232,"sourceCodeEnd":8268,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/client.rs#L8232-L8268","documentation":"This is a Rust `expect` panic on `tempfile::tempdir()` inside the test `codex_client_uses_one_coherent_external_credential_snapshot` (crates/tui/src/client.rs). The test creates a temporary directory to hold a fake Codex auth.json credential file; if the OS refuses to create a temp dir, the test aborts with the message 'credential fixture'. tempfile only fails here when the platform's temporary directory cannot be created or accessed.","triggerScenarios":"Calling `tempfile::tempdir().expect(\"credential fixture\")` in a test when the OS temp directory (TMPDIR on Linux, %TEMP% on Windows) is unwritable, missing, full, or when TMPDIR points to a path that does not exist.","commonSituations":"Running the test suite in sandboxes/containers with a read-only or unset TMPDIR, CI runners with a full /tmp, or hardened environments where the temp root has restrictive permissions.","solutions":["Verify TMPDIR (or %TEMP%) is set and points to an existing, writable directory before running tests.","Free disk space on the volume holding the temp directory (df -h /tmp).","Run the test with an explicit writable temp root, e.g. TMPDIR=$(mktemp -d) cargo test -p codewhale-tui.","If in a container, mount a writable tmpfs at /tmp or run with correct ownership (not root-owned read-only)."],"exampleFix":"// before\nlet temp = tempfile::tempdir().expect(\"credential fixture\");\n// after (shell, before running tests)\n// export TMPDIR=$(mktemp -d) && cargo test codex_client_uses_one_coherent_external_credential_snapshot","handlingStrategy":"validation","validationCode":"// shell, before running tests\n[ -d \"$TMPDIR\" ] && [ -w \"$TMPDIR\" ] || { echo \"TMPDIR missing/unwritable\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set TMPDIR to a known writable directory in CI containers.","Monitor /tmp free space as part of CI preflight.","Never run test suites with a read-only or root-owned temp root."],"tags":["rust","test-fixture","tempdir","filesystem"],"backgroundTag":"file-not-found","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"}