Skip to content

Fix web app error with proposed solution - #895

Merged
amirbiron merged 2 commits into
mainfrom
cursor/fix-web-app-error-with-proposed-solution-cc0b
Oct 20, 2025
Merged

amirbiron merged 2 commits into
mainfrom
cursor/fix-web-app-error-with-proposed-solution-cc0b

Conversation

@amirbiron

@amirbiron amirbiron commented Oct 20, 2025 •

Copy link
Copy Markdown
Owner

✨ תיאור קצר

  • תיקון שתי שגיאות שהתקבלו בווב אפ: עדכון יצירת אינדקס במונגו כדי למנוע שגיאות CannotCreateIndex עקב שימוש ב-$ne ב-partial index, והוספת endpoint חסר (POST /api/user/preferences) למניעת 404 בעת שמירת העדפות עורך.

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

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

פירוט נקודות (רשימת תבליטים):

  • עדכון יצירת אינדקס unique_user_file_anchor ב-BookmarksManager לשימוש ב-$exists: True במקום $ne: "" ב-partialFilterExpression, כדי לתמוך בגרסאות MongoDB שאינן תומכות ב-$ne ב-partial index.
  • הוספת endpoint חדש POST /api/user/preferences ב-webapp/app.py לשמירת העדפת סוג עורך (editor_type) עבור המשתמש, ובכך למנוע שגיאות 404 מה-frontend.

🧪 בדיקות

  • איך בדקתם? מה עבר? מה נשאר?
    • בדיקה ידנית:
      • וודא שאינה מופיעה יותר שגיאת CannotCreateIndex על unique_user_file_anchor (דורש הפעלת שרת מחדש).
      • שינוי העורך בממשק המשתמש שולח בקשת POST ל-/api/user/preferences ומחזיר { ok: true, editor_type: ... } ללא שגיאת 404.
  • Unit
  • Integration
  • Manual

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

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

📝 סוג שינוי

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

✅ צ'קליסט

  • הקוד עוקב אחרי הסגנון (Black/isort/flake8/mypy)
  • בדיקות רצות ועוברות
  • תיעוד עודכן (README/Docs)
  • אין סודות/מפתחות בקוד
  • אין מחיקות מסוכנות/פעולות על root (ראו .cursorrules)
  • הודעת הקומיט תואמת Conventional Commits (ע"פ הטבלה)
  • CHANGELOG עודכן אם נדרש
  • כל ה‑Required Checks לעיל ירוקים
  • צילום/וידאו UI מצורף אם רלוונטי

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

  • השפעה אפשרית על פרודקשן, ביצועים, או אבטחה:
    • תיקון האינדקס אמור לשפר יציבות במקרים מסוימים ולא להשפיע לרעה.
    • הוספת ה-endpoint היא תוספת פונקציונלית שפותרת שגיאה קיימת. סיכון נמוך.

🔗 קישורים

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

  • תוכנית חזרה לאחור במקרה תקלה: החזרה לגרסה קודמת של הקוד ופריסה מחדש. האינדקס הישן ייווצר מחדש (אם לא קיים), וה-endpoint יוסר.

Open in Cursor Open in Web


Note

Updates the bookmarks anchor partial index to use exists+type (avoiding $ne) and adds POST /api/user/preferences to persist editor_type in session and DB.

  • Database:
    • Indexes: Update partialFilterExpression for unique_user_file_anchor in database/bookmarks_manager.py to { "anchor_id": { "$exists": true, "$type": "string" } } (replace $ne: "") for broader MongoDB compatibility.
  • Web App (API):
    • New endpoint: POST /api/user/preferences in webapp/app.py to set editor_type (simple|codemirror), applying immediately via session and persisting to users.ui_prefs.editor.

Written by Cursor Bugbot for commit 1488ba1. This will update automatically on new commits. Configure here.

Feat: Add API endpoint to update user editor preference

Co-authored-by: amirbiron <amirbiron@gmail.com>
@cursor

cursor Bot commented Oct 20, 2025

Copy link
Copy Markdown
Contributor

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@github-actions

github-actions Bot commented Oct 20, 2025 •

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): 125

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

Excluded matches (by path pattern)
./Dockerfile:34:    rm -rf /var/lib/apt/lists/*
./Dockerfile:76:    rm -rf /var/lib/apt/lists/*
./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]
./README.md:754:find . -name "__pycache__" -exec rm -rf {} +
./docs/DOCUMENTATION_GUIDE.md:453:rm -rf _build
./docs/Makefile:24:	rm -rf $(BUILDDIR)
./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/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.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/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.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/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]
./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

@github-actions

github-actions Bot commented Oct 20, 2025 •

Copy link
Copy Markdown
Contributor

⏱️ Performance report

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

@amirbiron
amirbiron marked this pull request as ready for review October 20, 2025 23:17
@codecov

codecov Bot commented Oct 20, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@amirbiron
amirbiron merged commit 46be8c0 into main Oct 20, 2025
37 of 38 checks passed
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.

2 participants