Skip to content

md_parser: פער סוג 7 מוגדר כ"מכל" — גם ציטוט, לא רק פריט רשימה - #3455

Merged
amirbiron merged 2 commits into
mainfrom
claude/affectionate-knuth-r6nz9i
Sep 22, 2026
Merged

amirbiron merged 2 commits into
mainfrom
claude/affectionate-knuth-r6nz9i

Conversation

@amirbiron

@amirbiron amirbiron commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

✨ תיאור קצר

  • המשך של feat(mcp): פארסר Markdown ל-docs_get_section, מעל markdown-it-py #3418 (מוזג). התגובה באישו ה-upstream ב-markdown-it-py (executablebooks/markdown-it-py#434) הביאה שלושה מקרי גבול לפער הידוע של תגית HTML מסוג 7. שלושתם נמדדו כאן מול שלושת המימושים (הפארסר שלנו, cmark-gfm ומימוש הייחוס commonmark.py 0.9.2). שניים מסכימים בכל המימושים ונכנסו כצורות מקובעות מסכימות. השלישי — > a ואז <br> צמוד — הוא פער אמיתי שהמשפחה שלנו לא כיסתה, ולכן המחלקה המקובעת מוגדרת עכשיו כ"תגית צמודה לשורת מכל (פריט רשימה או ציטוט)" ולא כ"פריט רשימה" בלבד.
  • אין שינוי בפארסר. רק במשפחת הצורות המחוללות ובפרוזה שמתארת אותה. המספרים נגזרים ולא מוקלדים: 11,549 צורות מושוות, 12 מוחרגות.

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

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

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

  • tests/test_md_parser_oracle.py: _LIST_MARKERS הפך ל-_CONTAINER_MARKERS עם > לצד - ו-1. ; המחולל _type7_after_list_shapes שונה שמו ל-_type7_after_container_shapes כי השם הישן היה שקר אחרי ההרחבה. ההערה מסבירה שהציטוט הגיע מהתגובה באישו, שנמדד שהוא מתנהג זהה לשני סמני הרשימה (צמוד = פער, מופרד = הסכמה), ולמה: כלל הציטוט ב-markdown-it מסמן המשכים לא-נבדקים בהזחה שלילית, ובדיקת ה-terminate של סוג 7 לא מתבצעת מול המכל החיצוני.
  • שתי צורות מקובעות מסכימות חדשות, _TYPE7_INDENTED_AGREEING — התגית מוזחת ארבעה רווחים בתוך פריט, וגם עם שני אבות (מקרים A ו-B מהתגובה). הן נכנסות ל-_compare ולספירה. תפקידן: תיקון נאיבי upstream לסוג 7 שובר בדיוק אותן, ואם ספרייה עתידית תסטה בהן, זה ייתפס אצלנו ולא יתגלה בשקט.
  • טסט ההחרגה test_the_excluded_class_is_exactly_the_glued_shapes_and_nothing_more והטסט הפרמטרי של אי-ההסכמה מודדים עכשיו את שלושת המכלים (4 תגיות × 3 מכלים = 12), ומקבעים במפורש שכל צורה מוחרגת היא בדיוק צורה צמודה ולא יותר מזה.
  • טסט הספירה test_the_generated_shape_count_matches_the_prose מחשב את שתי הצורות החדשות ובודק גם את "מחלקה אחת ידועה ומקובעת של 12 צורות" מול המונה בפועל. הוא נופל אם אחד משלושת מקומות הפרוזה יסטה מהמחולל.
  • services/md_parser.py (docstring בלבד) ו-requirements/base.txt (הערה בלבד): המספרים והגדרת המחלקה עודכנו, וההפניה מצביעה על שם המחולל החדש.
  • קומיט שני: מספר האישו executablebooks/markdown-it-py#434 נכנס לשלושת מקומות הפרוזה שנושאים את אותה אזהרה על הפער — ה-docstring של המחולל (במקום משפט המקום-שמור), ה-docstring של md_parser, וה-docstring של קובץ האורקל. לפי bugbot-rules/prose-restates-code-fact.md: ההפניה שאפשר למצוא ב-grep היא מספר האישו, והיא צריכה להופיע בכל המקומות. ההערה ליד המחולל אומרת גם מה הסימן לסגירת האישו: הטסט הפרמטרי של הפער ייפול על גרסה מתוקנת, ואז מוחקים את ההחרגה ולא מרפים אותו.

