{"record":{"id":"8a311d1be440f6e0","repo":"Hmbown/CodeWhale","slug":"expected-warning-for-relative-path-argument-got-other","errorCode":null,"errorMessage":"Expected Warning for relative path argument, got {other:?}","messagePattern":"Expected Warning for relative path argument, got (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":19402,"sourceCode":"        let executable = executable.to_string_lossy();\n        let server = make_server(Some(&executable), &[\"server.js\"], None);\n        match doctor_check_mcp_server(&server) {\n            McpServerDoctorStatus::Ok(detail) => assert!(detail.contains(\"stdio\")),\n            other => panic!(\"Expected Ok, got {other:?}\"),\n        }\n    }\n\n    #[test]\n    fn test_relative_stdio_path_arg_without_cwd_warns() {\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), &[\"server/mcp_server.py\"], None);\n        match doctor_check_mcp_server(&server) {\n            McpServerDoctorStatus::Warning(detail) => {\n                assert!(detail.contains(\"relative path argument\"));\n                assert!(detail.contains(\"cwd\"));\n            }\n            other => panic!(\"Expected Warning for relative path argument, got {other:?}\"),\n        }\n    }\n\n    #[test]\n    fn test_scoped_npm_package_spec_without_cwd_is_not_a_path_warning() {\n        let absolute_npx = if cfg!(windows) {\n            r\"C:\\Program Files\\nodejs\\npx.cmd\"\n        } else {\n            \"/opt/homebrew/bin/npx\"\n        };\n        for command in [\"npx\", \"npx.cmd\", absolute_npx] {\n            let server = make_server(\n                Some(command),\n                &[\"-y\", \"@playwright/mcp@0.0.79\", \"--isolated\"],\n                None,\n            );\n            match doctor_check_mcp_server(&server) {\n                McpServerDoctorStatus::Ok(detail) => assert!(detail.contains(\"stdio\")),","sourceCodeStart":19384,"sourceCodeEnd":19420,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/tui/src/lib.rs#L19384-L19420","documentation":"A test assertion panic in the MCP doctor tests: the test expects doctor_check_mcp_server to return McpServerDoctorStatus::Warning with a detail mentioning both 'relative path argument' and 'cwd' when a stdio server's argument is the relative path 'server/mcp_server.py' and no cwd is set. Any other variant panics with 'Expected Warning for relative path argument, got {other:?}'.","triggerScenarios":"doctor_check_mcp_server returns Ok or Error instead of the expected Warning — e.g. the relative-path heuristic was removed, now matches only single-segment paths (missing the 'server/' prefix case), or raises a hard error instead of a warning.","commonSituations":"A doctor change tightens path matching to file extensions or single components and misses nested relative paths; wording changed from 'relative path argument'/'cwd'; the check was demoted to Ok.","solutions":["Print the actual variant in the panic ({other:?}) to see what the doctor decided.","Extend the relative-path detection in doctor_check_mcp_server to catch multi-segment relative args like 'server/mcp_server.py'.","Verify the Warning detail still contains both 'relative path argument' and 'cwd', or update the assertions.","Add/confirm a sibling test (scoped npm spec is NOT a warning) still passes so the heuristic stays precise."],"exampleFix":"// before\nother => panic!(\"Expected Warning for relative path argument, got {other:?}\"),\n// after\nother => panic!(\"Expected Warning for relative path argument, got {other:?}; server={server:?}\"),","handlingStrategy":"validation","validationCode":"fn looks_like_relative_path(arg: &str) -> bool {\n    !arg.starts_with('/') && !arg.starts_with(\"@\") && arg.contains('.')\n}\nif !server.args.iter().any(|a| looks_like_relative_path(a)) {\n    eprintln!(\"no relative path arg; doctor will not warn\");\n}","typeGuard":"fn is_relative_path_arg(s: &str) -> bool {\n    !std::path::Path::new(s).is_absolute() && !s.starts_with('@')\n}","tryCatchPattern":"match doctor_check_mcp_server(&server) {\n    McpServerDoctorStatus::Warning(d) => {\n        assert!(d.contains(\"relative path argument\"), \"{d}\");\n        assert!(d.contains(\"cwd\"), \"{d}\");\n    }\n    other => panic!(\"Expected Warning for relative path argument, got {other:?}\"),\n}","preventionTips":["Match relative paths by non-absolute prefix, not by file extension or depth","Keep warning copy keywords ('relative path argument', 'cwd') stable","Pair each positive case with a negative case (scoped npm specs)","Log the full variant in panics for faster triage"],"tags":["rust","testing","mcp","doctor","panic"],"backgroundTag":"unexpected-response-shape","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-22T10:30:35.592Z"}