*not legal advice* but when we shot IPSC nationals for shotgun in 2019 at equipment check they had a pile of SAAMI spec 3" and 3.5" dummy shells machined to test capacity. So long as they could not seat the 6th round in the magazine tube you were in compliance and I was told *by the match organizers* this was at the instruction of the CFO. 6 rounds of SAAMI spec 3" works out to be 420.6mm (70.1mm x 6) so as long as your useable magazine length was less than that number, you were in legal compliance. My tube ended up being 418mm.
In reality that worked out to be 7 2 3/4" shells in a 3" chamber and 8 2 3/4" shells in a 3.5" chamber for most ammo brands. Add one in the chamber and one ghost loaded, your 3" shotgun can hold 9 rounds.
Whether or not an everyday cop knows that and is willing to charge you is a different story.