Repository navigation
לינקר: היסטוריית "שם" עוברת שלמה בגבולות המנות (מפת הכותרות), ושחזורים בלי היסטוריה - #12
Merged
Y-PLONI merged 5 commits intoOct 28, 2026
Conversation
IbidContext replayed only the last three refs at each transport seam, which rebuilt
IbidHistory's title map from those refs alone. A title cited before them ("Berakhot
2a ... Shabbat, Shabbat, Shabbat ... X שם" naming Berakhot) was gone after a seam, so
a book's links depended on BATCH_LINES/BATCH_CHARS (100 locally, 25 on Kaggle) and on
where an inserted line pushed the seams.
The seam now restores the exact state: the last refs, the titles in first-seen order
and the title map. The checkpoint sidecar goes to ibid state schema 4 with
title_refs; a schema-3 sidecar is refused, so a resumed batch replays instead of
adopting a history without titles. The context-probe seam check stays, now only
conservative.
tests/test_ibid_layout.py links seeded random books whole and under every small
layout, with worker recycling through the JSON state, against a copy of the pinned
IbidHistory; it fails on the previous code.
…story parenthesized_address and chapter_led_citation call resolve_raw_ref after bulk_link has finished the whole transport batch, so Sefaria's ibid history then holds the citations after the failed one, up to wherever the batch happens to end. An IBID context from it (accepted by parenthesized_address) or a context match that prunes the context-free reading made the recovery depend on later lines and on the layout. Both now resolve with an empty history (resolve_alone), which is what "resolved alone" meant, and the resolver's history object is put back afterwards.
A mutation that called resolve_raw_ref directly again passed every test: the recoveries are now checked through parenthesized_address and chapter_led_citation themselves.
The length check ran after IbidContext.resolve had captured the batch's end state, so the line-by-line replay of a short reply began from the history of lines after it (a bare "שם" on the first line could point forward). The check now raises inside the call, before the capture.
…fecting engine_src goes to c9f0a1b83cc87198 and needs a full relink. It is registered from the published lineage (e3599195a9566a5c) and from PR #11's output-neutral engine (17df3c79a33074d5), so either merge order keeps the lineage guard exact.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
הבאג
ספר עם "שם" מקושר במנות (transport batches): 100 שורות מקומית, 25 ב-Kaggle. כל מנה היא קריאת
bulk_linkנפרדת, וספריא מאפסת בה את היסטוריית ה-ibid.IbidContextאמור להעביר את ההיסטוריה מעבר לגבול, כך שהספר יתנהג כרצף אחד, אבל הוא העביר רק את 3 ה-refs האחרונים.IbidHistoryשל ספריא שומרת גם מפת כותרות: כותרת → ה-ref האחרון מאותו ספר, עד 3 כותרות. המפה משמשת לציטוט שמזכיר שם ספר ("ברכות שם", או כותרת עם כתובת חלקית). השחזור מ-3 ה-refs בנה אותה מחדש רק מהם, ולכן כל כותרת שצוטטה לפניהם נעלמה בגבול:התוצאה: הקישורים של ספר היו תלויים ב-
BATCH_LINES/BATCH_CHARS(מקומי מול Kaggle), ובמקום שאליו עריכה הזיזה את הגבולות. גם סדר_last_titles(סדר הופעה ראשונה, לא אחרונה) השתבש, ולכן מאוחר יותר נזרקה כותרת אחרת.השינויים
IbidContextמעביר את ההיסטוריה כולה (95172ad): ה-refs, הכותרות לפי הסדר, ומפת הכותרות, בדיוק כמו ב-IbidHistoryהמוצמד.title_refs.IbidHistory, החסמיםlast_n_*, והאינווריאנט "קבוצת הכותרות = מפתחות המפה".parenthesized_addressו-chapter_led_citationקוראים ל-resolve_raw_refאחרי שכל המנה כבר נפתרה. ההיסטוריה של ספריא כוללת אז את הציטוטים שאחרי הציטוט שנכשל, עד סוף המנה, כלומר עתיד שתלוי בפריסה.parenthesized_addressקיבל גם הקשר IBID ממנה, כי הוא דוחה רק CURRENT_BOOK.chapter_led_citationהיא יכלה לגזום (prune) את הקריאה ה-context-free.resolve_alone), וזו המשמעות של "resolved alone" שבתיעוד שלהם. אובייקט ההיסטוריה של ה-resolver מוחזר למקומו.bulk_link(db982c3, נמצא ב-QA, קיים מקודם): בדיקת האורך רצה אחרי ש-IbidContextכבר שמר את מצב סוף המנה. ה-replay שורה-שורה התחיל אז מהיסטוריה של שורות מאוחרות, ו"שם" בשורה הראשונה יכול היה להצביע קדימה. הבדיקה עברה לתוך הקריאה, לפני השמירה.בדיקות
python3 -m unittest discover -s tests: 470 טסטים, 12 דילוגים, הכול עובר.tests/test_ibid_layout.py(חדש):IbidHistoryהמוצמד.test_ibid_layoutעל הקוד של לינקר: ספר עם "שם" עובר NER רק על השורות שהשתנו, כשההיסטוריה לא יכולה לזוז #11: 16 כשלים ו-2 שגיאות.resolve_aloneלקריאה ישירה: 2 כשלים.הרצה מבודדת ליד ה-stack, בלי לגעת בו: עותק של Mongo בפורט נפרד, NER בפורט נפרד ו-
PYTHONHASHSEED=26. הדגימה כללה 60 ספרים עם "שם" (36 מספריא, 18 מ-Dicta ו-6 מאחרים), 20,412 שורות. ה-NER רץ פעם אחת, והפלט שלו הוזן מחדש לכל וריאנט.Ref(normal).index.titleשווה לכותרת בכל המקרים.resolve_aloneלא שינה אף רשומה. הבאג מוכח ב-fake המדויק, אבל בפועל הוא נדיר. ההשפעה של ה-relink על הקישורים צפויה להיות קטנה.QA
שני סוכני QA בלתי תלויים, בלי חוסמים.
_ibid_candidateמעבר לגבול, AltStruct, ו-sidecars משובשים.book is recycling without progressבמקום replay, בגללcommitted_shard_count. זו בעיה קיימת מקודם. sidecar של schema 3 לא יכול לפגוש את הקוד החדש בייצור, כי שחזור checkpoint מקומי מחייב את אותוhead_sha(ci/validate_local_checkpoint_source.py). לא תוקן כאן.אחרי המיזוג: relink מלא
engine_src: עובר ל-c9f0a1b83cc87198ונרשם ב-output_affecting_fingerprint_changes.json. יש שתי רשומות: מה-lineage שפורסם (e3599195a9566a5c), ומהמנוע של לינקר: ספר עם "שם" עובר NER רק על השורות שהשתנו, כשההיסטוריה לא יכולה לזוז #11 (17df3c79a33074d5). כך הסדר לא משנה, ובדקתי את שני המצבים.adopt_fingerprint.SERIAL_LINKER_TARGETהואlocal.library_run_id) מיד אחרי המיזוג, ולא להשאיר את זה ל-build הבא, שיחכה כ-12 שעות או יותר.לא בתיקון הזה
ספרים בלי "שם": ספריא משתמשת בהיסטוריה גם לציטוט בלי כותרת ("פרק ג" לבד) ולעידון ציטוט עם כותרת, וזה לא תלוי בטוקן "שם". ספר בלי "שם" לא מקבל
IbidContext: ההיסטוריה שלו מתאפסת בכל מנה, ובתוכנית שורות חלקית היא נבנית רק מהשורות שנשלחו. שער ה-ibid מבוסס על הטוקן ולכן אינו שמרני ביחס לספריא. זה קיים מקודם. נמדד על ה-runner, 40 ספרים בלי "שם" (12,025 שורות):Shabbat 61.שורה-שורה היא קירוב של עריכה בודדת בתוכנית שורות. הפתרון ייקר: להכניס את כל הספרים לשער ה-context-probe.