Skip to content

feat(search): ברירת המחדל בחיפוש הגלובלי היא 10 תוצאות, ונוספה אפשרות 5 - #3344

Merged
amirbiron merged 2 commits into
mainfrom
claude/implementation-plan-approval-scxvhw
Sep 6, 2026
Merged

feat(search): ברירת המחדל בחיפוש הגלובלי היא 10 תוצאות, ונוספה אפשרות 5#3344
amirbiron merged 2 commits into
mainfrom
claude/implementation-plan-approval-scxvhw

Conversation

@amirbiron

@amirbironamirbiron commented Sep 6, 2026

Copy link
Copy Markdown
Owner

תבנית Pull Request

✨ תיאור קצר

בורר מספר התוצאות בחיפוש הגלובלי הציע 10 / 20 / 50 עם ברירת מחדל 20. עכשיו הוא מציע 5 / 10 / 20 / 50 עם ברירת מחדל 10.

הערך הזה חי בשלוש שפות: ה-selected ב-webapp/templates/files.html, קוד ה-JS ב-webapp/static/js/global_search.js, וברירת המחדל של /api/search/global ב-webapp/app.py. בתוך ה-JS הוא היה משוכפל גם בין שני אתרי קריאה — איפוס הסלקטים ובניית גוף הבקשה. ארבעה מקומות, בלי שום דבר שקושר ביניהם.

📦 שינויים עיקריים

  • קוד (Backend)
  • בוט טלגרם
  • מסד נתונים/מיגרציות
  • תיעוד (docs/)
  • DevOps/CI/CD

1. הבורר (files.html) — נוספה <option value="5">, ו-selected עבר ל-10.

2. קבוע אחד ב-JSDEFAULT_RESULTS_PER_PAGE מוצהר פעם אחת ומשמש בשני אתרי הקריאה, במקום '20' קשיח בכל אחד מהם.

3. ברירת המחדל בשרת יושרה ל-10. הלקוח תמיד שולח limit, ולכן זו נפילה-לאחור בלבד — אבל ברירת מחדל שאינה תואמת הייתה מחזירה 20 למי שקורא ל-API ישירות בזמן שהמסך מבטיח 10. השרת כולא ל-[1, 100], ולכן 5 עובר בלי שינוי נוסף.

🧪 בדיקות

  • Unit
  • Integration
  • Manual

tests/test_search_results_per_page_default.py — 9 טסטים שקושרים בין שלושת הקבצים: רשימת האפשרויות, ה-selected ב-HTML, הקבוע ב-JS, ברירת המחדל בשרת, והיעדר עותקים קשיחים שנשארו מאחור.

הוכח שהטסט מסוגל להיכשל: החזרתי את ה-selected ל-20 ב-HTML בלבד, והטסט תפס (1 failed, 8 passed). אחרי השחזור — 9 עוברים.

זו בדיקת טקסט על קוד מקור, וזה מכוון. אין דרך התנהגותית לאמת שקובץ HTML, קובץ JS וקובץ Python מסכימים על מספר בלי להרים דפדפן אמיתי. המחיר ידוע — פירמוט מחדש יפיל אותה — והודעות הכשל מנוסחות כדי שיהיה ברור מיד שזה מה שקרה. זה מתועד ב-docstring של הקובץ.

רגרסיה: 27 טסטים בקבצים שנוגעים לחיפוש הגלובלי — עוברים.

🧪 בדיקות נדרשות ב‑PR

  • 🔍 Code Quality & Security
  • Unit Tests (3.11)
  • Unit Tests (3.12)

📝 סוג שינוי

  • feat: פיצ'ר חדש
  • fix: תיקון באג
  • docs: שינוי תיעוד בלבד
  • refactor: שינוי קוד ללא שינוי התנהגות
  • perf: שיפור ביצועים
  • chore/ci: תשתית/CI
  • breaking change: שינוי שובר תאימות

