Skip to content

feat(terminal): bound capture and coordinate native input ownership - #186

Merged
zackees merged 6 commits into
mainfrom
feat/terminal-input
Sep 13, 2026
Merged

zackees merged 6 commits into
mainfrom
feat/terminal-input

Conversation

@zackees

@zackees zackees commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Refs #178 (not closed). Coordinated with FastLED/cli#242 and FastLED/cli#229. Depends on #185 and its prerequisite stack; kernel changes must land and be published before downstream release adoption.

Adds kernel-instance exclusive admission across native capture and graphics probes, a 256-event / 64-KiB Windows queue, a 1024-repeat allocation limit, ignored key releases, and explicit overflow/native errors through fallible waits. Translation and optional trace I/O remain outside the queue mutex. Windows queue mutation becomes private. Includes Unix PTY and isolated Windows child-console ownership/restoration tests and docs/terminal-input.md.

Validation: ownership/queue tests RED before implementation then Linux GREEN; full Linux pty-feature suite PASS (172 library tests plus integrations); strict all-target Clippy for Linux and Windows PASS; Windows test cross-compilation PASS; default-feature check PASS. Repeat-helper tests were compile-RED before implementation; actual native Windows execution remains pending CI. Single-reviewer Rust/docs review clean after fixing trace I/O under the queue mutex.

Still required: native Windows execution; bounded decoded-key and styling facade; FastLED Space/Enter policy adoption and direct Crossterm removal; release and exact published dependency adoption. Raw chunks are not decoded keys and must not be scanned for rebuild triggers. Drop restoration is best-effort, optional trace I/O may delay shutdown. No build-speed or Safari claim.

@zackees

zackees commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

Update 22c0a1f adds the pty-gated keys API: incremental KeyDecoder and owned TerminalKeys, facade-owned events, bounded waits/work/storage, preserved queued bytes, incomplete-sequence handling and poison-on-error behavior. Generic tests stay upstream; real Unix PTY validation verifies zero-wait decoding and mode restoration.

Validation: initial unresolved-import RED before implementation; six decoder regressions plus real PTY test GREEN; full Linux pty suite, strict all-target Clippy, default-feature check and Windows test cross-compilation PASS. The same reviewer checked Rust/docs and is clean after documenting ambiguous Alt encodings (notably Alt+Space). This small conservative parser is not full Crossterm modifier equivalence; raw capture requires explicit application control-C handling.

Decoded-key implementation is now present, but native Windows execution, styling, application adoption/Crossterm removal and published-release consumption remain required. No build-speed or Safari claim.

@zackees

zackees commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

Update 3c234fa adds independent terminal-style=[] with no new dependency: borrowed foreground formatting, explicit caller enablement, native stderr ANSI preparation and an isolated Windows console preparation test. FastLED retains color/message/NO_COLOR/TERM policy. Yellow ANSI output matches the existing color-11 foreground plus foreground reset. Plain output is preserved and writer failures propagate.

RED absent feature before implementation; formatter tests GREEN; combined Linux pty+terminal-style suite, strict Linux and Windows-target Clippy, Windows test cross-compilation and default-feature check PASS. Rust/CI/docs review clean. Native execution pending.

Before downstream adoption, the key reader still needs a signal/output-preserving input mode for the FastLED watch loop: holding full raw mode would suppress Ctrl+C signals and alter newline output processing. Existing raw PTY capture must remain unchanged. App Crossterm removal and published exact release adoption remain pending.

@zackees

zackees commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

Update bf79313 makes TerminalKeys noncanonical/no-echo while preserving native signal-key handling and Unix input/output processing. Existing raw PTY forwarding remains unchanged. A native Unix PTY RED demonstrated ISIG was cleared; GREEN now checks preserved flags, queued decoding and restoration. Review also identified a signal/readiness race, fixed with key-mode-only VMIN=0/VTIME=0 and an empty direct-read regression (bounded child fixture). The same reviewer is clean.

Combined Linux terminal tests and strict Clippy PASS; default feature check PASS; Windows all-test check and strict Clippy PASS; macOS ARM test cross-compilation PASS. Latest native execution remains CI-owned, not claimed from cross-compilation. FastLED adoption must register graceful Ctrl+C handling before opening capture so the owner is dropped/restored on shutdown.

Merged the updated text-similarity base into this branch, bringing in the already-reviewed/native-Windows-validated browser proof fix. Upstream #181 and #183 are now merged; #185 is being retargeted to main.

@zackees

zackees commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

Checkpoint b9d75b0: terminal-input is now independent of PTY spawning; pty includes terminal-input for compatibility. FastLED adoption uses terminal-input plus terminal-style, removing Crossterm and five supporting lockfile entries without adding packages. RED: requesting the absent feature failed. GREEN: dependency graph proves portable-pty absent for terminal-input and present for pty; lightweight Linux full suite (168 library tests plus integration tests), existing PTY library suite (172 tests), Linux/Windows all-target strict Clippy, macOS ARM test cross-check, default-feature check, formatting and Python lint pass. The existing one-agent cross-repository review is clean. Native Windows runtime CI for this head remains pending; exact publication and consumption remain required. Coordinated with FastLED/cli#242.

@zackees
zackees changed the base branch from feat/text-similarity to main September 13, 2026 10:07
@zackees
zackees marked this pull request as ready for review September 13, 2026 10:28
@zackees
zackees merged commit 8d36078 into main Sep 13, 2026
49 checks passed
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