{"record":{"id":"6e2ddc6ab097c0e2","repo":"Hmbown/CodeWhale","slug":"expected-ok-for-scoped-npm-package-via-command-got-other","errorCode":null,"errorMessage":"Expected Ok for scoped npm package via {command}, got {other:?}","messagePattern":"Expected Ok for scoped npm package via (.+?), got (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":19421,"sourceCode":"        }\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\")),\n                other => panic!(\"Expected Ok for scoped npm package via {command}, got {other:?}\"),\n            }\n        }\n    }\n\n    #[test]\n    fn test_scoped_npm_exception_does_not_hide_relative_paths() {\n        for (command, argument) in [\n            (\"npx\", \"scripts/server.js\"),\n            (\"npx\", \"@scope/package/extra\"),\n            (\"npx\", \"@scope/package@\"),\n            (\"npx\", \"@scope/package@@1.0.0\"),\n            (\"npx\", \"@.scope/package\"),\n            (\"npx.cmd\", \"@scope/_package\"),\n            (\"node\", \"@scope/package@1.0.0\"),\n        ] {\n            let server = make_server(Some(command), &[argument], None);\n            assert!(\n                matches!(","sourceCodeStart":19403,"sourceCodeEnd":19439,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/tui/src/lib.rs#L19403-L19439","documentation":"This is a test-only panic in the MCP server doctor tests of the TUI crate. The test starts an MCP server defined as a scoped npm package (@playwright/mcp@0.0.79) invoked via a package-runner command (npx/bunx) and expects doctor_check_mcp_server to return McpServerDoctorStatus::Ok with a detail mentioning \"stdio\". Any other variant (Warning or Error) means the doctor incorrectly classified a valid scoped-npm stdio server.","triggerScenarios":"Running the TUI test that calls doctor_check_mcp_server on an McpServerConfig with a scoped npm package command and args [\"-y\",\"@playwright/mcp@0.0.79\",\"--isolated\"], when the doctor logic returns Warning or Error instead of Ok — e.g. the scoped-package detection in the doctor regressed or the detail text no longer contains \"stdio\".","commonSituations":"A developer modified doctor_check_mcp_server's command/path classification (npm/npx/bunx scoped-package handling, relative-path warnings) and broke the special-case for @scope/package names; or renamed McpServerDoctorStatus variants/messages.","solutions":["Run the failing test and inspect the {other:?} variant in the panic message to see whether the doctor returned Warning or Error and what detail it produced.","Check doctor_check_mcp_server's command classification for scoped npm packages (@scope/name) and restore the stdio detection / Ok classification.","If the doctor is now intentionally stricter, update the test expectation to the new documented behavior."],"exampleFix":"// before\nother => panic!(\"Expected Ok for scoped npm package via {command}, got {other:?}\"),\n// after (diagnostic step)\nother => panic!(\"Expected Ok for scoped npm package via {command}, got {other:?}; doctor classification for @scope/pkg commands changed\"),","handlingStrategy":"validation","validationCode":"// before relying on the doctor, assert the classification yourself\nassert!(Path::new(command).is_absolute() || command.ends_with(\".js\") || is_scoped_npm(command), \"unexpected command shape: {command}\");","typeGuard":"fn is_ok_status(s: &McpServerDoctorStatus) -> bool { matches!(s, McpServerDoctorStatus::Ok(_)) }","tryCatchPattern":"match doctor_check_mcp_server(&server) { McpServerDoctorStatus::Ok(d) => d, other => panic!(\"doctor classified scoped npm server as {other:?}\") }","preventionTips":["Cover scoped npm (@scope/pkg) commands explicitly in doctor unit tests","Keep classification logic (absolute/relative/npm) in one pure function that is easy to table-test"],"tags":["rust","test-assertion","mcp","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-22T06:17:15.046Z"}