{"record":{"id":"51d4e45c4a1fab61","repo":"Hmbown/CodeWhale","slug":"canonical-temp-root","errorCode":null,"errorMessage":"canonical temp root","messagePattern":"canonical temp root","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/client.rs","lineNumber":8254,"sourceCode":"    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 {\n            provider: Some(ApiProvider::OpenaiCodex.as_str().to_string()),\n            providers: Some(ProvidersConfig {\n                openai_codex: ProviderConfig {\n                    auth_mode: Some(\"oauth\".to_string()),","sourceCodeStart":8236,"sourceCodeEnd":8272,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/client.rs#L8236-L8272","documentation":"A panic from `Path::canonicalize().expect(\"canonical temp root\")` in the same Codex credential-snapshot test. canonicalize resolves the tempdir path to an absolute, symlink-free path; it fails if the path no longer exists on disk. In practice this fires when the OS temp directory vanished between creation and canonicalization, or on platforms where resolving the path fails.","triggerScenarios":"`temp.path().canonicalize().expect(\"canonical temp root\")` fails because the TempDir was already deleted (e.g. dropped early), TMPDIR is a dangling symlink, or an aggressive tmp cleaner removed the directory mid-test.","commonSituations":"Tests running in parallel with systemd-tmpfiles or tmpwatch cleaning /tmp, TMPDIR pointing through a broken symlink, or macOS TMPDIR directories being cleaned concurrently.","solutions":["Confirm the temp directory still exists at canonicalize time; do not drop the TempDir guard before use.","Disable or reconfigure periodic tmp cleaners (systemd-tmpfiles, tmpwatch) that race with the test run.","Point TMPDIR at a stable path (mktemp -d outside the cleaner's sweep scope) and re-run.","If a symlinked TMPDIR is the issue, verify `readlink -f $TMPDIR` resolves to an existing directory."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// rust: verify before canonicalize\nassert!(temp.path().exists(), \"tempdir vanished before canonicalize\");\nlet path = temp.path().canonicalize().expect(\"canonical temp root\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the TempDir guard alive for the whole test; never drop it early.","Disable aggressive tmp cleaners (systemd-tmpfiles, tmpwatch) on CI runners.","Prefer a dedicated mktemp -d workspace over shared /tmp for parallel suites."],"tags":["rust","test-fixture","path","canonicalize"],"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"}