Hard to give useful advice without knowing more. I think you’re on the right track with paying attention to frame issues, and as 1/8th sorta suggests, you should factor in a chain/cassette replacement to your costs. If you’re buying a bike with thoughts of upgrading pieces, make sure that you’re aware off all of the pieces of the puzzle. Rarely will it be an easy component-out-component-in swap.
As to frame stuff, make sure you’re looking at *clean* frame when you make that evaluation. Hairline cracks can be hard to ID in the best of situations. Give the places where the tubes come together extra attention (e.g., head tube, just below seat, bottom bracket, etc.).