Skip to content

[libcalibre] bump books.last_modified on edits to custom values - #167

Draft
phildenhoff wants to merge 1 commit into
mainfrom
claude/issue-157
Draft

phildenhoff wants to merge 1 commit into
mainfrom
claude/issue-157

Conversation

@phildenhoff

@phildenhoff phildenhoff commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Calibre bumps books.last_modified on every metadata change, and its OPF backups and change detection lean on that. Citadel didn't for custom-column and read-state edits, so those were invisible to Calibre.

The tag edit in the report was already fixed on main by #146 (update_book now touches the book), after v0.6.1 shipped. The bool custom_column_<N> row in the report's diff is the read-state column, and that's the path this fixes, along with set_custom_value generally.

Both now read the stored value before and after the write and only bump last_modified when it actually changed, like Calibre's _update_last_modified(dirtied). (update_book still touches unconditionally — I left that alone here.)

Validation

cargo test -p libcalibre: the new tests in tests/last_modified_test.rs fail without the fix and pass with it; the rest of the suite is unchanged. Not checked against a real Calibre library.

Fixes #157

@github-actions

Copy link
Copy Markdown

libcalibre Test Coverage Report

Overall coverage: 80.19%

📊 Download HTML Report

Coverage breakdown available in the artifacts.

set_custom_value and set_book_read_state wrote directly to the custom
column tables without touching books.last_modified, unlike update_book,
identifiers, and asset edits. Calibre relies on last_modified for OPF
backups and change detection, so edits through these two paths were
invisible to it.

Both now compare the stored value before and after the write and only
bump last_modified when it actually changed, matching Calibre's
_update_last_modified(dirtied).

Fixes #157.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

Copy link
Copy Markdown

libcalibre Test Coverage Report

Overall coverage: 80.24%

📊 Download HTML Report

Coverage breakdown available in the artifacts.

@djspiceroute

Copy link
Copy Markdown

Happy to test this against a real library if that helps — I've got a Calibre library I can run a before/after on, checking that books.last_modified moves on an edit and that nothing else shifts.

Looks like it needs a rebase on master before it'll merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Metadata edits do not update books.last_modified

3 participants