Phil,
That isn't quite accurate. Many ships, depending on the builder, didn't launch with all or maybe no armament. Weight was a concern and the armament could be installed at fitting-out. Yes there were changes made "Post-Shakedown" on most all ships. On USS BALTIMORE and the class as a whole, the "Authorized Armament" was changing as the war progressed. When "completed" (post commission on 15 April 1943) and went on her Shakedown as the first of her class, many bugs (big and small) likely came to light and corrections made Post-Shakedown. Her initial "authorized armament" had six quad 40-mm mounts and it appears 24 20-mm guns. The 20-mm guns were there because they were authorized. The authorized armament for the BALTIMORE class was changed to twelve quad 40-mm mounts (48 guns) on the first units with two aircraft cranes. BALTIMORE had this change made Post-Shakedown by June 1943. The next BALTIMORE to complete had the full 48 40-mm guns installed prior to completing. The follow-on BALTIMORES with one crane, had eleven quad and two twin 40-mm mounts (keeping the same number of 48 guns). Actually, the BALTIMORE class saw fewer armament changes during the war than many other ships, retaining a 40-mm battery of 48 guns.
The CLEVELAND class went through many more "authorized" armament changes because they started to be built and completed well before the BALTIMORE class.
40-mm gun installations were not and generally COULD NOT be installed in a forward staging area. Too many structural changes were needed to be done to install these mounts from providing power to operate the mounts, interfacing to the fire control, ammo magazines and the methods to get ammo to the mounts. The only way that 40-mm mounts could be installed in a forward area, was as replacements to existing mounts. During construction there were periods when all of the 40-mm mounts were not available to be installed prior to Shakedown, due to demand for the guns. The ship's infrastructure to operate the 40-mm mounts were completed and the missing 40-mm mounts would be installed Post-Shakedown or as could be arranged. 20-mm guns on the other hand, could be installed in a forward area. The only complication, were the power and interface connections for the Mk 14 gunsights. Mostly the forward area 20-mm guns were "authorized" installations, but rules could be bent and more added than authorized, but would be corrected during the next overhaul.