fix: Watch-folder DB inserts silently failed on phantom added_at column (#211)#214
Merged
deucebucket merged 1 commit intodevelopfrom Apr 18, 2026
Merged
Conversation
… column Three INSERT statements in process_watch_folder targeted a column 'added_at' on the books table. The real column is 'created_at' — 'added_at' only exists on the queue table. Every watch-folder INSERT raised sqlite3.OperationalError which two separate except blocks caught with logger.debug(), hiding the error at default log levels. Effects: - Successful watch-folder moves never produced a 'pending' or 'needs_attention' row in the books table. - Failed watch-folder moves never produced a 'watch_folder_error' row — the UI had no surface for the failure; only the log showed it. Fixes: - Renamed 'added_at' to 'created_at' in the three books-table INSERTs at app.py:6906, 6914, 6944. - Raised both swallow-except blocks from logger.debug to logger.warning with exc_info=True so future failures don't rot silently. Surfaced during live testing of the #209 fix. Bug has existed since the watch-folder feature was introduced. Bumps APP_VERSION to 0.9.0-beta.149.
There was a problem hiding this comment.
🔍 Vibe Check Review
Context
Tiny, tightly-scoped fix renaming a phantom added_at column to created_at in three watch-folder INSERT INTO books statements, plus raising two swallow-except handlers from debug to warning(..., exc_info=True).
Codebase Patterns I Verified
- Read
library_manager/database.py:28-37—bookstable schema hascreated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, noadded_atcolumn. The fix's claim is ground truth. - Searched all other
INSERT INTO bookssites (lines 4999, 5055, 5136, 5253, 5316, 5366, 5447) — none referenceadded_at; they omit the timestamp columns and rely on DEFAULT. Only the 3 watch-folder inserts had the bug. - Confirmed
added_atis a real column on a different table (queue.added_atatdatabase.py:71) — explains how the typo slipped in and why otheradded_atgrep hits in app.py are legitimate. - Verified APP_VERSION bump to beta.149 aligns with CHANGELOG entry dated 2026-04-17.
✅ Good
- Root-cause fix (wrong column) plus symptom fix (silent swallow). Both needed — fixing only one would leave either a broken feature or a future invisible failure.
exc_info=Trueon the elevated warnings preserves the traceback, which is exactly what you want when a silent failure surfaces.- Inline comments at
app.py:6906andapp.py:6949explain WHY the log level was raised (issue #211 reference) — aligns with CLAUDE.md's "explain non-obvious why" guideline. - Documentation discipline: CHANGELOG + README + version badge all updated together, beta.149 entry honestly describes scope.
🚨 Issues Found
No issues found.
📋 Scope Verification
| Issue | Problem | Addressed? | Notes |
|---|---|---|---|
| #211 | Watch-folder failure-tracking silently swallows DB errors (debug-level log) | ✅ | Fixed BOTH the swallow (warning + exc_info) AND the underlying OperationalError (column rename). No scope creep. |
Scope Status: SCOPE_OK
📝 Documentation Check
- CHANGELOG.md: ✅ Updated (beta.149 entry, 2026-04-17, clear effects + fix description)
- README.md: ✅ Updated (version badge + Recent Changes blurb)
🎯 Verdict
APPROVE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #211
Summary
Three `INSERT` statements in the watch-folder worker targeted a phantom column `added_at` on the `books` table. The real column is `created_at` — only the `queue` table has `added_at`. Every insert raised `sqlite3.OperationalError` which two separate `except` blocks caught with `logger.debug`, hiding the error at default log levels.
Bug has existed since the watch-folder feature was introduced. Surfaced during live testing of #209 when I noticed a watch-folder failure produced no UI row despite clean log output.
Effects before this fix
Changes
`app.py`
Verification
Test plan
References