Skip to content

feat: add Flickypedia second search query to FlickrBot - #90

Merged
DaxServer merged 1 commit into
mainfrom
feat/flickypedia-second-search-query
Jun 6, 2026
Merged

DaxServer merged 1 commit into
mainfrom
feat/flickypedia-second-search-query

Conversation

@DaxServer

Copy link
Copy Markdown
Owner

Add a second search query for files uploaded via Flickypedia. BaseBot gains a search_queries list attribute; FlickrBot uses it to run both queries in sequence. Extraction auto-detects the template: Uploaded with Flickypedia uses flickrPhotoUrl directly; otherwise falls back to the existing FlickreviewR path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown

Confidence Score: 4/5

Safe to merge; the core extraction and deduplication logic is correct and the new Flickypedia path handles missing templates gracefully.

The multi-query iteration and Redis deduplication work correctly together. The two issues found are minor: the mutable class-level list default is only dangerous if a future subclass appends rather than reassigns, and the skipped FlickreviewR status check for dual-template files is mostly covered by the category filter already applied by query 1.

src/wikibots/flickr.py — the template-dispatch logic in extract_flickr_data and the missing review-status guard for dual-template files; src/wikibots/lib/bot.py — the mutable class-level search_queries default.

Important Files Changed

Filename Overview
src/wikibots/flickr.py Adds Flickypedia extraction path via template detection; dual-template files (FlickreviewR + Flickypedia) bypass the review-status check.
src/wikibots/lib/bot.py Adds search_queries list attribute and updates _search_pages to iterate over multiple queries; mutable class-level default list is a footgun for future subclasses.
tests/test_flickr_rate_limit.py New test file covering retry-with-delays and success-on-retry scenarios for Flickr API rate limiting; logic and assertions are correct.
compose.yaml DragonflyDB image bumped from v1.35.1 to v1.38.1; routine dependency update.
poetry.lock Lockfile regenerated by Poetry 2.4.1; adds cachebox (new deepdiff dependency), bumps certifi, cryptography, google-*, idna, and other transitive deps.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[run loop] --> B{redis.exists?}
    B -- yes --> A
    B -- no --> C[treat_page]
    C --> D[extract_flickr_data]
    D --> E{Has 'Uploaded with Flickypedia' template?}
    E -- yes --> F[_extract_flickr_id_from_flickypedia reads flickrPhotoUrl]
    E -- no --> G[_extract_flickr_id_from_flickreviewer checks status == pass/passed reads sourceurl]
    F --> H{flickr_url?}
    G --> H
    H -- nil --> I[return, skip]
    H -- url --> J[_parse_flickr_photo_id]
    J --> K[get_flickr_photo with rate-limit retry]
    K --> L[build & save SDC claims]

    subgraph _search_pages
        Q1[Query 1: FlickreviewR reviewed files]
        Q2[Query 2: Flickypedia uploads]
        Q1 --> Yield[yield pages]
        Q2 --> Yield
    end
Loading

Fix All in Claude Code

Reviews (1): Last reviewed commit: "feat: add Flickypedia second search quer..." | Re-trigger Greptile

Comment thread src/wikibots/lib/bot.py
Comment on lines 37 to +38
search_query = ""
search_queries: list[str] = []

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Mutable class-level default list

search_queries: list[str] = [] is a mutable object shared by all BaseBot subclasses. Any future subclass that calls .append() on the inherited attribute (rather than assigning a new list) would mutate the shared default and corrupt the query list for all other subclasses in the same process. FlickrBot avoids this by reassigning with a list literal, but the footgun remains for future implementers.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

Comment thread src/wikibots/flickr.py
Comment on lines +110 to +115

flickr_url = (
self._extract_flickr_id_from_flickypedia()
if "Uploaded with Flickypedia" in template_names
else self._extract_flickr_id_from_flickreviewer()
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 FlickreviewR status check bypassed for dual-template files

The template dispatch is based on wikicode content, not on which search query found the page. A file returned by query 1 (which requires hastemplate:"FlickreviewR" and the reviewed category) that also carries the Uploaded with Flickypedia template will be routed through _extract_flickr_id_from_flickypedia, skipping the review_status check in _extract_flickr_id_from_flickreviewer. Such files would be processed even if the FlickreviewR status is "fail" or "pending". The category filter incategory:"Flickr images reviewed by FlickreviewR 2" provides the primary guard, but the per-template status check was an additional safety layer for these edge cases.

Fix in Claude Code

@DaxServer
DaxServer merged commit 093c5d5 into main Jun 6, 2026
6 checks passed
@DaxServer
DaxServer deleted the feat/flickypedia-second-search-query branch June 6, 2026 17:48
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.

1 participant