Skip to content

fix(tui): confirm before resetting the current exercise - #179

Open
maoji-y wants to merge 1 commit into
abhiksark:devfrom
maoji-y:fix/47-confirm-tui-reset
Open

maoji-y wants to merge 1 commit into
abhiksark:devfrom
maoji-y:fix/47-confirm-tui-reset

Conversation

@maoji-y

@maoji-y maoji-y commented Dec 4, 2026

Copy link
Copy Markdown

Summary

F2 now shows a confirmation for the current exercise. y restores the snapshot and refreshes the editor. n and Escape return focus to the editor and keep the learner's edits. Pending saves, check results, and the auto-advance countdown wait for the prompt to close.

If the snapshot is missing, unreadable, or invalid UTF-8, the TUI shows a recovery message and keeps the original learner file. A staged replacement also protects the file if the final write fails.

Closes #47.

OpenAI Codex assisted with the patch, tests, and pull request description.

Tests

  • python -m pytest -q --tb=short --basetemp <scratch-dir> passed all 281 tests on Linux with Python 3.13.
  • python -m pytest tests/tui tests/unit/test_reset.py -q --tb=short --basetemp <scratch-dir> passed 70 tests on Windows with Python 3.13.
  • python -m pytest tests/tui/test_app_pilot.py tests/unit/test_reset.py -k reset -q --tb=short --basetemp <scratch-dir> passed 17 tests on Windows with Python 3.9 and Textual 8.0.0.
  • ruff check ., ruff format --check ., and git diff --check passed.
  • pythonlings --root tests/fixtures/passing_curriculum verify passed both fixture exercises.
  • mkdocs build --strict --site-dir <scratch-dir> passed.
  • Exercised pythonlings watch in a terminal with a fixture workspace. Verified confirmation, both cancellation keys, and the visible missing-snapshot error.

Screenshots

F2 confirmation over an edited exercise Missing snapshot error with the exercise editor still open

Checklist

  • Updated docs when behavior changed
  • Added or updated tests
  • Verified python -m pytest -q

@coderabbitai

coderabbitai Bot commented Dec 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ce4fed69-ba9c-43f8-92aa-2500b543ebc4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

This branch has not been deployed

No deployments
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.

1 participant