fix: reject fill-in-the-blank/short-answer drafts with a placeholder … - #78
Merged
Merged
Conversation
…answer key
evaluation.expected was excluded from the grounding-echo check on purpose
(it usually holds structural ids), but for didact.quiz.fill-in-the-blank,
didact.quiz.short-answer and didact.completion-problem it holds the actual
graded answer text. A model that left the example placeholder there
("respuesta") passed validation and shipped an exercise whose correct
answer was literally the word "respuesta" — the bug users reported.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SUqXYDVrx1DxZnk5B58Yxk
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.
What and why
Users reported fill-in-the-blank (and other constructed-answer) exercises whose
correct answer was literally the word "respuesta". The authoring contract's example
ships a placeholder answer key (
evaluation.expected: ["respuesta", "la respuesta", "respuestas"]) fordidact.quiz.fill-in-the-blank,didact.quiz.short-answeranddidact.completion-problem. The runtime grounding gate that rejects echoed examplecontent explicitly skips
evaluation/expected, by design, since for mostcomponents that subtree holds structural ids, not content. A model that left the
placeholder there passed validation and shipped an unanswerable exercise.
This adds a second, narrower check (
_reject_unsubstituted_expected) scoped to thethree components whose
expectedis free-text answer content, rejecting a draftwhen any expected value is still the contract's placeholder — same decline-and-retry
path as the existing content-echo check.
Checks
uv run ruff check src testsanduv run pytest -m "not integration"(fromapps/skillnet-api/) — 4339 passed, including two new tests that reproduce the reported bug.pnpm lint,pnpm testandpnpm build(fromapps/skillnet-web/) — not run; this change doesn't touch the frontend..env.example? — N/A, none of those changed.Notes for the reviewer
This is a hypothesis grounded in the code and confirmed with a unit test that
reproduces the exact symptom (well-formed question,
expectedstill theplaceholder) — I have not confirmed a live production row with this exact leak.
If you can check
activity_definitions.private_definition -> evaluation -> expectedfor rows literally equal to "respuesta" / "la respuesta" / "respuestas"before merging, that closes the loop.