Repository navigation
feat(mastery): independently graded question groups with safe submission recovery - #1943
Merged
Merged
Conversation
This was referenced Oct 12, 2026
This was referenced Oct 13, 2026
alvinets
pushed a commit
to alvinets/DeepTutor
that referenced
this pull request
Nov 8, 2026
alvinets
pushed a commit
to alvinets/DeepTutor
that referenced
this pull request
Nov 8, 2026
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.
Summary
Addresses #1941; tracked in #1940. Thank you for the existing Mastery work.
This adds bounded grouped practice to the existing question lifecycle rather
than registering several competing active questions or grading multipart prose.
One parent interaction owns 2–4 native question cards. Each leaf retains its
own objective, answer contract, result and durable identity. A parent aggregate
is presentation only and never grants additional mastery credit.
Behavior and safety
request, submission adapter and grade tool. Single-question clients remain
compatible; no database migration or dependency is added.
existing assistance, visual uncertainty and objective credit rules. Unknown
keys remain ungraded rather than being classified as learner errors.
requires the expected current question ID and a quotation from the current
learner message. Validation precedes replacement; history is not deleted.
repeated credit. Leaf records support existing question-bank and repair
workflows; repairing a leaf also updates its parent's stored contract/result.
Read-only outline operations do not rewrite an unchanged pending interaction.
Answer keys stay hidden until assessment. A real server rejection reopens the
submitted group without discarding inputs; repeated rejections are recognized
by distinct call identities.
turn. A narrow prose-delivery fallback catches explicit numbered multipart
practice, without treating numbered lesson explanations as assessments.
Concise explanations must remain explanatory; no hard word quota is added.
Validation scope
40 focused Python lifecycle/contract regressions pass (2.88 seconds), and 28
targeted native DOM tests pass. DOM interaction tests cover
independent/mixed/unknown results, incomplete answers, duplicate and stale IDs,
reload, explicit replacement, objective invalidation, public key redaction,
repair, submission transport and rejection recovery. Native single-question
tests are retained. TypeScript, scoped lint, locale parity, contract generation
and whitespace checks pass. A separate local integration has 44 passing backend
tests, 35 passing DOM tests, and a successful production build/HTTP smoke.
These tests do not certify every model's question quality or prove universal
pedagogical adherence. No paid model call, real learner-progress mutation or
long-running indexing run is required for these deterministic checks.
Boundaries
This is a complete bounded grouped-question workflow, not the broader semantic
grading proposal in #1901. It reuses current grading types and thresholds.
Global cross-path profiling, arbitrary-size exams, a new scheduler and a second
evaluator model are intentionally outside this contribution. Maintainers are
welcome to use a better equivalent design preserving the learner-facing behavior
and safety invariants.
Follow-up: incremental answers and partial feedback
Commit 9cfa5cb addresses the grouped-practice part of #1949. A nonempty subset of known child replies is committed durably; only new leaves are graded, and replay does not duplicate attempts. Unknown IDs and conflicting replacements reject atomically. Parent results explicitly expose complete/remaining_question_ids; unanswered leaves remain ungraded, and partial repairs preserve siblings.
The shared UI locks graded leaves only, releases its sending latch on a new durable partial acknowledgement, retains remaining drafts and shows later rejection/retry controls. Old complete grades and the single-question workflow remain compatible. Unanswered is not evidence of a misconception.
Focused proof: 47 backend/transport tests on the clean contribution, 33 DOM/hook tests on both clean and local integrations, plus local full TypeScript check and production build. The separate local source bridge passed 52 focused backend/bridge tests and is not copied wholesale into this PR. No paid-model teaching benchmark was run; this is durable transport/assessment behavior, not a guarantee of semantic grading quality.
See #1949 and tracking issue #1940.
Follow-up: exact card resume and Markdown assessment delivery
Commit 6532c8c fixes a remaining delivery gap: numbered Markdown section titles followed by question paragraphs could solicit multiple answers without a registered card. The existing finish policy now recognizes this shape under explicit assessment intent and directs the model back to the existing tool. Quoted/code examples and ordinary teaching are not requests to repost a card. This is defense in depth, not universal semantic intent detection.
The same mastery_quiz tool now supports pending_action=resume plus the exact current parent resume_question_id, without fresh stems, keys or replacement arguments. The existing register_question transaction validates active identity and eligible status; stale/historical/answered/terminal IDs and conflicting contracts reject. Answers, keys and credit stay intact. Committed-but-ungraded answers require grading first, not an invented UI result.
For partial groups, a public allowlisted cumulative grade receipt travels with the resumed card, so the existing UI restores answered-child locks even when the original history page is absent. No new frontend production surface, database or grading engine is introduced. Native validation checks current interaction/objective identity; the additional saved-source-evidence freshness gate exists only in the extended local preparation integration and is not copied into this PR.
RED checkpoint 7e16a93: 10 failed, 11 passed. GREEN clean contribution: 131 focused delivery/group/capability tests in 18.53s. Separate source-integrated root scope: 137 passed in 25.89s. One actual MessageList resume DOM regression passed in both worktrees. These scopes overlap, not additive coverage. Evidence: .github/tdd/mastery-group-delivery-resume.md. No live inference/learner-state edits; selecting actual reference-bank questions is a separate issue from delivery.
References #1941 and #1949; current scope and remaining work are in tracking issue #1940.