8000 Seed Search images: bring the deny rules and cache keys to main by daoudclarke · Pull Request #624 · mwmbl/mwmbl · GitHub
[go: up one dir, main page]

Skip to content

Seed Search images: bring the deny rules and cache keys to main - #624

Merged
daoudclarke merged 1 commit into
mainfrom
seed-images-prod-rules
Nov 11, 2026
Merged

daoudclarke merged 1 commit into
mainfrom
seed-images-prod-rules

Conversation

@daoudclarke
Copy link
Copy Markdown
Contributor

From Claude:

Stack: builds on #623 (seed-images-prod-commons, the Commons client). #620 builds on this one.

Why

This is the second half of bringing over from wikicommons_image_search (the never-merged #607 image search and evaluation branch) the part production Seed Search images need. It's split from #623 to keep each PR under 500 added lines. The plan keeps rules.query_verdict in front of image search, and #620's NSFW judge keys its per-file cache with verdict_cache.cache_key.

What changed

  • mwmbl/imagesearch/rules.py, ported from the image branch: the sexual and nudity deny terms, folded through NFKD with invisible characters removed, plus query_verdict and image_verdict.
  • One fix to the port: underscores and digits now separate words before matching. Commons file names join words with underscores, and \b counts both as word characters, so topless_beach, Woman_nude.jpg and 2naked got past the rules. The review found this. It has tests.
  • Verdict in types.py.
  • mwmbl/imagesearch/verdict_cache.py: only cache_key and its prefix. The pixel-verdict functions and digest_files stay behind, since only the image branch's pipeline uses them. The docstring has been rewritten to drop the pixel specifics.
  • Tests: the rules tests from the image branch, plus tests for query_verdict, the file-name cases and cache keys.

How it was verified

  • make check passes. make test passes (1841 passed with Seed Search images: move the image questions into imagesearch, with a fail-closed NSFW judge #620 on top, run before the underscore fix). After the fix, the image search, judge and jev_rank tests pass (82).
  • Subagent review covered code, security, trust and safety, and the whole change. Fixed: the underscore bypass. Not fixed, and accepted because the rules are a first line with the judge behind them:
    • matching is suffix-only and English-only (seminude, nackt and desnudo pass);
    • homoglyph and leetspeak spellings pass (p0rn, a Cyrillic о).

Part of #610

🤖 Generated with Claude Code

@codecov
codecov Bot commented Nov 10, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@daoudclarke
daoudclarke added this pull request to stack #632 November 11, 2026 07:02
Base automatically changed from seed-images-prod-commons to main November 11, 2026 07:03
…search branch

Seed Search keeps rules.query_verdict in front of image search (#610), and the judge's
per-file NSFW cache keys come from verdict_cache.cache_key. Both live on
wikicommons_image_search, which will not be merged, so this ports rules.py as it is
there, the Verdict it returns, and cache_key (without the pixel-verdict functions only
that branch's pipeline uses), with their tests.

One change from the port: underscores and digits now separate words before matching.
Commons file names join words with underscores, and \b treats both as word characters,
so "topless_beach" or "Woman_nude.jpg" slipped past the rules.

Part of #610

No functional changes to the crawler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@daoudclarke
daoudclarke force-pushed the seed-images-prod-rules branch from 13408b2 to 02aa9f6 Compare November 11, 2026 07:03
@daoudclarke daoudclarke left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

LGTM

@daoudclarke
daoudclarke merged commit 4e6d2bf into main Nov 11, 2026
8 checks passed
@daoudclarke
daoudclarke deleted the seed-images-prod-rules branch November 11, 2026 10:25
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

0