Repository navigation
Keep Parsons blocks apart when their code has a bare "<" - #1604
Merged
bnmnetp merged 1 commit intoOct 12, 2026
Merged
Conversation
extract_parsons_code stripped HTML tags with "<.*?>", so in stored markup
that keeps a bare "<" in its code ("if close < low_close:") it deleted
everything up to the next ">" -- often in the paired distractor. The
correct block, the "---" and the distractor merged into one block tagged
#paired, and CodeTailor dropped it as a distractor: the subgoal-label
puzzle lost that step, and the LLM and fallback paths got mangled markup.
Strip only real tags (a "<" followed by a letter or "/", closed on the same
line) and escape any "<" left, so the result matches the escaped markup
other questions store.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
CodeTailor drops a Parsons block when its code contains a bare
<, such asif close < low_close:. A student asking for help on a question built on such a backup problem gets a puzzle with that step missing.Cause.
extract_parsons_codestripped HTML tags with<.*?>. Some stored markup keeps a bare<in its code instead of<. The regex then ran from that<to the next>, usually in the paired distractor'sif close > low_close:. It deleted the code and the---between them, so the correct block merged into its distractor, and the merged block ends in#paired. The subgoal-labels puzzle (#1599) skips distractor blocks, so the step and its label disappeared. The LLM-personalized and fallback paths received the same mangled markup.Fix. Only real tags are stripped: a
<followed by a letter or/, closed on the same line. Any<left over is escaped to<, so the output matches the escaped markup most questions already store and the rest of the pipeline expects.Scope. Comparing the old and new extraction over all 1,309 Parsons questions in a local database copy:
<is now<. Their text is identical once unescaped.Testing.
test_extract_parsons_code.py: 4 of its 5 tests fail on the old regex, and all 5 pass with the fix.if close < low_close:. The subgoal-labels puzzle now includes the "update the lowest close…" step, and the example-solution puzzle keeps theifblock.🤖 Generated with Claude Code