🧪 בדיקות

  • על הגרסאות הנעוצות (markdown-it-py 3.0.0, mdit-py-plugins 0.4.2, cmarkgfm, commonmark 0.9.2), על העץ אחרי ה-rebase על main (שם md_parser.py כבר מייבא מ-.line_endings ומ-doc_sections.MAX_SECTIONS): test_md_parser.py, test_md_parser_oracle.py, test_mcp_outline.py, test_mcp_docs_handlers.py, test_rst_parser.py — 101 עוברים. flake8 נקי. אחרי הקומיט השני — שתי חבילות הפארסר שוב ירוקות ו-flake8 נקי.
  • T2 (הטסטים על הקוד הישן, ב-worktree נפרד על 15ab1ae): טסט הספירה נופל (11,543 ≠ 11,549) — זה תפקידו. שלושת טסטי המשפחה עוברים גם על הבסיס, כי הם קיבוע של פער שהתנהגותו לא השתנתה.
  • מוטציה: הפיכת צורה A לצמודה (הסרת ההזחה) מפילה את _compare שלה — כלומר הצורות המסכימות באמת מודדות משהו ולא עוברות ריק.
  • הסקריפט scripts/compare_md_parser_to_cmark.py על שני הקורפוסים: אפס אי-הסכמות, ללא שינוי.
  • Unit
  • Integration
  • Manual

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

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

📝 סוג שינוי

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

✅ צ'קליסט

  • הקוד עוקב אחרי הסגנון (Black/isort/flake8/mypy)
  • בדיקות רצות ועוברות
  • תיעוד עודכן — ה-docstring של md_parser וההערה ב-base.txt (שני מקומות מתוך שלושה שמצהירים "אפס אי-הסכמות"; השלישי הוא ה-docstring של קובץ הטסטים)
  • אם נוספו ג'ובים חדשים — לא רלוונטי
  • אם נוספו/שונו משתני סביבה — לא רלוונטי
  • אם נוספו/השתנו טוקנים — לא רלוונטי
  • אין סודות/מפתחות בקוד
  • אין מחיקות מסוכנות/פעולות על root
  • הודעת הקומיט תואמת Conventional Commits (md_parser: כפי שנהוג בסדרה הזו)
  • CHANGELOG — לא נדרש
  • כל ה‑Required Checks לעיל ירוקים
  • צילום/וידאו UI — לא רלוונטי
  • עיינתי במסמכי אתר התיעוד — נתיב: AI-MAP.md ← אין עמוד על הפארסר עצמו (הוא יקבל עמוד ב-PR 5 עם החיווט). CodeBot – Project Docs לא נפתח מעבר לזה, כי השינוי כולו בתוך קובץ הטסטים והפרוזה שמתארת אותו.
  • דפוסי באגים שנקראו: TESTING-PATTERNS.md (T1/T2 — הטסטים הורצו על הקוד הישן), claude-md-snippets/testing.md כלל 5, RECURRING-PATTERNS.md R6 (grep לפני שם חדש — _TYPE7_INDENTED_AGREEING ו-_CONTAINER_MARKERS לא היו קיימים), ו-bugbot-rules/prose-restates-code-fact.md (לקומיט השני — מספר האישו בכל מקום שנושא את האזהרה).

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

  • אפס השפעה על פרודקשן: הפארסר לא נגע, והמודול עדיין לא מחווט לשום כלי (החיווט הוא PR 5).
  • התנהגות מכוונת: אם גרסה עתידית של markdown-it-py תתקן את סוג 7, הטסט הפרמטרי test_a_type7_tag_glued_to_a_container_still_disagrees_as_measured ייפול. זה מכוון ומתועד ב-.. warning:: שלו: אז מוחקים את המחלקה המוחרגת ומעדכנים את הפרוזה, לא מרפים את הטסט.