✅ צ'קליסט

  • הקוד עוקב אחרי הסגנון
  • בדיקות רצות ועוברות
  • תיעוד עודכן — אין ערך מתועד לשינוי הזה
  • אין סודות/מפתחות בקוד
  • אין מחיקות מסוכנות
  • הודעת הקומיט תואמת Conventional Commits
  • CHANGELOG — שינוי UI קטן, לא נראה לי שמצדיק ערך
  • אין שינוי UI ויזואלי — יש: נוספה אפשרות בבורר וברירת המחדל השתנתה
  • עיינתי במסמכי אתר התיעוד — לא נדרש כאן: כל מה שהשינוי נוגע בו נמצא בשלושת הקבצים עצמם, ואומת ב-grep שאין קורא רביעי ל-/api/search/global

🧩 השפעות/סיכונים

משתמש שרגיל ל-20 תוצאות יקבל 10. הבחירה שלו אינה נשמרת בין טעינות ממילא — global_search.js מאפס את הסלקטים לברירת המחדל, וזו התנהגות קיימת שלא שיניתי.

🧯 סיכון / החזרה לאחור (Rollback)

git revert. אין מצב מתמשך ואין נתונים שנוגעים בהם.

🔗 קישורים

🤖 Generated with Claude Code

https://claude.ai/code/session_011URGXZrC6oiQR8PBET7QCM


Generated by Claude Code

Review in cubic

Summary by Sourcery

Set the global search default to 10 results, add a 5-result option, and enforce consistency across the UI, client, and API.

New Features:

  • Offer 5, 10, 20, and 50 results per page in global search, with 10 as the default.

Bug Fixes:

  • Align the global search API fallback default with the client and UI default.

Enhancements:

  • Centralize the client-side default and add coverage ensuring the HTML, JavaScript, and API defaults remain consistent.

Tests:

  • Add tests covering the available result limits, selected UI default, JavaScript default usage, API fallback, and server clamping.

הערך חי בשלושה מקומות בשלוש שפות — ה-``selected`` ב-``files.html``,
הקבוע ב-``global_search.js``, וברירת המחדל של ``/api/search/global``
ב-``app.py``. קודם הוא היה משוכפל גם בתוך ה-JS עצמו בשני אתרי קריאה.
עכשיו ה-JS מחזיק קבוע אחד (``DEFAULT_RESULTS_PER_PAGE``), שלושת הקבצים
מסכימים, ו-``tests/test_search_results_per_page_default.py`` קושר ביניהם:
אין דרך התנהגותית לאמת ש-HTML, JS ו-Python מסכימים על מספר בלי להרים
דפדפן, ולכן הטסט קורא את שלושתם. הוכח שהוא נופל — שיניתי את ה-``selected``
ב-HTML בלבד והוא תפס.
ברירת המחדל בשרת שונתה גם היא ל-10. הלקוח תמיד שולח ``limit``, אז זו
נפילה-לאחור בלבד, אבל ברירת מחדל שאינה תואמת הייתה מחזירה 20 למי שקורא
ל-API ישירות בזמן שהמסך מבטיח 10. השרת כולא ל-1..100, ולכן 5 עובר.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011URGXZrC6oiQR8PBET7QCM
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sourcery-ai

sourcery-aiBot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

The PR changes global search from a default of 20 results to 10, adds a 5-result option, and prevents drift between the HTML selector, JavaScript request/reset logic, and API fallback through a shared-client constant plus focused regression tests.

File-Level Changes

ChangeDetailsFiles
Align the global-search results-per-page default across the UI, JavaScript client, and API fallback, while adding 5 as a supported option.
  • Add the 5-results option and select 10 by default in the results selector.
  • Centralize the JavaScript default and use it when resetting the selector and constructing requests.
  • Change the API fallback and exception fallback from 20 to 10 while retaining the 1–100 clamp.
