Repository navigation
Fix NameError crash on arrow keys in interactive review - #14
Merged
Merged
Conversation
The interactive menu called _read_escape_sequence() but the helper was never defined, so pressing an arrow key crashed with NameError right after the analysis completed. Define the reader: it drains the bytes following Escape via select() with a short timeout, so arrow keys move the cursor and a lone Escape returns an empty sequence without blocking. Adds pty-backed regression coverage for both arrow branches and the lone-Escape path.
Diffly verdict: QUARANTINE#14 · 3 files · 81 lines changed · checks: PENDING Risk flags: Risk flags and reasoning
Blast-radius summary
Deterministic triage is authoritative; any optional LLM explanation cannot change the verdict. |
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.
Why
Running the interactive review on any PR crashes the moment an arrow key is pressed:
The redesigned interactive menu (v1.0.0) calls
_read_escape_sequence()to read the bytes following an Escape keypress, but the helper was never defined — so↑/↓navigation, one of the two primary controls shown in the menu footer, is guaranteed to crash after the user has already waited for the full analysis. Reproduced on macOS (Python 3.14) reviewing #12.What users will see / Surface area
src/diffly_cli/cli.py: defines_read_escape_sequence(). It usesselect.select()with a short timeout to drain the CSI bytes that follow Escape ([Afor ↑,[Bfor ↓), so:Validation
tests/test_regressions.py:test_interactive_menu_handles_arrow_keys_without_crashingdrives the realinteractive_viewloop over a pty with↑ ↓ Enterkeypresses — this exact test fails withNameErroronmain.test_escape_sequence_reader_returns_arrow_codesasserts[Ais returned when those bytes follow Escape.test_escape_sequence_reader_treats_a_lone_escape_as_emptyasserts a quiet input yields""without hanging.pytest -q→ 56 passed.main(0e9cf1d).