Fix: Replace polling with async runtime events#51
Merged
Conversation
- Replace MainActor polling with a serialized async event channel. - Deliver terminal input and POSIX signals through Dispatch sources. - Cover task resumption and macOS/Linux event delivery.
- Derive focus and cursor phases from an injectable ContinuousClock. - Keep one deadline task only while visible focus animation is active. - Verify idle runtimes stay asleep and phase timing is deterministic.
- Route terminal I/O through injectable POSIX calls. - Allow isolated descriptors in integration tests. - Preserve current terminal behavior.
- Retry interrupted reads and interrupted or partial writes. - Preserve the first permanent POSIX failure for runtime handling. - Cover retry, partial-write, and hard-error behavior.
- Throw terminal I/O failures from the asynchronous app entry point. - Restore terminal state before propagating runtime failures. - Verify error propagation and cleanup through AppRunner.
- Confirm shutdown cancels active view tasks. - Assert raw mode, cursor state, and alternate screen are restored.
- Replace polling and signal-flag descriptions with runtime events. - Document idle suspension, deadline scheduling, and deterministic cleanup. - Clarify terminal retries and animation phase behavior.
- Keep the public App.main symbol compatible with SwiftUI. - Run the asynchronous application runtime through dispatchMain. - Report runtime failures before returning a nonzero exit status.
This was referenced Jul 20, 2026
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.
Summary
Closes #9
Checklist
swift buildsucceeds on both)swift test)swiftlint)Test Plan
.taskprogress, idle suspension, real signal/input delivery, injected animation deadlines, interrupted and partial terminal I/O, permanent I/O errors, and shutdown cleanup.