🔗 קישורים

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

  • revert של שני הקומיטים. אין מיגרציה, אין שינוי סכימה, אין שינוי תלות (הגרסה הנעוצה של markdown-it-py לא זזה).

🤖 Generated with Claude Code

https://claude.ai/code/session_01YSksrtTEth7eY52jwgYVbb

&lt;source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"&gt;&lt;source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"&gt;&lt;img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"&gt;

Summary by Sourcery

Expand the fixed Markdown parser oracle exception to cover type-7 HTML tags adjacent to block containers while preserving agreement checks for validated edge cases.

Enhancements:

  • Broaden the documented and tested Markdown parser exception from list items to all containers, including block quotes, for type-7 HTML tags immediately following the container.
  • Add coverage for agreeing indented boundary cases and keep generated shape and exclusion counts aligned with the expanded test family.

Build:

  • Update the base dependency specification.

Documentation:

  • Update parser documentation to describe the expanded container-level exception and revised generated shape counts.

Tests:

  • Extend oracle coverage across list and block-quote containers, including boundary cases and exact exclusion validation.

התגובה באישו ה-upstream הביאה שלושה מקרי גבול, וכולם נמדדו מול
שלושת המימושים. שניים מסכימים (תגית מוזחת ארבעה רווחים בתוך פריט,
גם עם שני אבות) והם נכנסו כצורות מקובעות מסכימות — תיקון נאיבי
upstream שובר בדיוק אותם, ואם ספרייה עתידית תסטה בהם _compare יתפוס
אצלנו. השלישי הוא פער אמיתי שלא כיסינו: `> a` ואז `<br>` צמוד —
אצלנו כותרת, ב-cmark ובמימוש הייחוס אפס. הרחבתי את המשפחה ל-`>`
לצד `-` ו-`1.` ונמדד ששלושת המכלים מתנהגים זהה, ולכן המחלקה
המקובעת מוגדרת עכשיו כ"מכל" ולא כ"פריט רשימה", בשלושת המקומות.

המספרים נגזרים ולא מוקלדים: 11,549 מושוות, 12 מוחרגות. אין שינוי
בפארסר.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YSksrtTEth7eY52jwgYVbb
@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-ai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

ה-PR אינו משנה את הפארסר עצמו; הוא מרחיב את בדיקות האורקל של פער HTML מסוג 7 כך שיכסו ציטוטים בנוסף לרשימות, מקבע שתי צורות גבול מוסכמות, ומעדכן את התיעוד והספירות הנגזרות ל-11,549 השוואות ו-12 צורות מוחרגות.

Flow diagram for expanded HTML type 7 oracle coverage

flowchart LR
    G["Generated Markdown shapes"] --> O["Oracle comparison tests"]
    O --> C["cmark-gfm / reference implementation"]
    O --> M["markdown-it"]
    C --> R["Classify matching and known divergent cases"]
    M --> R
    R --> S["11,549 comparisons"]
    R --> X["12 excluded type 7 container shapes"]
Loading

File-Level Changes

Change Details Files
הרחבת מחלקת פערי סוג 7 מכלי רשימה לכלל המכלים, כולל ציטוטים.
  • הוספת > למכפלת הצורות לצד - ו-1. .
  • החלפת מחולל, שמות בדיקות והתיעוד ממוקדי-רשימה לממוקדי-מכל.
  • קיבוע 12 הצורות המוחרגות: ארבע תגיות מול שלושה מכלים, רק כשהתגית צמודה.
  • עדכון בדיקות ההסכמה וההחרגה כך שיכסו גם ציטוטים ויוודאו שההחרגה מדויקת.