webapp/templates/files.html
webapp/static/js/global_search.js
webapp/app.py
Add source-level regression tests that enforce agreement between the three independently implemented defaults and verify all offered values remain valid.
  • Assert the selector options and selected value.
  • Assert the JavaScript constant, its call-site usage, and absence of old hardcoded fallbacks.
  • Assert the server default and that 5, 10, 20, and 50 pass the server clamp.
tests/test_search_results_per_page_default.py

Possibly linked issues

  • #unknown: The PR directly refines the issue’s global search UI and endpoint pagination behavior.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitaiBot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 1adde9d2-2c9d-439a-bf98-be9f8a120f84

📥 Commits

Reviewing files that changed from the base of the PR and between 82ffc19 and 106cf86.

📒 Files selected for processing (4)
  • tests/test_search_results_per_page_default.py
  • webapp/app.py
  • webapp/static/js/global_search.js
  • webapp/templates/files.html

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

🧯 Dangerous deletes guard report

Policy: see .cursorrules — dangerous deletions are blocked unless wrapped safely.

Summary:

  • Flagged findings (blocking): 0
    0
  • Excluded matches (not blocking): 15
  • Total matches (all files): 129

Flagged findings (file:line:snippet):
(none)

Excluded matches (by path pattern)
./webapp/static/js/md_preview.bundle.js.map:4: "sourcesContent": ["// Markdown-it plugin to render GitHub-style task lists; see\n//\n// https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments\n// https://github.com/blog/1825-t … [truncated]
./docs/DOCUMENTATION_GUIDE.md:453:rm -rf _build
./docs/Makefile:24:	rm -rf $(BUILDDIR)
./Dockerfile:42: rm -rf /var/lib/apt/lists/*
./Dockerfile:121: rm -rf /var/lib/apt/lists/*
./node_modules/katex/package.json:153: "build": "rimraf dist/ && mkdirp dist && cp README.md dist && rollup -c --failAfterWarnings && webpack && node update-sri.js package dist/README.md",
./node_modules/katex/src/fonts/Makefile:139:	rm -rf pfa ff otf ttf woff woff2
./node_modules/mermaid/dist/mermaid.js.map:4: "sourcesContent": ["/**\n* Default values for dimensions\n*/\nconst defaultIconDimensions = Object.freeze({\n\tleft: 0,\n\ttop: 0,\n\twidth: 16,\n\theight: 16\n});\n/**\n* Default values for tr … [truncated]
./node_modules/mermaid/dist/chunks/mermaid.esm/chunk-2M32CCKP.mjs.map:4: "sourcesContent": ["{\n \"name\": \"mermaid\",\n \"version\": \"11.12.0\",\n \"description\": \"Markdown-ish syntax for generating flowcharts, mindmaps, sequence d … [truncated]
./node_modules/mermaid/dist/chunks/mermaid.esm.min/chunk-4HFYJGYH.mjs.map:4: "sourcesContent": ["{\n \"name\": \"mermaid\",\n \"version\": \"11.12.0\",\n \"description\": \"Markdown-ish syntax for generating flowcharts, mindmaps, sequen … [truncated]
./node_modules/mermaid/dist/chunks/mermaid.esm.min/chunk-4HFYJGYH.mjs:1:var r={name:"mermaid",version:"11.12.0",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graph … [truncated]
./node_modules/mermaid/dist/chunks/mermaid.core/chunk-KS23V3DP.mjs.map:4: "sourcesContent": ["{\n \"name\": \"mermaid\",\n \"version\": \"11.12.0\",\n \"description\": \"Markdown-ish syntax for generating flowcharts, mindmaps, sequence … [truncated]
./node_modules/mermaid/dist/mermaid.min.js:1524:`,"getStyles"),c1e=RQe});var h1e={};dr(h1e,{diagram:()=>NQe});var NQe,f1e=N(()=>{"use strict";$ge();a1e();l1e();u1e();NQe={parser:Fge,db:n1e,renderer:o1e,styles:c1e}});var m1e,g1e=N(()=>{"use … [truncated]
./node_modules/mermaid/dist/mermaid.min.js.map:4: "sourcesContent": ["/**\n* Default values for dimensions\n*/\nconst defaultIconDimensions = Object.freeze({\n\tleft: 0,\n\ttop: 0,\n\twidth: 16,\n\theight: 16\n});\n/**\n* Default values fo … [truncated]
./README.md:842:find . -name "__pycache__" -exec rm -rf {} +

@github-actions

github-actionsBot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

⏱️ Performance report

(No performance test durations collected. Mark tests with @pytest.mark.performance.)

@github-actions

github-actionsBot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

The documentation has been built successfully!

To view locally:

  1. Download the artifacts
  2. Extract the zip file
  3. Open index.html in your browser

@sourcery-aisourcery-aiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments### Comment 1
<locationpath="tests/test_search_results_per_page_default.py"line_range="78-81" />
<code_context>
+++@pytest.mark.parametrize("value", EXPECTED_OPTIONS)
+def test_every_offered_option_survives_the_server_clamp(value):
+ """5 הוא חדש — צריך לוודא שהשרת לא כולא אותו כלפי מעלה."""
+ assert min(100, max(1, value)) == value
</code_context>
<issue_to_address>
**issue (testing):** This test only evaluates Python's local `min(100, max(1, value))` expression and never exercises or inspects the server's clamp, so a backend change that clamps the new `5` option to `10` still passes.
**Triggers:** When the server's limit-clamping implementation changes independently of the test.
**Suggested fix:** Exercise the endpoint with each offered value, or add a source assertion that the actual `api_search_global` clamp preserves every offered value.
```suggestion@pytest.mark.parametrize("value", EXPECTED_OPTIONS)def test_every_offered_option_survives_the_server_clamp(value): """5 הוא חדש — צריך לוודא שהשרת לא כולא אותו כלפי מעלה.""" py = _read("webapp/app.py") m = re.search( r"def api_search_global\(\):.*?limit = min\((\d+), max\((\d+), " r"int\(payload\.get\('limit'\) or \d+\)\)\)", py, re.S, ) assert m, "the /api/search/global limit clamp changed shape" upper, lower = map(int, m.groups()) assert lower <= value <= upper```
</issue_to_address>
### Comment 2
<locationpath="webapp/app.py"line_range="9604" />
<code_context>
+ # ``files.html``. הלקוח תמיד שולח ``limit``, ולכן זו נפילה-לאחור+ # בלבד — אבל ברירת מחדל שאינה תואמת הייתה מחזירה 20 למי שקורא+ # ל-API ישירות בזמן שהמסך מבטיח 10.+ limit = min(100, max(1, int(payload.get('limit') or 10))) except Exception:- limit = 20
</code_context>
<issue_to_address>
**nitpick:** The repository's global-search implementation guides still document the old `10 / 20 / 50` selector with `20` selected, and one guide still specifies `DEFAULT_RESULTS_PER_PAGE: 20`; those instructions now contradict the implemented default of `10` and the new `5` option.
**Triggers:** When a maintainer uses the feature guides as the reference for future changes or reimplementation.
**Suggested fix:** Update the affected global-search guides to document `5 / 10 / 20 / 50` with `10` as the default, or clearly mark the old snippets as historical.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: tests/test_search_results_per_page_default.py:81


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment on lines +78 to +81
@pytest.mark.parametrize("value", EXPECTED_OPTIONS)
def test_every_offered_option_survives_the_server_clamp(value):
"""5 הוא חדש — צריך לוודא שהשרת לא כולא אותו כלפי מעלה."""
assert min(100, max(1, value)) == value

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue (testing): This test only evaluates Python's local min(100, max(1, value)) expression and never exercises or inspects the server's clamp, so a backend change that clamps the new 5 option to 10 still passes.

Triggers: When the server's limit-clamping implementation changes independently of the test.

Suggested fix: Exercise the endpoint with each offered value, or add a source assertion that the actual api_search_global clamp preserves every offered value.

Suggested change
@pytest.mark.parametrize("value", EXPECTED_OPTIONS)
deftest_every_offered_option_survives_the_server_clamp(value):
"""5 הוא חדש — צריך לוודא שהשרת לא כולא אותו כלפי מעלה."""
assertmin(100, max(1, value)) ==value
@pytest.mark.parametrize("value", EXPECTED_OPTIONS)
deftest_every_offered_option_survives_the_server_clamp(value):
"""5 הוא חדש — צריך לוודא שהשרת לא כולא אותו כלפי מעלה."""
py=_read("webapp/app.py")
m=re.search(
r"def api_search_global\(\):.*?limit = min\((\d+), max\((\d+), "
r"int\(payload\.get\('limit'\) or \d+\)\)\)",
py,
re.S,
)
assertm, "the /api/search/global limit clamp changed shape"
upper, lower=map(int, m.groups())
assertlower<=value<=upper

Comment threadwebapp/app.py
# ``files.html``. הלקוח תמיד שולח ``limit``, ולכן זו נפילה-לאחור
# בלבד — אבל ברירת מחדל שאינה תואמת הייתה מחזירה 20 למי שקורא
# ל-API ישירות בזמן שהמסך מבטיח 10.
limit = min(100, max(1, int(payload.get('limit') or 10)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nitpick: The repository's global-search implementation guides still document the old 10 / 20 / 50 selector with 20 selected, and one guide still specifies DEFAULT_RESULTS_PER_PAGE: 20; those instructions now contradict the implemented default of 10 and the new 5 option.

Triggers: When a maintainer uses the feature guides as the reference for future changes or reimplementation.

Suggested fix: Update the affected global-search guides to document 5 / 10 / 20 / 50 with 10 as the default, or clearly mark the old snippets as historical.

@codecov

codecovBot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cubic-dev-aicubic-dev-aiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

3 issues found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/test_search_results_per_page_default.py">
<violation number="1" location="tests/test_search_results_per_page_default.py:81">
P3: test_every_offered_option_survives_the_server_clamp doesn't check the server at all — it recomputes the same formula `min(100, max(1, value))` with literals and asserts a tautology that [5,10,20,50] always satisfies. It never reads app.py, so if the server clamp changed (e.g. to `max(20, ...)`) this test still passes, contradicting its docstring. Remove it (test_the_server_default_agrees_with_the_client already locks the clamp shape) or make it read app.py and verify each EXPECTED_OPTIONS value survives the clamp.</violation>
</file>
<file name="webapp/app.py">
<violation number="1" location="webapp/app.py:9604">
P3: Low severity: Update the global-search implementation guides to document the `5 / 10 / 20 / 50` selector with `10` selected; the current guides now describe behavior this change no longer implements.</violation>
</file>
<file name="webapp/static/js/global_search.js">
<violation number="1" location="webapp/static/js/global_search.js:7">
P2: Custom agent: **Enforce Pragmatic Test Coverage**
This changes the user-visible results-per-page behavior, but the new tests only compare source text and a local clamp expression. Add a behavioral test that exercises the selector/default and verifies the corresponding search request (including the new `5` option) and result state.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

// על הערך הזה: ה-``selected`` שב-``webapp/templates/files.html``, הקבוע
// הזה, וברירת המחדל של ``/api/search/global`` ב-``webapp/app.py``.
// הם בשלוש שפות ואי אפשר לחלוק ביניהם קבוע, ולכן ההערה הזו היא הקישור.
const DEFAULT_RESULTS_PER_PAGE = '10';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Custom agent: Enforce Pragmatic Test Coverage

This changes the user-visible results-per-page behavior, but the new tests only compare source text and a local clamp expression. Add a behavioral test that exercises the selector/default and verifies the corresponding search request (including the new 5 option) and result state.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At webapp/static/js/global_search.js, line 7:
<comment>This changes the user-visible results-per-page behavior, but the new tests only compare source text and a local clamp expression. Add a behavioral test that exercises the selector/default and verifies the corresponding search request (including the new `5` option) and result state.</comment>
<file context>
@@ -1,5 +1,11 @@
+ // על הערך הזה: ה-``selected`` שב-``webapp/templates/files.html``, הקבוע
+ // הזה, וברירת המחדל של ``/api/search/global`` ב-``webapp/app.py``.
+ // הם בשלוש שפות ואי אפשר לחלוק ביניהם קבוע, ולכן ההערה הזו היא הקישור.
+ const DEFAULT_RESULTS_PER_PAGE = '10';
+
let currentSearchQuery = '';
</file context>

@pytest.mark.parametrize("value", EXPECTED_OPTIONS)
def test_every_offered_option_survives_the_server_clamp(value):
"""5 הוא חדש — צריך לוודא שהשרת לא כולא אותו כלפי מעלה."""
assert min(100, max(1, value)) == value

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: test_every_offered_option_survives_the_server_clamp doesn't check the server at all — it recomputes the same formula min(100, max(1, value)) with literals and asserts a tautology that [5,10,20,50] always satisfies. It never reads app.py, so if the server clamp changed (e.g. to max(20, ...)) this test still passes, contradicting its docstring. Remove it (test_the_server_default_agrees_with_the_client already locks the clamp shape) or make it read app.py and verify each EXPECTED_OPTIONS value survives the clamp.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/test_search_results_per_page_default.py, line 81:
<comment>test_every_offered_option_survives_the_server_clamp doesn't check the server at all — it recomputes the same formula `min(100, max(1, value))` with literals and asserts a tautology that [5,10,20,50] always satisfies. It never reads app.py, so if the server clamp changed (e.g. to `max(20, ...)`) this test still passes, contradicting its docstring. Remove it (test_the_server_default_agrees_with_the_client already locks the clamp shape) or make it read app.py and verify each EXPECTED_OPTIONS value survives the clamp.</comment>
<file context>
@@ -0,0 +1,81 @@
+@pytest.mark.parametrize("value", EXPECTED_OPTIONS)
+def test_every_offered_option_survives_the_server_clamp(value):
+ """5 הוא חדש — צריך לוודא שהשרת לא כולא אותו כלפי מעלה."""
+ assert min(100, max(1, value)) == value
</file context>

Comment threadwebapp/app.py
# ``files.html``. הלקוח תמיד שולח ``limit``, ולכן זו נפילה-לאחור
# בלבד — אבל ברירת מחדל שאינה תואמת הייתה מחזירה 20 למי שקורא
# ל-API ישירות בזמן שהמסך מבטיח 10.
limit = min(100, max(1, int(payload.get('limit') or 10)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: Low severity: Update the global-search implementation guides to document the 5 / 10 / 20 / 50 selector with 10 selected; the current guides now describe behavior this change no longer implements.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At webapp/app.py, line 9604:
<comment>Low severity: Update the global-search implementation guides to document the `5 / 10 / 20 / 50` selector with `10` selected; the current guides now describe behavior this change no longer implements.</comment>
<file context>
@@ -9596,9 +9596,14 @@ def _is_regex_safe(p: str) -> bool:
+ # ``files.html``. הלקוח תמיד שולח ``limit``, ולכן זו נפילה-לאחור
+ # בלבד — אבל ברירת מחדל שאינה תואמת הייתה מחזירה 20 למי שקורא
+ # ל-API ישירות בזמן שהמסך מבטיח 10.
+ limit = min(100, max(1, int(payload.get('limit') or 10)))
except Exception:
- limit = 20
</file context>

@amirbiron
amirbiron merged commit 5149143 into mainSep 6, 2026
29 checks passed
Sign up for freeto 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.

2 participants

@amirbiron@claude