The Cole's notes version of what I did was
- Shut calibre down
- Take a backup of the database
- Open the database on the Kobo using a tool such as DBeaver
- Navigate to the SHELF table and set the _IsDeleted field to true on each of the shelves
- Drop all rows from the SHELFCONTENT table
- Disconnect the Kobo and do a WiFi sync
- Reconnect the Kobo and let calibre rebuild and repopulate the shelves