This "biggest risk" you've named is....entirely fantastical. A battery invention making the Gigafactory obsolete? What?
1. What kind of invention are we talking here? A new battery that stores 100,000mi per charge, is lightweight (magically), and charges in 10 seconds? Great, then the Gigafactory can start manufacturing that instead. It wouldn't be obsolete.
2. Even if such a thing as #1 were invented, great, now Tesla's product is infinitely more compelling. They'll sell that many more cars. The car now has enormous range and charges very quickly. This is a bad thing? What??
3. Even if #1 were invented and somehow intellectual property'd out of Tesla's reach, how's it going to hurt them? Are we imagining one of their competitors magically coming up with this, and conjuring an equally compelling but superior car out of thin air, using technology Tesla has no access to? That's an incredible turnaround time, this new tech being revealed AND reaching mass production AND having a car designed around it which ALSO reaches mass production...all before 2017. Incredible! Unheard of!
4. #1 is a joke. That won't happen, can't happen, has never happened. New revolutionary hardware technologies don't just appear. They gradually work their way into society, and it takes a lot of time before methods are found to cheaply mass produce new hardware technologies.
Given that your "biggest risk" is an absurdist fantasy, I think we can safely say Tesla's in a good position!