This question was spurred by the incident that happened during the 9th stage of the 2017 TdF when Fabio Aru attacked Chris Froome right as he experienced a mechanical problem with his bike.
The breakaway group lead by Aru was eventually halted by other riders who maintained that they should wait until Froome recovered from the mechanical failure before attacking.
What are the unwritten rules in this type of situation? Is it considered bad sportsmanship to attack in this situation, even thought it's a race? Would a win in a this situation, having not stopped, be tainted in some way or recorded differently?