Fix resume integration test hanging on interactive prompt#58
Merged
Conversation
- Add syscall.Setsid to RunResume to detach subprocess from controlling
terminal, preventing huh from opening /dev/tty for interactive prompts
- Split TestResume_LocalLogNewerTimestamp into two focused tests:
- TestResume_LocalLogNewerTimestamp_RequiresForce: verifies non-interactive
mode fails safely without overwriting local logs
- TestResume_LocalLogNewerTimestamp_ForceOverwrites: verifies --force
bypasses prompt and overwrites local logs
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Entire-Checkpoint: e58c50537669
- Add github.com/creack/pty dependency for pseudo-terminal support - Add RunResumeInteractive helper that runs commands with a pty - Add waitForPromptAndRespond helper to detect prompts and send responses - Add tests for user confirming and declining overwrite prompts - Use ACCESSIBLE=1 mode so huh reads from stdin (pty) instead of /dev/tty New tests: - TestResume_LocalLogNewerTimestamp_UserConfirmsOverwrite - TestResume_LocalLogNewerTimestamp_UserDeclinesOverwrite Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Entire-Checkpoint: ceaea776cdb0
de5656b to
5c19457
Compare
Extract generic RunCommandInteractive and WaitForPromptAndRespond helpers into interactive.go, simplifying resume_test.go. Documents the critical ACCESSIBLE=1 requirement for huh library to read from pty stdin. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Entire-Checkpoint: ceaea776cdb0
5c19457 to
3c98a80
Compare
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
TestResume_LocalLogNewerTimestampthat was hanging when run from a terminal with TTYinteractive.gofileChanges
syscall.Setsidto detach subprocess from controlling terminal, preventing huh from opening/dev/ttyTestResume_LocalLogNewerTimestamp_RequiresForce- verifies non-interactive mode fails safelyTestResume_LocalLogNewerTimestamp_ForceOverwrites- verifies--forcebypasses promptgithub.com/creack/pty:TestResume_LocalLogNewerTimestamp_UserConfirmsOverwrite- user types 'y'TestResume_LocalLogNewerTimestamp_UserDeclinesOverwrite- user types 'n'interactive.go:RunCommandInteractive- generic helper for any CLI command with ptyWaitForPromptAndRespond- waits for prompt text, sends responseACCESSIBLE=1requirement (huh reads stdin instead of/dev/tty)Test plan
mise run testpassesmise run test:integrationpasses🤖 Generated with Claude Code