At that level of competition, just keep xraying bikes so it can't become an issue? Drug testing is privacy invasive, having your bike xrayed isn't if you're not cheating.
At the top levels, there isn't much privacy already. In 2007, the GC leader of the Tour was removed from the race because they had lied about their location a month prior. Racers are required to tell UCI, the cycling governing body, their locations in order for doping controls.
Not just at the elite level either. The whereabouts system has expanded to apply to tens of millions of people, completely outside of any serious national or international legal frameworl.
> The whereabouts system has expanded to apply to tens of millions of people, completely outside of any serious national or international legal framewor[k].
What? Why? Who cares whether the 500,000th-fastest bicycle racer in the world is cheating?
not necessarily saying it's a good system, but I remember working with someone who had previously tried making it pro in a sport who was really frustrated with a lot of doping at the low levels. In order to advance upwards, it was necessary to do well in the lower levels, but due to the lax testing he was competing against other athletes with an unfair advantage.
You can swap bikes in the middle of the race if you have a mechanical issue. There was one famous time where someone climbed impossibly fast, had a mechanical at the top of the mountain, then finished the race on a different bike, leading us to forever wonder.
That seems like an issue with checking though. If you know people can switch bikes mid race, meaning it's allowed by rules then it is simply stupid to only "double check" the winning bikes that made it to the finish line. Obviously you would need to check every single bike someone used during the race. That's different from someone illegally changing bikes.
This is what they do, for what its worth. Every team bike is subject to random or suspicion based inspection both pre-stage and post-stage. There's also in-stage monitoring that flags riders or their equipment for additional investigation.
The first athlete to be sanctioned for mechanical doping did exactly that.
Inspectors found a bicycle in her pit with a hidden motor. Her excuse was "the bicycle was owned by a friend and was taken to the pit in error". The bike looked exactly the same as the bike she was riding.
XRay is also somewhat privacy invasive to bike athletes, but not to "normal" people. The reason is that there is a huge competition on making bikes lighter while still being able to withstand the exact stress put on in in that one leg of the race. So they file off a little metal here, a little there, shorten some screws, etc. The secret is in how much you can take away in which places.
This can lead to bikes that are usable only for that one leg on that one day, after which you have to change the slightly deformed parts, because e.g. the braking downhill would kill your lighter, thinner, filed-down uphill tires.
They have minimum bike weights to counter this. Commercially available well built carbon fibre bikes are sometimes bellow the minimum weight right out of the factory so they have to add weights to them.