BUG: /videos/semantic-search query normalization and whitespace validation bypass
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 領域
- api, backend, machine-learning
調査の方向性
The behavior is implemented in backend/app/routes/videos.py; start by comparing /videos/semantic-search with /videos/semantic-search’s image counterpart in backend/app/routes/images.py. Validate that whitespace-only input returns HTTP 400, nonblank queries are stripped and lowercased before SigLIP2 inference, and video scores are rounded to four decimals. The issue author reports already implementing the fix and tests, so it is not currently a good first contribution.
索引モデルが issue の本文から書いたものです。
説明
Is there an existing issue for this?
- I have searched the existing issues
What happened?
Is there an existing issue for this?
- I have searched the existing issues
What happened?
Summary
In backend/app/routes/videos.py, the video semantic search endpoint (GET /videos/semantic-search) fails to sanitize, validate, and normalize query strings before running SigLIP2 inference.
Where and How It Occurs
- Validation Bypass on Whitespace Queries:
The route parameter defines query: str = Query(..., min_length=1). FastAPI min_length only checks raw string length, so queries containing only spaces (e.g. " ") bypass validation. - Missing strip() and lower() Normalization:
Unlike /images/semantic-search (in backend/app/routes/images.py), /videos/semantic-search passes the raw query string straight into SIGLIP2_QUERY_TEMPLATE.format(query=query). Because the SigLIP2 tokenizer is case-sensitive and scoring calibration (logit_scale and logit_bias) was fitted on lowercased vocabulary, queries like "Beach" vs "beach" produce disparate token IDs and uncalibrated similarity scores. - Wasted Compute:
Submitting whitespace or clearing search input triggers full ONNX text encoding and heavy matrix multiplications against all stored video keyframe embeddings instead of immediately returning HTTP 400 Bad Request. - Score Precision Inconsistency:
Image semantic search rounds scores to 4 decimals (round(score, 4)), while video search emits raw unrounded float numbers.
Steps to Reproduce
- Start the backend service.
- Ensure at least one video keyframe embedding is indexed.
- Send a GET request to /videos/semantic-search with whitespace:
GET /videos/semantic-search?query=%20%20%20 - Notice that the server returns HTTP 200 after executing ONNX inference and matrix multiplication instead of returning HTTP 400 Bad Request with "Query cannot be empty".
- Send GET /videos/semantic-search?query=Beach vs GET /videos/semantic-search?query=beach and observe different tokenizations due to lack of lowercasing.
Expected Behavior
- Whitespace-only queries should immediately return HTTP 400 Bad Request with {"success": false, "error": "Bad Request", "message": "Query cannot be empty"}.
- Queries should be stripped and lowercased before formatting into the template to maintain calibration parity with image search.
- Output similarity scores should be rounded to 4 decimal places.
Maintainer Note & Assignment
cc @rohan-pandeyy
I have already diagnosed the root cause, implemented the fix with regression unit tests, and verified that all backend tests pass.
I would be working on this and will drop the pr once assigned.
Record
- I agree to follow this project's Code of Conduct
Record
- I agree to follow this project's Code of Conduct
- 主要言語
- Python
- スター
- 322
- フォーク
- 793
- 平均マージ
- 6日 10時間
- マージ済み PR(30日)
- 20
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AOSSIE-Org/PictoPy のほかの issue
-
bug enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
AOSSIE-Org/PictoPy#1802 · コメント 2 件 ·
メンテナーはふだん 3 日以内に返信
-
BUG: XMP metadata export permanently overwrites file modification timestamp (mtime), destroying photo dates対応中かも @swastiksharma45 が 2 日前に担当しました。 オープンbug enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
AOSSIE-Org/PictoPy#1788 · コメント 6 件 ·
メンテナーはふだん 3 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
AOSSIE-Org/PictoPy#1786 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
BUG: Semantic search sees portrait phone photos sideways (SigLIP ignores EXIF orientation)対応中かも @omkar-suryavanshi が 3 日前に担当しました。 オープンbug enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
AOSSIE-Org/PictoPy#1780 · コメント 5 件 ·
メンテナーはふだん 3 日以内に返信
-
BUG: Share password loses leading/trailing spaces so the password you set doesn't work対応中かも @ManyaJain111 が 2 日前に担当しました。 オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
AOSSIE-Org/PictoPy#1779 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
AOSSIE-Org/PictoPy の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
hermes hooks doctor smoke test never checks the hook exit code — a crashing hook (exit=1) renders ✓ "ran clean" and "All shell hooks look healthy"対応中かも @cestercian が今日担当しました。 オープンcomp/cli P2 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
NousResearch/hermes-agent#162259 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
upstream update
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
conan-io/conan-center-index#31597 ·
メンテナーはふだん 1 日以内に返信
-
community-request
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA-NeMo/Run#727 ·
メンテナーはふだん 1 日以内に返信
-
bot-triaged module: higher order operators module: pickle module: pt2-dispatcher oncall: pt2 triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
pytorch/pytorch#207247 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信