Skip to content

Conversation

@wesm
Copy link
Collaborator

@wesm wesm commented Jan 26, 2026

Summary

Test isolation

  • Add setupTuiTestEnv helper to isolate ROBOREV_DATA_DIR to temp directory
  • Add testServerAddr constant to replace hardcoded localhost:7373
  • Fix daemon test to properly stop via os.Interrupt and fail on timeout
  • Remove os.Exit(0) from daemon shutdown (Go 1.25 compatibility)

Review findings addressed

  • Extract formatAgentLabel helper for agent+model formatting
  • Add Prompt view model display tests
  • Add storage test for model loading (TestGetReviewByJobIDIncludesModel)
  • Fix location line wrapping for accurate scroll indicators
  • Use runewidth.StringWidth for non-ASCII display width
  • Add upfront line count checks in tests

Version mismatch detection

  • Display persistent red banner when TUI and daemon versions differ
  • Prevents confusing behavior from stale binaries in post-commit hooks

Test plan

  • All tests pass
  • Daemon test cleans up properly (no zombies)
  • TUI tests isolated from production environment
  • Version mismatch detection tested

🤖 Generated with Claude Code

wesm and others added 4 commits January 26, 2026 11:59
- Track locationLineLen and compute wrapped line count for header height
  calculation, fixing scroll indicator accuracy with long paths/branches
- Add TestTUIRenderReviewViewAddressedWithoutVerdict for line ordering
- Update TestTUIVisibleLinesCalculationLongTitleWraps for new wrapping

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use runewidth.StringWidth instead of len() for titleLen and
  locationLineLen to correctly handle non-ASCII characters
- Add upfront line count check in TestTUIRenderReviewViewAddressedWithoutVerdict
  to fail fast instead of silently passing with too-short output

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add setupTuiTestEnv helper to set ROBOREV_DATA_DIR to temp directory,
  preventing TUI tests from reading production daemon.json
- Add testServerAddr constant to replace hardcoded localhost:7373
- Fix TestDaemonRunStartsAndShutdownsCleanly to properly stop daemon
  using SIGTERM via ListAllRuntimes() to find daemon PID
- Remove os.Exit(0) from daemon shutdown handler to allow proper test
  cleanup (Go 1.25 panics on os.Exit during tests)

This prevents test daemons from polluting production roborev environment
and ensures tests don't leave zombie daemon processes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@wesm wesm changed the title Address review findings: tests and location line wrapping Address review findings and fix test isolation Jan 26, 2026
wesm and others added 3 commits January 26, 2026 12:28
- Use os.Interrupt instead of syscall.SIGTERM for cross-platform support
- Guard against signaling non-self PIDs (daemon runs in test process)
- Remove force-kill fallback that could kill the test process
- Call setupTuiTestEnv(t) in TestTUIConfigReloadFlash and
  TestTUIReconnectOnConsecutiveErrors to isolate from production env

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove self-PID check to handle future refactors where daemon
  may run as separate process
- Change timeout from t.Log to t.Fatal to ensure test failures
  don't leak daemon goroutines into subsequent tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When the TUI connects to a daemon running a different version, display
a persistent red error banner: "VERSION MISMATCH: TUI X != Daemon Y -
restart TUI or daemon". This prevents confusing behavior when stale
binaries are used (e.g., from baked-in post-commit hook paths).

- Add versionMismatch field to tuiModel
- Check for mismatch when receiving daemon status
- Display error banner in queue and review views
- Add TestTUIVersionMismatchDetection with 4 test cases

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@wesm wesm changed the title Address review findings and fix test isolation Address review findings, fix test isolation, add version mismatch detection Jan 26, 2026
@wesm wesm changed the title Address review findings, fix test isolation, add version mismatch detection Test improvements: isolation, review findings, version mismatch warning Jan 26, 2026
wesm and others added 3 commits January 26, 2026 12:49
- Use a specific port (17373) instead of port 0 which doesn't work
  correctly with FindAvailablePort
- Wait for daemon to be HTTP-responsive before attempting shutdown
- Explicitly signal os.Getpid() with comment explaining why PID reuse
  is not a concern (daemon runs in same process as test)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Filter runtimes by PID == os.Getpid() to avoid matching stale
  runtime files from other processes
- Check and fail on proc.Signal error
- Clarify comment about FindAvailablePort auto-incrementing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Race detector adds significant overhead which can cause timeout
failures on slower CI machines. Increase timeouts from 5s to 10s
and add more context to failure messages for debugging.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@wesm wesm merged commit e7bb760 into main Jan 26, 2026
11 of 14 checks passed
@wesm wesm deleted the more-tests branch January 26, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants