Skip to content

Conversation

@khaong
Copy link
Contributor

@khaong khaong commented Jan 19, 2026

Summary

  • Fix integration test TestResume_LocalLogNewerTimestamp that was hanging when run from a terminal with TTY
  • Add tests for interactive prompt behavior (user confirms/declines overwrite)
  • Refactor pty helpers into dedicated interactive.go file

Changes

  1. Fix hanging test: Use syscall.Setsid to detach subprocess from controlling terminal, preventing huh from opening /dev/tty
  2. Split test into focused cases:
    • TestResume_LocalLogNewerTimestamp_RequiresForce - verifies non-interactive mode fails safely
    • TestResume_LocalLogNewerTimestamp_ForceOverwrites - verifies --force bypasses prompt
  3. Add interactive prompt tests using github.com/creack/pty:
    • TestResume_LocalLogNewerTimestamp_UserConfirmsOverwrite - user types 'y'
    • TestResume_LocalLogNewerTimestamp_UserDeclinesOverwrite - user types 'n'
  4. Refactor pty helpers into interactive.go:
    • RunCommandInteractive - generic helper for any CLI command with pty
    • WaitForPromptAndRespond - waits for prompt text, sends response
    • Documents critical ACCESSIBLE=1 requirement (huh reads stdin instead of /dev/tty)

Test plan

  • mise run test passes
  • mise run test:integration passes
  • Interactive tests work correctly with both 'y' and 'n' responses

🤖 Generated with Claude Code

@khaong khaong requested a review from a team January 19, 2026 04:42
khaong and others added 2 commits January 19, 2026 15:43
- 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
@khaong khaong force-pushed the fix-resume-test-hanging branch from de5656b to 5c19457 Compare January 19, 2026 04:44
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
@khaong khaong force-pushed the fix-resume-test-hanging branch from 5c19457 to 3c98a80 Compare January 19, 2026 04:47
Copy link
Collaborator

@Soph Soph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@Soph Soph merged commit bdf7add into main Jan 19, 2026
3 checks passed
@Soph Soph deleted the fix-resume-test-hanging branch January 19, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants