Port: Pulsarr watchlist database and API (issue #1) - #3
Merged
Conversation
- Add WatchlistDB class with watchlist_authors and watchlist_releases tables - Follows existing UserDB migration pattern (CREATE IF NOT EXISTS + PRAGMA guards) - Add Flask blueprint with 5 API endpoints for author watch CRUD and release listing - Wire WatchlistDB into main.py startup alongside UserDB - 35 tests covering schema, CRUD, validation, idempotency, and cascade behavior
… port Auto-fixed: import sorting in main.py, unused noqa in routes.py, unused json import in test_watchlist_db.py. Manual fixes: TRY300 (return moved to else-branch in db.py add_author), and ruff format on the three files that drifted from this repo's config. Also reverted "Pulsarr" → "Shelfmark" in two module docstrings to keep this fork's naming consistent. All 1977 backend tests pass (35 new from this port).
Calls out that this fork integrates noteworthy work from community forks while keeping Shelfmark's identity, license, and naming intact. Lists the forks currently tracked (litfinder, pulsarr) with a brief summary of what's been ported from each.
|
|
||
|
|
||
| def _error(message: str, status: int = 400) -> Any: | ||
| return jsonify({"error": message}), status |
Updated the note about the fork to include new original features being added.
The raw sqlite3.IntegrityError message can reveal internal index and constraint names (e.g. 'uq_watchlist_authors_hardcover') to the API caller, which is unnecessary info disclosure. Log the underlying error server-side and return a generic "Watch entry already exists" message to the caller instead. Addresses the one CodeQL py/stack-trace-exposure finding from the initial scan of this PR. Tests still pass (they match on "already exists", which the new message preserves).
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.
Port Pulsarr's watchlist DB schema, API, and tests (excluding rebrand)
Ports 1 feature commit from SloppyTurtle/pulsarr, preserving original authorship via
git cherry-pick. Pulsarr is a community fork ofcalibrain/shelfmark; this PR pulls in the substantive new work while leaving the Pulsarr rebranding out. Also updates the README to call out that this fork is a meta-fork tracking selected community work.New features
shelfmark/watchlist/db.pywithwatchlist_authorsandwatchlist_releasesSQLite tables, indexes, and a thread-safeWatchlistDBwrapper. Follows the existingUserDBmigration pattern (CREATE IF NOT EXISTS+PRAGMAguards) and uses cascade-on-delete for user removal.shelfmark/watchlist/routes.pywith five endpoints for author-watch CRUD and release listing.WatchlistDBinitialized at startup alongsideUserDBinshelfmark/main.py; routes registered via blueprint.tests/watchlist/test_watchlist_db.pycovering schema, CRUD, validation, idempotency, and cascade behavior.Deliberately not ported
bca048e) — touches only the README; rewriting the project name is out of scope for a fork keeping the Shelfmark name. Two docstrings that referenced "Pulsarr" in the feature commit have been reverted to "Shelfmark" as part of the cleanup commit.1ca6a85) — the squashed feature commit (5f39921) is what's ported; the merge commit itself adds nothing on top.README change
Adds an
[!IMPORTANT]block near the top of the README that:calibrain/shelfmarkgit log --grep="Cherry-picked from"for full attributionVerification
seleniumbase-dependent failure in local venv, unrelated to this port)Cleanups in this branch
--fixhandled import sorting inmain.py, an unused# noqa: PLW0603directive, and one unusedjsonimport in the testsTRY300(return moved toelseblock inWatchlistDB.add_author)ruff formaton the three new/touched files to bring them into this repo's styleCredit
Per-commit authorship preserved by cherry-pick. The single ported commit (
5f39921) is unmodified from upstream apart from the two docstring reverts noted above (recorded in the cleanup commit body). Thanks to @SloppyTurtle for the work.