Particle Build working and Particle Dev failing to flash

This thread Cloud thinks my Photon is a Core seems to be having exactly the same issue as I am having and setup sequence people used is similar to mine. This really need to be sorted out and the cause of this misidentity found. I have scanned thye soures of Particle CLI and Particle Dev and see that priduct_id is used extensively to identify what to do with the device and how to compile the code. What is not clear yet is how/from where the product_id is getting setup in cloud. One thing in common with all these problems is the keys regenerating issue.