[Codex] Decouple default builds from robotgo dependencies#50
Conversation
3b4e6c1 to
d8eaade
Compare
💡 Codex Reviewacousticalc/tests/visual/visual_utils.go Lines 110 to 137 in 3b4e6c1 [P0] Restore error propagation for unwritable screenshot directories The new fallback engine causes acousticalc/tests/visual/visual_utils.go Lines 301 to 309 in 3b4e6c1 [P0] Visual report generation ignores read‑only directories
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the visual screenshot testing infrastructure to decouple default builds from robotgo dependencies. The changes introduce an abstract screenshot engine with build-tagged implementations that allow visual tests to compile conditionally while maintaining backward compatibility.
Key changes:
- Abstracted screenshot engine interface with mock fallback implementation
- Split robotgo implementation into build-tagged files (stub and full versions)
- Migrated legacy integration tests to new E2E testing framework with recording capabilities
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/visual/visual_utils.go | Refactored to use abstract ScreenshotEngine interface, removed direct robotgo dependency |
| tests/visual/robotgo_engine_stub.go | Added stub implementation for builds without visualtests tag |
| tests/visual/robotgo_engine.go | Added full robotgo implementation for builds with visualtests tag |
| tests/scripts/Makefile | Improved cross-platform CPU core detection with macOS fallback |
| tests/reporting/reporter.go | New reporter infrastructure for aggregating test results |
| tests/recording/recorder.go | New session recorder for creating asciinema-compatible recordings |
| tests/e2e/harness.go | New E2E test harness with CLI runner and timeout support |
| tests/e2e/acousticalc_workflows_test.go | Comprehensive E2E workflow tests replacing legacy integration tests |
| tests/cross_platform/platform.go | Cross-platform utilities for consistent platform handling |
| pkg/calculator/calculator_visual_test.go | Added visualtests build tag |
| cmd/acousticalc/main_integration_test.go | Removed legacy integration tests |
| README.md | Updated testing documentation to reflect new test structure |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if bitmap == nil { | ||
| return nil, fmt.Errorf("failed to capture screen with robotgo") | ||
| } | ||
| defer robotgo.FreeBitmap(bitmap) |
There was a problem hiding this comment.
The defer statement to free the bitmap should be placed immediately after the nil check for bitmap to ensure proper cleanup even if subsequent operations fail.
| if sc.capturer == nil { | ||
| factory := &ScreenshotEngineFactory{} | ||
| sc.capturer = factory.CreateEngine() | ||
| } |
There was a problem hiding this comment.
The lazy initialization of sc.capturer is not thread-safe. If multiple goroutines call CaptureScreen simultaneously, they could create multiple capturer instances. Consider using sync.Once or adding a mutex to protect this initialization.
|
|
||
| if stderr != "" { | ||
| events = append(events, Event{ | ||
| Time: duration.Seconds(), |
There was a problem hiding this comment.
The stderr event uses the same timestamp as the exit event (duration.Seconds()). Consider using a slightly earlier timestamp like duration.Seconds() * 0.9 to ensure stderr appears before the exit message in the recording timeline.
| Time: duration.Seconds(), | |
| Time: duration.Seconds() * 0.9, |
Summary
visualteststagTesting
https://chatgpt.com/codex/tasks/task_e_68d5dd43578c832fbb7cd79a2942ad4c