I KNOW

that I'm reopening years old thread.
I have the same problem as OP, I modify files directly in Calibre library directory.
Tried to use (most probably abandoned) QualityCheck plugin, it does not work on current Calibre, because it calls:
formats = db.formats(book_id, index_is_id=True, verify_formats=False)
for fmt in formats.split(','):
db_size = db.sizeof_format(book_id, fmt, index_is_id=True)
but that is implemented in legacy.py as filesystem read, instead of table read. So this check is always 'good', because it compares disk size to disk size and thus does not fix db.
So question, directly to Kovid, if possible: With what call should be db.sizeof_format replaced with to get data from uncompressed_size column?
Thx,
J.