Skip to content

CodeTailor generates one-liner solutions for Parsons puzzles when student has no code, defeating the purpose of the exercise #1284

Description

@aspadiyath

Summary

When a student clicks "Get Help" on an activecode problem while their editor still just contains starter code (no real attempt), CodeTailor's Parsons scaffolding is frequently built from a terse, single-line solution (e.g. a list comprehension or chained one-liner) rather than a structured, multi-step solution. Parsons puzzles are meant to let students practice assembling control structure (loops, conditionals, variable assignment order) — a one-line solution collapses into 1-2 blocks and provides no structural practice.

Root cause

  • student_code_checker() (bases/rsptx/book_server_api/routers/personalized_parsons/buggy_code_checker.py) correctly detects "no student code contributed," but the downstream path in generate_personalized_fixed_code() (bases/rsptx/book_server_api/routers/personalized_parsons/end_to_end.py, lines 292-298) then falls straight through to generate_example_solution() with no path that asks for a pedagogically structured solution.
  • get_example_solution()'s prompt (bases/rsptx/book_server_api/routers/personalized_parsons/get_personalized_solution.py, lines 241-249) only constrains for correctness and "entry-level features" — it does not discourage comprehensions, ternaries, or single-expression solutions, so the LLM is free to return the shortest idiomatic answer.
  • Because there's no student code in this branch, the "similar to student's approach" fixing logic (request_fixed_code_from_openai) never runs, so there's no mechanism at all to force multi-line/structural decomposition here.

Steps to reproduce

  1. Open an activecode problem configured with CodeTailor.
  2. Leave the editor as the unmodified starter code (or empty).
  3. Click "Get Help."
  4. Observe the generated Parsons puzzle is a trivial 1-2 block puzzle built from a one-line solution.

Expected behavior

The generated example solution used for Parsons scaffolding should reflect a step-by-step, structurally decomposed solution (using explicit loops/conditionals/intermediate variables as appropriate for the problem), even when no student code exists, so the puzzle gives students real practice with program structure.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions