Skip to content

feat(mastery): independently graded question groups with safe submission recovery - #1943

Merged
pancacake merged 4 commits into
HKUDS:devfrom
yepyhun:contrib/mastery-grouped-assessment
Oct 18, 2026
Merged

pancacake merged 4 commits into
HKUDS:devfrom
yepyhun:contrib/mastery-grouped-assessment

Conversation

@yepyhun

@yepyhun yepyhun commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Optional structured answer maps travel through the existing durable turn
    request, submission adapter and grade tool. Single-question clients remain
    compatible; no database migration or dependency is added.
  • All requested leaf answers must be present before grading. Leaf grading uses
    existing assistance, visual uncertainty and objective credit rules. Unknown
    keys remain ungraded rather than being classified as learner errors.
  • An existing pending question is retained by default. Explicit replacement
    requires the expected current question ID and a quotation from the current
    learner message. Validation precedes replacement; history is not deleted.
  • Stale/duplicate submissions cannot switch to the current question or award
    repeated credit. Leaf records support existing question-bank and repair
    workflows; repairing a leaf also updates its parent's stored contract/result.
  • Rewriting/removing an objective invalidates a group containing that objective.
    Read-only outline operations do not rewrite an unchanged pending interaction.
  • The UI uses native leaf controls inside one group with one submit/skip action.
    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.
  • Playbook guidance requests registered groups when appropriate, not on every
    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.

@pancacake
pancacake merged commit 59cdd81 into HKUDS:dev Oct 18, 2026
9 of 15 checks passed
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
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