fix: dev frontend readiness - #5828
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe CLI adds ChangesFrontend readiness startup
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant DevTask
participant FrontendDevServer
participant WailsCLI
participant NativeApplication
DevTask->>FrontendDevServer: Start frontend development server
DevTask->>WailsCLI: Run wails3 tool waitport
WailsCLI->>FrontendDevServer: Poll configured port
FrontendDevServer-->>WailsCLI: Accept connection
WailsCLI-->>DevTask: Complete readiness task
DevTask->>NativeApplication: Start native application
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@v3/go.mod`:
- Around line 5-6: Remove the local sibling replacement for
github.com/atterpac/refresh in go.mod and pin it to a compatible tracked module
revision instead. Ensure clean checkouts and CI can resolve the imported refresh
packages without requiring ../../refresh to exist.
In `@v3/internal/commands/tool_waitport.go`:
- Around line 46-60: Update the port-resolution logic in the wait-port command
to reject values outside 1..65535, including environment-derived ports, before
invoking waitForPort. Validate the command timeout is positive before
constructing the duration or polling, and return clear validation errors for
invalid values. Add command-level tests covering invalid flag and environment
ports, plus zero and negative timeouts.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e22fe157-59f9-4675-901a-5db12f03bd0f
📒 Files selected for processing (12)
v3/UNRELEASED_CHANGELOG.mdv3/cmd/wails3/main.gov3/go.modv3/internal/commands/build_assets/Taskfile.tmpl.ymlv3/internal/commands/build_assets/config.ymlv3/internal/commands/dev_config_test.gov3/internal/commands/tool_waitport.gov3/internal/commands/tool_waitport_test.gov3/internal/commands/watcher_test.gov3/pkg/application/application.gov3/pkg/application/application_dev.gov3/pkg/application/application_production.go
50ccf52 to
897dc5b
Compare
897dc5b to
aeaf5af
Compare
…gic and test coverage
aeaf5af to
1186937
Compare
Description
This PR prevents
wails3 devfrom terminating the native application when the frontend development server takes longer than expected to start.Previously, frontend readiness was checked inside
application.App.Runusing 10 HTTP attempts with 500 ms delays. This gave the frontend approximately five seconds to become available.Frontend startup can legitimately take longer when Vite needs to optimize or re-optimize dependencies. In that case, Wails terminated the native application with a fatal error even
though the frontend server was still starting normally:
This PR moves frontend readiness from the application runtime into the wails3 dev process orchestration:
This prevents valid but slow frontend startups from terminating the application and keeps development-process coordination out of the application runtime.
Migration for existing Wails v3 alpha projects
Existing projects must update their generated development configuration manually.
Add the following task to build/Taskfile.yml, next to the existing dev:frontend task:
Then update dev_mode.executes in build/config.yml by inserting the readiness step after the background frontend task and before the primary application task:
The important execution order is:
Projects using a custom wails3 dev -config file must update that configuration instead of build/config.yml.
Projects whose frontend server does not use WAILS_VITE_PORT may specify the host and port explicitly:
Newly generated projects include the updated configuration automatically.
Dependency
This PR temporarily depends on the
fix/background-startup-exitbranch of github.com/savely-krasovsky/refresh. That branch adds the background and one-shot process semantics required for startup orchestration.The current development replacement is:
replace github.com/atterpac/refresh => ../../refresh
Before this PR can be merged, the refresh changes must be published or merged and the local replacement must be changed to an upstream version or remote pseudo-version.
Fixes #?
Type of change
Please select the option that is relevant.
How Has This Been Tested?
Unit tests were added for:
Manual verification procedure:
wails3 devIf you checked Linux, please specify the distro and version.
Tested on Fedora Linux 44 using a Toolbx container.
Test Configuration
Checklist:
Summary by CodeRabbit
waitportdevelopment tool that blocks until a specified host/port becomes reachable, with a configurable timeout (default: 60s).wails3 devstartup so the native app launches only after the frontend dev server is accepting connections, including alpha-project flow.