You can't expect any cop in CA to know the law regarding open carry since most departments do not know the law, and I would bet they do not teach officer cadets open carry laws at the academies.
There is no permit requirement for open carry in CA as long as the weapon is unloaded and not concealed. The law only allows them to check that the weapon is in fact unloaded; it does not
allow them to run the serial number. That is an unlawful search and violation of the 4th Amendment. If the officer wishes to perform a 12031(e) check on the firearm he must immediately return the firearm after he ascertains the unloaded status of the firearm. If he does not, it is an illegal seizure, as he has no lawful reason to detain the weapon any further.
If he takes it and runs the serial number, it is an illegal search, since he cannot run the serial number unless he has probable cause to believe the weapon is stolen or involved in a crime, and the mere possession of a weapon does not constitute reasonable cause for the search.
The only legal way (though perhaps somewhat of a legal gray area unless there is case law) for them to run the serial number would be for the officer to memorize it and run it after he dismisses you. Since the serial number is probably located in plain view he could easily do this. Some people put opaque tape over their serial numbers to protect the number from damage (since it would be unlawful to possess a firearm with a damaged or obliterated serial number) and that would keep the serial number out of plain view and it would be unlawful for the officer to remove the tape without probable cause or a warrant for a search.