4.9 KiB
4.9 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 02-launcher-configuration-consumption | Launcher configuration consumption | done | 2 |
|
plan.md | ../../specs/platform/startup-configuration-parity.md |
Task 02: Launcher configuration consumption
Make every Go launcher mode resolve its bootstrap settings from the shared configuration contract before it starts the backend.
Acceptance
dev,start,run, andserviceuse the same source resolver.- Launch flags override environment values. Environment values override YAML.
- The launcher honors YAML for
homeDir,server.host,server.port,database.path,logging.level,launcher.webPort,launcher.healthTimeoutMs, andlauncher.noBrowser. - Compatibility environment variables keep their current priority, including
KANDEV_BACKEND_PORToverKANDEV_PORT. - The launcher does not replace a YAML
database.pathwith its default path. - The child backend reads the exact file selected by the launcher even when its working directory differs.
- Internal path handoff remains private and does not appear in the public operator catalog.
- Launches without a configuration file keep current defaults.
- Invalid bootstrap configuration stops before child startup and reports the selected file.
Files likely touched
apps/backend/internal/launcher/constants.goapps/backend/internal/launcher/ports.goapps/backend/internal/launcher/health.goapps/backend/internal/launcher/env.goapps/backend/internal/launcher/start.goapps/backend/internal/launcher/dev.goapps/backend/internal/launcher/service.goapps/backend/internal/launcher/*_test.goapps/backend/internal/common/config/source.go
Dependencies
Task 01 defines the catalog, source resolver, and typed launcher section.
TDD sequence
- Add launcher tests for each precedence layer, YAML database path, home file discovery, selected-path handoff, no-browser, health timeout, and port compatibility. Run them RED.
- Add a bootstrap configuration projection and replace direct stable environment reads in the launcher.
- Preserve only required internal child wiring in the child environment.
- Run focused tests GREEN. Run the complete launcher suite and build the Go launcher binary.
Verification
cd apps/backend && go test ./internal/launcher -run '^Test.*(Config|Port|Health|Browser|DatabasePath|Home)' -count=1
cd apps/backend && go test ./internal/launcher -count=1
cd apps/backend && go build ./cmd/kandev
Risks
- Service installation and direct launch can have different working directories. Tests must cover the selected-path handoff.
- The internal backend port handoff is not operator configuration. Removing it would break child startup even after public port resolution is typed.
homeDircontrols data paths and configuration discovery. Bootstrap code must resolve it only once.
Output contract
Record RED and GREEN results, precedence evidence for every launcher field,
child handoff behavior, files changed, and remaining risks in ## Results.
Results
- RED:
go test ./internal/launcher -run "^Test(Launcher|DevBootstrap)" -count=1failed to compile before the bootstrap projection and private handoff existed. - GREEN:
go test ./internal/launcher -run '^Test.*(Config|Port|Health|Browser|DatabasePath|Home)' -count=1passed, covering YAML values, environment-over-YAML, flag-over-environment, dev web-port selection, health timeout, browser suppression, database path, invalid-file reporting, and selected-file handoff. - GREEN:
go test ./internal/launcher -count=1passed. - GREEN:
go build ./cmd/kandevpassed. - The launcher now loads the shared config before port, data-directory, and
child startup decisions. Start, run, dev, and service installation preserve
the selected file through private
KANDEV_INTERNAL_CONFIG_FILEwiring. - YAML database and logging values remain typed in the child process; the launcher does not copy those YAML values into public environment overrides.
- Service units preserve YAML home/logging values and emit the private file
handoff. Existing no-file defaults and
KANDEV_BACKEND_PORToverKANDEV_PORTbehavior remain covered by the complete launcher suite.
Review remediation:
- Service bootstrap discovery now resolves flag, explicit environment, and
service-mode default homes before selecting
config.yaml. Systemd and launchd tests cover flag-over-YAML and environment-over-YAML service metadata. - The generated service unit emits
KANDEV_HOME_DIRunless YAML is the actual winning source, so a stronger flag or environment value cannot be shadowed by the pinned file. - Dev backend and Vite readiness waits now use the same typed YAML health timeout. The regression captures both timeout arguments.
- GREEN:
go test ./internal/launcher -count=1passed with 230 tests;go build ./cmd/kandevpassed; changed-filegolangci-lintpassed.