fix: service detection in vip dev-env logs#2807
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
There was a problem hiding this comment.
Pull request overview
Fixes how vip dev-env logs validates the --service option by avoiding landoInfo() (and its full health check) and by correcting the Lando AppInfo.services typing that previously led to incorrect substring matching.
Changes:
- Update Lando core typings so
AppInfo.servicesis typed as astring(matching runtime output). - Export
getLandoApplication()for reuse outsidedev-environment-lando.ts. - Change
showLogs()service validation to use the LandoAppservice list derived from the initialized application (instead oflandoInfo()), and tweak debug formatting.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
types/lando/plugins/lando-core/lib/utils.d.ts |
Corrects AppInfo typing to match actual startTable() output and allows extra keys via Record<string, unknown>. |
src/lib/dev-environment/dev-environment-lando.ts |
Exposes getLandoApplication() so other modules can reuse the cached/initialized Lando app without triggering health checks. |
src/lib/dev-environment/dev-environment-core.ts |
Updates vip dev-env logs service validation to use the initialized Lando app’s service metadata and improves the error message. |
| const appInfo = await landoInfo( lando, instancePath ); | ||
| if ( ! appInfo.services.includes( options.service ) ) { | ||
| const application = await getLandoApplication( lando, instancePath ); | ||
| const services = application.info.map( service => service.service ); |
There was a problem hiding this comment.
Service names are being derived from application.info here. App also exposes application.services (string[]) which is the canonical service list and is already filtered in initLandoApplication (e.g., initOnly services removed). Using application.services avoids relying on info shape/completeness and keeps the validation consistent with the service list Lando itself tracks.
| const services = application.info.map( service => service.service ); | |
| const services = application.services; |
There was a problem hiding this comment.
No, this is wrong. application.services differs from application.info. The former lists only active services (e.g., excluding init-only containers), while the latter includes information about all services.
For example,
- Services from
application.info: ['nginx', 'php', 'database', 'memcached', 'wordpress', 'vip-mu-plugins', 'demo-app-code'] - Services from
application.services: ['nginx', 'php', 'database', 'memcached']
Init-only containers also produce logs, and if we use application.services, we won't be able to watch their logs without the low-level docker logs command



Description
This PR fixes service detection for the
vip dev-env logscommand.The previous implementation:
This implementation fixes that and is more stable for faulty dev environments.
Changelog Description
Fixed
vip dev-env logsimplementation. It is now faster and more stable.Pull request checklist
New release checklist
Steps to Test
vip dev-env logs -S inxbefore and after this PR.