There is definitely something odd going on, but its not quite as simple as above. I'm in the fourteenth year of a large campaign with several carriers and one fleet just lost its squadrons somehow. However, this is the first time I have seen it and I can't recreate it by detaching and deleting fleets. There must be some rare sequence of steps that results in this problem.
Has anyone else been able to reliably recreate this problem?
I have not personally encountered this issue, but I recall that the earliest reports of this issue were related to fleets under tow by tractor beams, and I know there were some changes to tractor beams recently, so that might be the first place to look?
My own fleet that was affected wasn't tractored. It was three different carriers in the same fleet, so it seems to be a problem at the fleet level, not ship. What was unusual is that I detached them from a fleet, then detached everything else from the same original fleet and then deleted that original fleet. However, I don't know for certain if that was the cause because that was a couple of months previously in game time and I don't have backup at that point to check it. Also, doing the same thing with other fleets doesn't result in the same problem. There is probably some other step involved, which I need to figure out. It most be a fairly rare step because of the rarity of the bug.
Found and Fixed!
v2.2 had various performance improvements. One of these involves how the composition of fleets was tracked. Originally, each ship had a reference to its parent fleet object. To return the ships in a fleet, the program returned all the ships with the reference of that fleet. The advantage of this is that the information is only stored in one location, which means less scope for bugs. This type of bug avoidance was a key principle of programming for C# Aurora. However, the downside is the overhead of running a LINQ query every time I need know the ships in a fleet. As games get larger, this becomes more pronounced.
For v2.2, I also started keeping a list of ships in a collection within the Fleet object for easy reference, so when I needed the list I no longer needed the LINQ query. I accepted the higher risk of bugs because there is a very limited number of places in the code where ships are created or change fleets. For example, there is a single function that is called for each ship that changes fleet - to handle the change itself, plus any other issues such as parasites, tractor links, shipyard tasks, updated fleet speeds, etc.
Unfortunately, while the fleet link for parasites was correctly moved from one fleet to another, they remained in the above 'ship list' collection for the original fleet. This wasn't visible in the Fleet window because the fleet treeview displays parasites by squadron and the squadron is linked to the mothership, which is in the correct fleet (and the parasite's own 'fleet object' was also correct). Furthermore, this problem was fixed as soon as you closed and re-opened the game, because the 'ship list' is purely an in-memory construct and the save and load function for ships uses the original fleet object, which places them all in the correct 'fleet ship list' when the game loads.
So the bug will happen if you detach a ship with parasites and then delete the original fleet, without loading the game in-between. Fixed for v2.5.1, which I will look at releasing next week due to the severity of this bug, even if it is rare.