Not sure if you've gotten your answer by now, but thought I'd chime in.
You need to treat the Calibre library as a black box...don't try to edit or merge files in it. That just confuses Calibre, which keeps track of all of that in a DB file. You need to combine libraries by importing one into the other.
- On the first computer, upload one library to iCloud
- Connect Calibre to it using the Switch library option
- On the second computer, open Calibre and export the library to a folder on iCloud
- Open Calibre on the first computer and choose import, and select the file you exported to previously
- You can now discard the import/export file, leaving you with a single library on iCloud.
The import process should identify any duplicates and ask if you still want to import them. (Note that how it behaves when it finds a duplicate is determined by your preferences). If there are still some duplicates after the import, you can manually delete them from within Calibre, or install the Calibre duplicates finder plugin.
Hope this helps.