tests/test_md_parser_oracle.py
services/md_parser.py
קיבוע מקרי גבול מוסכמים כדי להגן מפני תיקון עתידי שגוי.
  • הוספת שתי צורות שבהן תגית סוג 7 מוזחת ארבעה רווחים בתוך פריט, כולל מבנה עם שני אבות.
  • הכללת הצורות החדשות ב-_compare ובספירה הנגזרת.
tests/test_md_parser_oracle.py
סנכרון התיעוד והספירות עם מערך הבדיקות החדש.
  • עדכון התיאור מ-11,543 ל-11,549 צורות ומ-8 ל-12 צורות מוחרגות.
  • עדכון ההפניה לשם המחלקה החדשה ולחישוב הספירה הכוללת.
services/md_parser.py
tests/test_md_parser_oracle.py
עדכון תלות בפרויקט.
  • שינוי יחיד בקובץ דרישות הבסיס.
requirements/base.txt

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

@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): 128

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 {} +

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 51e2a3ba-3cb4-46c6-b76d-bae52762a1b5

📥 Commits

Reviewing files that changed from the base of the PR and between 8744737 and 594d358.

📒 Files selected for processing (3)
  • requirements/base.txt
  • services/md_parser.py
  • tests/test_md_parser_oracle.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Changes

הרחבת בדיקות Markdown Oracle

שכבה / קבצים סיכום
הרחבת מקרי בדיקות ה-Oracle
tests/test_md_parser_oracle.py
בדיקות תגיות HTML מסוג 7 הורחבו מפריטי רשימה לכלים, כולל ציטוטים. נוספו מקרי הסכמה מוזחים. בדיקות ההחרגה והספירה עודכנו.
סנכרון התיעוד והמדדים
services/md_parser.py, requirements/base.txt
תיאור התאימות וההערה עודכנו ל-11,549 צורות ול-12 צורות חריגות. ההפניה עודכנה ל-_type7_after_container_shapes ול-issue המתאים.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 594d3

The expanded oracle tests and synchronized compatibility documentation are ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed כותרת ה-PR קצרה, ברורה ומתארת את השינוי המרכזי: הרחבת פער סוג 7 מפריטי רשימה לכלל המכלים, כולל ציטוטים.
Description check ✅ Passed תיאור ה-PR מקיף את מטרת השינוי, הקבצים שנגעו בהם, הבדיקות, הסיכונים, הקישורים ותוכנית החזרה לאחור. התיאור מציין במפורש שאין שינוי בפארסר או בפרודקשן. העבודה של Claude Code מתועדת היטב.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

תגיות ומכלים נפגשים בשורה,
רשימה וציטוט עוברים בדיקה ברורה,
הספירות עודכנו בדיוק ובאור,
Claude Code טווה בדיקות בקו טהור,
CodeKeeper forever 💫

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

@sourcery-ai sourcery-ai Bot 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 reviewed your changes and they look great!

Sourcery assessment

Approved.


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

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

⏱️ Performance report

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

@github-actions

github-actions Bot commented Sep 22, 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

משפט המקום-שמור ליד המחולל הוחלף בקישור לאישו, ומספר האישו נכנס גם
לשני המקומות האחרים שנושאים את אותה אזהרה על הפער — ה-docstring של
md_parser וה-docstring של קובץ האורקל — כדי ש-grep על המזהה ימצא את
כולם ביום שהאישו ייסגר. ההערה ליד המחולל אומרת גם מה הסימן לכך:
הטסט הפרמטרי של הפער ייפול על גרסה מתוקנת, ואז מוחקים את ההחרגה.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YSksrtTEth7eY52jwgYVbb
@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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