As the others above said - it's a mix. There are plenty of times where the patient comes into clinic, diagnosis is secured - classic story, confirm they have the appropriate workup and the proceed to surgery. In this case surgery often has "problem-solving" that is similar to that of IM in surgical planning. How are you going to manage comorbities, what operative approach are you going to use, what are the unique obstacles to this patient, etc. This can even be an element in an ED call. Ruptured AAA, are you going to take the time to go to the scanner - try to put together something endovascular, go straight to the OR for an open procedure? etc.
There's a weird category of patients which present with a diagnosis already assigned to them, but really an inappropriate workup or story for that diagnosis. These are some of the most and least satisfying patients for me. Finding the right diagnosis and getting them to an appropriate specialist is often rewarding, but running down extra labs to confirm what you already thought in order to schedule surgery later - less so.
Often I'll get called by the emergency department with more or less a chief complaint and haphazard workup that hasn't shown much. "Abdominal pain with negative CT scan" - in this case you're pretty much it for working up the patient or explaining to the ED physician why this isn't your problem. There's also the unique element of surgery that is trauma. The patients show up injured and even though you know it's an motor vehicle crash, gunshot wound, electrocution etc. etc. you have to figure out how the patient is injured and develop a treatment plan rapidly in real time.
There's also post-operative patients. Even though you may have treated their initial problem with a surgery, patients develop additional post-op findings frequently. These may be simple like electrolyte deficiencies, or may be a complex cardiac arrhythmia, an anastomotic leak. These require some level of differential diagnosis and the ability to manage critical illness.
In conclusion, the main challenge of surgery isn't usually "diagnosis" per se, but complex problem-solving and priority assignment are still HUGE aspects of surgery that manifest in different ways than internal medicine. Also, you get to operate - and that's pretty awesome.