Repository navigation
Fix the run_tui name collision that broke luminary map --tui (and CI mypy) - #41
Merged
Merged
Conversation
The store rename left `run_tui(core, saved: MappingStore, ...)` sharing a name with `saved = termios.tcgetattr(fd)` four lines below. The tty flags won, so the resume refresh called `save_state` on a list of terminal attributes: `luminary map --tui` raised AttributeError before the operator's first keystroke. mypy was the only thing that saw it, and CI had been red since. Parameter is now `records` (it is a MappingStore, from records.py); the flags are `tty_attrs`. The reason a rename could break the loop unnoticed is that every existing test monkeypatches `run_tui` away, so nothing had ever run its body. Added one that does, over a pty: it asserts the resume refresh reaches the records and that cbreak is undone on the way out. Two traps worth knowing if it ever needs editing -- `tty.setcbreak` flushes pending input (TCSAFLUSH), so a keystroke written before the loop starts is discarded, and in canonical mode an unterminated one is never readable at all. A small typist thread presses q until the loop takes it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbzmvdzTNSUxDUjVraRZMx
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.
What
luminary/mapping/store.py -> records.py(af9c574) also renamedrun_tui's parameter tosaved— which was already the local holdingtermios.tcgetattr(fd):So
luminary map --tuiraised before the operator's first keystroke, on the resume refresh. mypy caught it; CI has been red since.records(it is aMappingStore, fromrecords.py)tty_attrsWhy it got through
Every existing test monkeypatches
run_tuiaway, so nothing had ever executed its body — the loop was covered only byparse_keysunit tests either side of it.This adds one that runs the real loop over a pty and asserts both halves of the collision: the resume refresh reaches the records, and cbreak is undone on exit. Two traps if it ever needs editing, both documented inline —
tty.setcbreakflushes pending input (TCSAFLUSH), so a keystroke written before the loop starts is discarded; and in canonical mode an unterminated one is never readable at all. A small typist thread pressesquntil the loop takes it.Checks
Success: no issues found in 56 source files(was 2 errors)black --check: cleanNot covered: the fix is verified by test and by types, but I have not run
luminary map --tuiagainst the sphere.