Skip to content

fix: refuse mastery visual cards whose pixels were not inspected - #2502

Merged
pancacake merged 1 commit into
HKUDS:devfrom
markjoin123:cursor/fix-ungradeable-visual-card-9c21
Nov 15, 2026
Merged

pancacake merged 1 commit into
HKUDS:devfrom
markjoin123:cursor/fix-ungradeable-visual-card-9c21

Conversation

@markjoin123

Copy link
Copy Markdown
Contributor

Summary

  • prepare_visual refuses a visual when the named source was not in the tutor's model input, so mastery_quiz returns Visual practice is unavailable: … no assessment was created and does not register the card.
  • A card already stored with pixels_inspected: false still grades as ungraded and does not change mastery.
  • mastery_repair_question with action="correct" on that card returns the existing “Void it and pose a supported replacement” guidance. action="void" is unchanged.

Fixes #2494

AI assistance

This fix and its regression tests were prepared with AI assistance.

Test plan

  • Uninspected source (empty hash list and a non-matching hash) is refused for a single card and a group, and nothing is persisted
  • A stored uninspected card grades ungraded with the pixel message and no mastery change
  • action="correct" asks to void it; action="void" abandons the card and leaves mastery unchanged
  • ruff check and ruff format --check on the edited files

Additional verification: 80 focused tests and 745 learning/capability tests passed.

A visual whose source resolved but whose pixels were never in the model
input was still registered. Grade and correct then failed closed, and only
void could clear the card. Refuse that visual before registration, and tell
a correction of an already stored card to void it.

Fixes HKUDS#2494

Co-authored-by: markxu <[email protected]>
@Antonio-Faure

Copy link
Copy Markdown
Contributor

Reviewed: unsupported single/group visual cards are refused before registration; existing uninspected cards remain ungraded, correct is refused with void guidance, and void clears pending state without mastery credit. 19 visual workflow + 30 related tests passed.

Merge-ready. Boundary note: direct internal prepare_visual(..., inspected_image_hashes=None) still falls back to the legacy boolean; public quiz creation never uses that fallback.

@pancacake
pancacake merged commit 2cd84d7 into HKUDS:dev Nov 15, 2026
23 checks passed
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.

3 participants