You may not get the formal agreement until just before your TC starts. If you have received a TC offer letter, this could be your formal offer.
If there is no chance of you accepting a TC offer from firm B over firm A, you should withdraw your candidacy from the VS. There is little value in continuing with the vacation scheme - you don't need the experience now you have secured your preferred TC.
If you want to work out whether Firm B is better suited to you than firm A, then you can proceed with the VS given neither of your offers have a term restricting you from doing so.
There are no unwritten rules about this. Some would argue that you should stick to the "voluntary code of recruitment for trainee solicitors" which can be found here https://www.lawsociety.org.uk/topics/hr-and-people-management/voluntary-code-of-recruitment-for-trainee-solicitors. However, as you can see, this hasn't been reviewed or updated since 2015 and firms are not sticking to this, so I don't see why candidates should. Just to highlight it is just a voluntary code - there is no regulatory requirements to stick to this, its just considered best practice.
Firms would only find out if you told them or you put it in the public domain like on LinkedIn. Now they could ask you as part of your scheme or TC conversion interview, and at that stage I would encourage people to be honest.
As for LinkedIn, no one would know when you got the offer or when you accepted it, so it wouldn't look odd to have a VS on your LinkedIn. You can also change your "future trainee" dates on LinkedIn to only cover the period you start a sponsored course, so it wouldn't look like your VS was after you had accepted an offer based on the information on LinkedIn.
The only final point to make, is that your "funding" commitment with Firm A could start from the point you submit forms to the GDL/SQE prep provider. I have seen people financially tied to the firm because they have effectively signed up to a GDL/SQE course even if that has not started.