Conversation
|
| test("lets the paused stdin reader release before spawning a terminal editor", async () => { | ||
| const filePath = join(createTempDir(), "example.ts"); | ||
| writeFileSync(filePath, "before"); | ||
| process.env.EDITOR = "nvim --clean"; |
There was a problem hiding this comment.
Tests bypass required environment setup
The three new handoff tests write process.env.EDITOR directly. The repository guide says “Never access process.env directly” and requires Varlock instead. Use the approved environment setup for these tests. This repository requirement must be satisfied before merging.
Context Used: guidelines.mdc Cursor rule (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/hunk/src/ui/lib/openInEditor.test.ts
Line: 252
Comment:
**Tests bypass required environment setup**
The three new handoff tests write `process.env.EDITOR` directly. The repository guide says “Never access `process.env` directly” and requires Varlock instead. Use the approved environment setup for these tests. This repository requirement must be satisfied before merging.
**Context Used:** guidelines.mdc Cursor rule ([source](https://github.com/modem-dev/modem/blob/main/.cursor/rules/guidelines.mdc))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
This rule is from a different repository: the linked source is modem-dev/modem, not modem-dev/hunk. Hunk does not use Varlock or prohibit process.env; these tests follow the existing editor tests and restore EDITOR in afterEach. No change needed here. Please scope that guideline to its source repository.
This comment was generated by Pi using GPT-6.1 Sol
There was a problem hiding this comment.
You’re right. The Varlock/process.env requirement comes from modem-dev/modem and does not apply to modem-dev/hunk; these tests match Hunk’s existing editor-test setup and restore EDITOR afterward.
No code change is needed for this PR, and this finding should be disregarded. The file-backed guideline should be scoped in its source repository/configuration.
| process.stdin.setRawMode(true); | ||
| process.stdin.on("data", (data) => { | ||
| // Ignore pending capability replies from the test terminal, not editor keystrokes. | ||
| if (data[0] === 0x1b) return; |
There was a problem hiding this comment.
The fake editor drops the whole input chunk whenever its first byte is Escape. If a pending terminal reply and the following j arrive in the same chunk, this also drops the key the test is meant to check. The test can then time out even when Hunk delivers the first key correctly. Remove only complete terminal replies and keep any remaining bytes.
Prompt To Fix With AI
This is a comment left during a code review.
Path: test/pty/editor-input-integration.test.ts
Line: 31
Comment:
**Fake editor drops valid keys**
The fake editor drops the whole input chunk whenever its first byte is Escape. If a pending terminal reply and the following `j` arrive in the same chunk, this also drops the key the test is meant to check. The test can then time out even when Hunk delivers the first key correctly. Remove only complete terminal replies and keep any remaining bytes.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed: the fake editor now strips complete VT control sequences instead of dropping an entire Escape-prefixed chunk. Added a PTY case sending a device-attributes reply and j together; it verifies the editor receives j without Enter and Hunk regains keyboard control. All three focused PTY tests, typecheck, and lint passed.
This comment was generated by Pi using GPT-6.1-sol
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Problem
#1142 reports that Neovim opened with
eon Windows renders normally but ignores keyboard input until Enter is pressed.Hunk currently suspends its renderer and immediately calls
Bun.spawnSyncwith inherited stdin. OpenTUI's suspend callsprocess.stdin.pause(), but Bun 1.4.2 disowns its stdin reader in a nextTick callback. Blocking inspawnSyncbefore that callback runs leaves the parent's input reader active during the editor handoff. This is a concrete ordering bug and a likely explanation for the reported Windows behavior; the Windows symptom has not been reproduced on this Linux host.Approach
This belongs in the existing terminal/editor lifecycle helper, not an extension or the shared semantic review model. No rendering or protocol changes.
Tests and validation
Linux x86_64; Bun 1.4.2; Neovim 0.12.5; tmux 3.7c.
jwithout Enter and returns keyboard control to Hunk. An optional real-Neovim test checks the cursor moves from line 1 to line 2 before any Enter is sent.node_modules/bun/bin/bun.exe run test: 4,789 passed, 13 skipped, 0 failed.node_modules/bun/bin/bun.exe run test:integration: 223 passed, 1 skipped, 0 failed; the additional real-Neovim test was added afterward and passed in the focused run.node_modules/bun/bin/bun.exe run test:tty-smoke: 10 passed.bun run typecheck,bun run lint,bun run format:check,bun run deps:check, andgit diff --check: passed.bun run install:bin, followed byHUNK_TEST_EXECUTABLE=dist/hunk node_modules/bun/bin/bun.exe test test/pty/editor-input-integration.test.ts: both PTY tests passed against the compiled Bun 1.4.2 binary.jmoving immediately and Hunk's help shortcut responding after each return.Limitations
Windows confirmation is still needed, particularly the original Windows Terminal / PowerShell / Neovim 0.11.4 setup. Linux PTY/tmux success does not establish that the Windows symptom is fixed. macOS was not tested locally. The PTY tests follow the repository's Unix-only test infrastructure; the ordering unit test is portable.
Addresses #1142; leaving the issue open pending Windows confirmation.
This PR description was generated by Pi using GPT-6.1-sol