Skip to content

fix(laravel): prevent migration discovery from hanging the server - #322

Open
sidux wants to merge 2 commits into
PHPantom-dev:mainfrom
sidux:fix/laravel-migration-discovery-traversal
Open

fix(laravel): prevent migration discovery from hanging the server#322
sidux wants to merge 2 commits into
PHPantom-dev:mainfrom
sidux:fix/laravel-migration-discovery-traversal

Conversation

@sidux

@sidux sidux commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Existing bug

Laravel migration discovery currently starts before PHPantom determines whether the workspace uses Laravel. It therefore runs in every Composer project, including Symfony applications.

The recursive discovery also walks ignored and generated directories and follows directory symlinks. In large workspaces this can keep initialization stuck at 100% CPU indefinitely, leave orphaned PHPantom processes after editor restarts, and block every LSP request until the editor times out. Go to Definition, completion, hover, diagnostics, and other features then appear completely broken.

Fix

  • classify the workspace from Composer before starting Laravel schema and migration features
  • register Laravel SQL/database watchers and run refresh handlers only for Laravel or Illuminate projects
  • make default migration discovery respect ignore rules and skip vendor, hidden, and symlinked directories
  • retain traversal hardening for real Laravel projects as defense in depth

Tests

  • cargo test non_laravel_projects_ignore_schema_watch_changes
  • cargo test default_migration_discovery_skips_ignored_and_symlinked_directories
  • cargo test discovers_direct_non_vendor_migrations_only
  • cargo clippy --fix --allow-dirty -- -D warnings
  • cargo fmt

sidux added 2 commits August 4, 2026 19:28
Default migration discovery recursively followed ignored and generated directories, including symlinked trees. This could keep server initialization busy indefinitely and block every LSP request.

Use the gitignore-aware walker without following symlinks, while preserving direct migration discovery.
Schema and migration discovery ran before Composer classified the workspace, so non-Laravel projects paid for Laravel-only startup scans and file watchers.

Start and refresh those features only after Laravel or Illuminate dependencies are detected.
@sidux sidux changed the title fix(laravel): skip schema discovery outside Laravel projects fix(laravel): prevent migration discovery from hanging the server Aug 4, 2026
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants