complete the quiz path for grades 8 through 12, and close three gaps in the API contract

Content
-------
Every node in grades 8, 9, 10, 11 and 12 now holds a full four-question
quiz — 121 more questions, filling the two حسابان دوازدهم nodes in
فصل ۵: کاربردهای مشتق that were empty and the two ریاضی هشتم nodes that
were short. The repo's own seed guard was already failing on those two
empty nodes; it passes now.

Grades 3, 6 and 7 are the other team's books and were left alone. 39 of
their 145 nodes still hold fewer than four questions, but none is empty,
so every node on the map still plays.

An audit over all 1,593 questions in grades 8–12 found no structural
fault: no question with the wrong number of options, no question with
zero or two correct answers, no empty or duplicated option, no leftover
LaTeX, and no two identical questions inside one lesson.

Contract
--------
Three endpoints were missing or malformed in the OpenAPI schema, which
matters more than it looks: that schema is the contract the frontend
generates its client from, so a view missing there is a view the other
repo cannot call.

- NotificationMarkReadView was dropped from the schema entirely, because
  spectacular could not guess a request body for its PATCH and gives up
  on the whole view rather than the one field. It declares request=None.
- PaymentRedirectView was dropped for the same reason; it answers with a
  302 and no JSON body, which it now says.
- /api/health and /api/health/ collided on operationId and were emitted
  as health_retrieve and health_retrieve_2. The slash variant exists only
  for a monitor that calls it that way, so it is excluded from the schema.

`spectacular` now runs clean — no errors, no warnings.

Tidying
-------
Condensed the two longest comment blocks (18 and 14 lines) in
rag_verify_solutions and settings, keeping the measurement and the rule
and dropping the retelling. README gains the bulk question-authoring
workflow; the playbook's subagent section now points at the real tool
instead of describing the steps by hand.

458 tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-22 03:49:32 +03:30
parent 82edd0ecb0
commit 6a6d0200d2
9 changed files with 2140 additions and 41 deletions

View File

@@ -82,24 +82,14 @@ def is_account_limit(exc) -> bool:
return '403' in text and 'insufficient' in text
# مسئله‌ای که به شکل/جدولِ کتاب ارجاع می‌دهد و **محتوای آن را ننوشته** بدونِ
# تصویر قابلِ حل نیست؛ فرستادنش هم پول می‌سوزاند هم آمار را خراب می‌کند.
# مسئله‌ای که به شکلِ کتاب ارجاع می‌دهد و محتوایش را ننوشته، بدونِ تصویر
# قابلِ حل نیست؛ فرستادنش هم پول می‌سوزاند هم آمار را خراب می‌کند.
#
# ⚠️ نسخه‌ی اولِ این محافظ یک regexِ تخت بود:
# شکل|جدول|نمودار|روبه‌رو|روبرو|مقابل|...|زیر را|بالا را
# و فاجعه‌بار گشاد بود. سه نمونه از چیزهایی که بی‌دلیل رد می‌کرد:
# «زاویه‌های روبه‌رو در لوزی برابرند؟» ← «روبه‌رو» یعنی مقابل، نه شکل
# «کسرهای زیر را گویا کنید: ۲/√۳» ← داده همان‌جاست
# «به شکل مخروطی با شعاع ۴ و ارتفاع ۱۲» ← «به شکلِ ...» یعنی شبیهِ
# اندازه‌گیری (۱۴۰۵/۰۶/۲۹، نمونه‌ی ۵۰تایی از کتاب‌های بازخوانی‌شده): از
# مسئله‌هایی که این محافظ رد کرده بود، **۸۴٪ واقعاً قابلِ قضاوت بودند** —
# یعنی ~۷۸۴ مسئله‌ی سالم بی‌صدا از چرخه‌ی ساختِ سوال بیرون مانده بودند.
#
# قاعده‌ی تازه دو شرط دارد، و هر دو باید برقرار باشند:
# ۱. ارجاعِ صریح به چیزی بیرونِ متن باشد («شکل زیر»، «جدول روبه‌رو»)
# ۲. بعد از آن ارجاع، توصیفی نیامده باشد (نه «که ...»، نه عدد، نه نماد)
# شرطِ دوم همان چیزی است که قاعده‌ی self-contained تولید می‌کند: مدل حالا
# می‌نویسد «با توجه به شکل مقابل **که شامل {a,1} است**».
# ⚠️ این محافظ باید دو شرطی بماند — ارجاعِ صریح به بیرونِ متن، *و* نیامدنِ
# توصیف بعد از آن. نسخه‌ی اولش یک regexِ تخت روی «شکل|جدول|روبه‌رو|…» بود و
# «زاویه‌های روبه‌رو در لوزی» یا «کسرهای زیر را گویا کنید: ۲/√۳» را هم می‌گرفت:
# در نمونه‌ی ۵۰تایی ۸۴٪ از ردشده‌ها واقعاً قابلِ قضاوت بودند، یعنی ~۷۸۴ مسئله‌ی
# سالم بی‌صدا از چرخه‌ی ساختِ سوال بیرون مانده بود.
_FIGURE_REFERENCE = re.compile(
r'(شکل|جدول|نمودار|تصویر|نقشه)\s*(ِ|های|‌های)?\s*'
r'(زیر|بالا|روبه\u200cرو|روبرو|مقابل|فوق|داده\s*شده)'