Now, I am not completly sure of this, but as I remember it the rule is something along the lines of "if it cost less than 20% of current ship to refit to". The problem here is that I have found no precise rules for how refit costs are calculated. What I can tell you, is that in the design under the DAC/Rank/Info tab, on the left side of the screen you can find 2 usefull pieces of information concerned with this. In the first large text field, is the list of which other designs will be elegable to be constructed on shipyards set with this design, while below it is a field where you can check what it will cost to refit it from another type of design. These helps you plan out shipyards and refitting before you finalize your design and starts fitting shipyards with them, possibly saving you from some of these problems.
For some rules of thumb for refitting costs, for similarly sized ships, it is generally dependent on the cost of the components that was not in the previous version. Also note, that when refitting armor to a new type, all armor must be changed (if you were changing in real life from say iron to titanium, you would need to replace all of it, not just add some extra plates). The jump ship problem can be considered by noting that the non-jump drive does not really have new components, just a different hull, which is what you then pay for on the refit. So when comparing the ships, consider the cost of the different components, and the general size of the ship. When upgrading to a newer version, one often puts many different new components on it, and they are often more expensive, which makes refitting harder. On the other hand, if you are exchanging main mission components, for new components which are not expensive compared to the rest of the ship (early/small beam weapons, missile tubes, cryo into cargo, and so on), then it would not be too hard to produce them at the same shipyard. Though for your missile ships, possible different sensors might break it at higher tech levels, since those components get really expensive later on. In the late/end game sensors, engine and medium-large beam weapons tend to be the most expensive items on ships, maybe 60-90% of the cost combined, so you could relatively easily switch between designs that keep these constant.