test(pty): synchronize inputs on committed screen state - #1083
Merged
Conversation
Observe an explicit destination after sending a key instead of treating output idleness as acknowledgement. Cover delayed paint and timeout without input retries in the shared harness.
Distinguish history chrome from commit titles shared with review, observe Escape clearing visual selection, and wait for filter focus and saved-note cards before subsequent input. Preserve intentionally coalesced input and existing timeout budgets.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR makes PTY integration tests synchronize subsequent input with destination-specific committed screen state instead of relying on output idleness or text shared between screens.
Confidence Score: 5/5The PR appears safe to merge; the test-only synchronization changes use state markers that distinguish the relevant destination screens. No actionable failure remains: keys are sent once, polling waits for committed destination-specific snapshots, and each updated predicate is valid for its fixture and transition. Important Files Changed
Sequence DiagramsequenceDiagram
participant Test
participant Session
participant TUI
Test->>Session: press(key)
Session->>TUI: send key once
loop Until timeout
Test->>Session: text(immediate)
Session-->>Test: current screen snapshot
alt Destination predicate matches
Test-->>Test: continue with next input
else Destination not committed
Test->>Session: waitIdle
end
end
Reviews (1): Last reviewed commit: "test(pty): wait for committed history, f..." | Re-trigger Greptile |
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.
Test-only. Fixes the PTY integration flakes that have been failing unrelated PRs on
ubuntu-latest(e.g. #1078 ×3, #1079's neighbours, severalmainruns).Cause
tuistory's
press()resolves after output-idle, which can be 20 ms and does not prove OpenTUI parsed the key or React committed the resulting state. Several tests then waited on text that is present on both the outgoing and the destination screen (a commit title in the review header and in history; a note body in the draft and the saved note), so the wait returned early and the next key went to the wrong surface. Thefilter focustest typed immediately after Tab, before the filter input mounted, so thetinbetafired the theme shortcut.Fix
harness.pressAndWaitForSnapshot(session, key, predicate)— send one key and wait for a destination-specific screen state. Never resends on timeout; a dropped key stays a failure. Unit-tested (harness.test.ts).log-integration.test.ts: return-to-history waits onGit history+Enter openchrome instead of the commit title; visual-selection cancel waits for the selection indicator to disappear.chrome.test.ts: wait for the filter input before typing (as the/sibling already did).notes.test.ts: saved-note navigation waits on saved-state markers rather than shared body text.No timeout, retry, sharding, or application changes. Coalesced-input cases (
"1q","\rq", text+save in one write) are preserved.Pass rates under contention (Bun 1.4.2; Linux pinned to 2 CPUs + hog; macOS 18 hogs)
Full
bun run test:integration×3 per platform under contention: all fixed tests pass every run.Not fixed here (pre-existing, reproduce on
main)highlighting › keeps key input responsive while a large added file highlights: 0/20 on 2 pinned Linux CPUs even without a hog (PageDown lands in 1.4–1.6 s vs. a 1 s budget). Left untouched — the assertion's contract needs a decision, not a bigger number.main.watch-startchild-exit cleanup andmulti-row copy drag: occasional, reproduce onmain.Checks
bun run typecheck,bun run deps:check,bun test test/pty/harness.test.ts, oxfmt/oxlint on changed files — pass on macOS and Linux. Empty changeset (maintenance). Not run on Windows (PTY group is Unix-only).