2.6 KiB
2.6 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 03-web-child | Vite dev-server child and URL readiness | done | 1 |
|
plan.md | ../../specs/platform/requirements/go-dev-launcher.md |
Task 03: Vite dev-server child and URL readiness
Port apps/cli/src/web.ts's launch path plus the token-less readiness probe.
Acceptance
webCommand()returnspnpmwith args-C apps --filter @kandev/web devon Unix andcmd.exe /c pnpm ...on Windows, and the Windows branch is exercised by a test that does not require running on Windows.buildWebEnv(ports, debug)setsKANDEV_API_BASE_URLto the backend URL,PORTto the chosen web port,HOSTNAME=127.0.0.1, and (when debug)KANDEV_DEBUG=trueplusVITE_KANDEV_DEBUG=true; it removes any inheritedVITE_KANDEV_API_PORTfrom the child environment.waitForURLReady(ctx, url, proc, timeout)succeeds on any HTTP response, fails fast with the child's exit code if the child dies first, and times out with a message naming the URL and timeout. It does not consult the launcher health token.
Verification
Use TDD. Add apps/backend/internal/launcher/webchild_test.go; drive the readiness probe
against an httptest.Server and a fake childState, and prefer testing/synctest over
time.Sleep for the timeout case (see apps/backend/CLAUDE.md, "Testing"). Then:
cd apps/backend && go test ./internal/launcher/ -run 'TestWebCommand|TestBuildWebEnv|TestWaitForURLReady' -race
Files
apps/backend/internal/launcher/webchild.go(new)apps/backend/internal/launcher/webchild_test.go(new)
Inputs
apps/cli/src/web.ts:1-24—WIN_SHIM_COMMANDS/resolveWindowsShimand the comment explaining whycmd.exe /cis the right call on Windows (no PATHEXT forspawn, EINVAL on direct.cmdspawn since Node 21, DEP0190 withshell:true). The Node specifics no longer apply, but the.cmd-shim resolution problem does.apps/cli/src/shared.ts:136-165—buildWebEnv, including whyVITE_KANDEV_API_PORTis explicitly deleted.apps/cli/src/health.ts—waitForUrlReadysemantics.apps/backend/internal/launcher/health.go— reusechildState,healthPollInterval, and the boundedhealthProbeClientpattern rather than introducing new ones.
Risks
- Reuse
startProcessfromprocess.gofor spawning so the Vite child joins the same supervisor and process group; do not callexec.Commanddirectly. - Do not relax
waitForHealth's token check to share code with this probe. PR #2394 made a token mismatch a hard failure on purpose.