Skip to content

fix: confirm F2 resets before discarding learner edits #47

Open

Description

@abhiksark

Motivation

F2 currently resets learner code immediately. Reset is destructive from a learner perspective, so the default TUI path must make cancellation easy and failures visible.

Current evidence

  • The documented interface maps F2 to reset the current exercise.
  • Reset snapshots live under .pythonlings/originals/, and reset failures are possible when a snapshot is missing or unreadable.
  • The TUI suite already uses Textual pilot tests for interactive behaviour.

Exact scope

Add a safe-default confirmation modal for F2 reset. y confirms; n and Esc cancel. Reset errors must render visibly in the TUI instead of propagating as a crash.

Acceptance checklist

  • Pressing F2 opens a confirmation modal before any learner file is changed.
  • y performs the reset and refreshes the current exercise view.
  • n and Esc cancel without changing the learner file or progress state.
  • Missing/broken reset snapshots show an actionable visible error and leave the TUI running.
  • Focus and key handling remain predictable while the modal is open.
  • Textual pilot tests cover confirm, cancel via n, cancel via Esc, and visible reset failure.

Explicit exclusions

Do not change CLI pythonlings reset confirmation semantics, add a bulk-reset flow, auto-save destructive changes, or redesign unrelated TUI navigation.

Likely files

  • pythonlings/screens/track.py and/or pythonlings/app.py
  • pythonlings/widgets/ or pythonlings/screens/ modal component (new as needed)
  • pythonlings/pythonlings.tcss
  • tests/tui/test_app_pilot.py

Verification

python -m pytest tests/tui -q
python -m pytest -q

Manually run the TUI against a fixture workspace and exercise confirm, both cancel keys, and a deliberately missing snapshot.

Sprint coordination

See the sprint Discussion. This issue is unassigned and is not a reservation.

Activity

  1. coderabbitai commented on Aug 9, 2026

    @coderabbitai
    🔗 Related PRs

    #31 - feat: overall progress, completion celebration, first-launch welcome (#14, #15, #16) [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added
    enhancement
    on Aug 9, 2026
  3. added
    bug
    help wanted
    dev sprint
    area: tui
    size: M
    and removed
    enhancement
    on Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: tuibugdev sprinthelp wantedsize: M

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions