{"record":{"id":"775bfd4634b7191d","repo":"Hmbown/CodeWhale","slug":"absolute-path-should-not-warn-detail","errorCode":null,"errorMessage":"Absolute path should not warn: {detail}","messagePattern":"Absolute path should not warn: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":19468,"sourceCode":"        let executable = std::env::current_exe().expect(\"current test executable\");\n        let executable = executable.to_string_lossy();\n        let mut server = make_server(Some(&executable), &[\"server/mcp_server.py\"], None);\n        server.cwd = Some(PathBuf::from(\"/tmp/codewhale-project\"));\n        match doctor_check_mcp_server(&server) {\n            McpServerDoctorStatus::Ok(detail) => assert!(detail.contains(\"stdio\")),\n            other => panic!(\"Expected Ok when cwd anchors relative path, got {other:?}\"),\n        }\n    }\n\n    #[test]\n    fn test_self_hosted_absolute_is_ok() {\n        let executable = std::env::current_exe().expect(\"current test executable\");\n        let executable = executable.to_string_lossy();\n        let server = make_server(Some(&executable), &[\"serve\", \"--mcp\"], None);\n        match doctor_check_mcp_server(&server) {\n            McpServerDoctorStatus::Ok(detail) => assert!(detail.contains(\"stdio server\")),\n            McpServerDoctorStatus::Warning(detail) => {\n                panic!(\"Absolute path should not warn: {detail}\")\n            }\n            McpServerDoctorStatus::Error(detail) => panic!(\"unexpected error: {detail}\"),\n        }\n    }\n\n    #[cfg(test)]\n    mod mcp_auth_guidance_tests {\n        #[test]\n        fn mcp_auth_hint_is_actionable_for_connect_failures() {\n            let hint = crate::mcp::oauth::auth_required_login_hint(\"nordic-mcp\");\n            assert_eq!(\n                hint,\n                \"MCP server 'nordic-mcp' requires OAuth authentication. Run `codewhale mcp login nordic-mcp` to authenticate.\"\n            );\n        }\n    }\n\n    #[test]","sourceCodeStart":19450,"sourceCodeEnd":19486,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/tui/src/lib.rs#L19450-L19486","documentation":"Test panic in the MCP doctor tests: an absolute executable path (the current test binary) passed to doctor_check_mcp_server must yield Ok, never Warning. The panic fires when the doctor incorrectly emits a Warning (e.g. flagging the path as relative or unverified) for an absolute path.","triggerScenarios":"doctor_check_mcp_server returns McpServerDoctorStatus::Warning for a config whose command is an absolute path (std::env::current_exe()).","commonSituations":"A doctor change made absolute paths go through the relative-path warning branch; path classification regex/inversion bug; path canonicalization failure on the test executable.","solutions":["Inspect the Warning detail printed in the panic to see why the doctor flagged the absolute path.","Fix the branch in doctor_check_mcp_server so absolute paths (Path::is_absolute) bypass the relative-path warning.","If Warning is intended for missing-file cases, ensure the path existence check passes for current_exe() in the test environment."],"exampleFix":"// before\nif !command_is_scoped_npm(pkg) { warn_about_relative_path(path) }\n// after\nif !Path::new(path).is_absolute() && !command_is_scoped_npm(pkg) { warn_about_relative_path(path) }","handlingStrategy":"validation","validationCode":"debug_assert!(Path::new(&command).is_absolute(), \"doctor test expects absolute command path\");","typeGuard":"fn is_warning(s: &McpServerDoctorStatus) -> bool { matches!(s, McpServerDoctorStatus::Warning(_)) }","tryCatchPattern":"if let McpServerDoctorStatus::Warning(d) = doctor_check_mcp_server(&server) { panic!(\"absolute path warned: {d}\"); }","preventionTips":["Check Path::is_absolute before any relative-path warning logic","Avoid string-based path classification; use Path APIs"],"tags":["rust","test-assertion","mcp","path-handling"],"backgroundTag":"invalid-argument-value","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-22T06:17:15.046Z"}