[a submarine] is invisible to most units - except for destroyers and other Submarines - until it attacks.
However, I've noticed that other naval units can see non-attacking submarines if they are adjacent to them, even if said units are just embarked workers. I also noticed I can sometimes see submarines if they're adjacent to my borders. What is the full list of situations in which a submarine is revealed?
Also, what does "until it attacks" mean? If a submarine attacks, is it visible until the beginning of the next turn, or until it moves again? What if it has the logistics promotion and it moves away immediately after its attack, is it still visible?