Skip to content

fix: service detection in vip dev-env logs#2807

Merged
sjinks merged 2 commits into
trunkfrom
vip-3103-vip-dev-env-logs-service-check-is-incorrect
May 8, 2026
Merged

fix: service detection in vip dev-env logs#2807
sjinks merged 2 commits into
trunkfrom
vip-3103-vip-dev-env-logs-service-check-is-incorrect

Conversation

@sjinks
Copy link
Copy Markdown
Member

@sjinks sjinks commented May 1, 2026

Description

This PR fixes service detection for the vip dev-env logs command.

The previous implementation:

  • did that incorrectly because it assumed the wrong data type;
  • unnecessarily run the full environment health check to get the list of available services.

This implementation fixes that and is more stable for faulty dev environments.

Changelog Description

Fixed

  • vip dev-env logs implementation. It is now faster and more stable.

Pull request checklist

New release checklist

Steps to Test

vip dev-env logs -S inx before and after this PR.

@sjinks sjinks self-assigned this May 1, 2026
Copilot AI review requested due to automatic review settings May 1, 2026 16:10
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.services is typed as a string (matching runtime output).
  • Export getLandoApplication() for reuse outside dev-environment-lando.ts.
  • Change showLogs() service validation to use the Lando App service list derived from the initialized application (instead of landoInfo()), 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.

Comment thread src/lib/dev-environment/dev-environment-core.ts
Comment thread src/lib/dev-environment/dev-environment-core.ts
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 );
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
const services = application.info.map( service => service.service );
const services = application.services;

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@sjinks sjinks requested a review from a team May 1, 2026 16:57
@sjinks sjinks merged commit 1a67832 into trunk May 8, 2026
19 checks passed
@sjinks sjinks deleted the vip-3103-vip-dev-env-logs-service-check-is-incorrect branch May 8, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants