fix(deps): auto-install missing dependencies on first run#72
Merged
Conversation
Add ensure-deps.js that detects missing playwright dependency and auto-installs it with lockfile-based coordination between processes. Call ensurePlaywright() in browser-launcher before requiring playwright. Move playwright from peerDependencies to dependencies in package.json so npm install resolves it automatically. Add missing_dependency error classification in web-ctl.js classifyError before the element_not_found branch to prevent 'Cannot find module' from being misclassified as an element not found error. Closes #66
- Replace grep-based source contract tests with behavioral subprocess tests - Fix canLaunchHeaded tests that assumed Linux-only behavior (Windows can launch headed browsers without X11/DISPLAY) - Remove unnecessary defensive comment about shell injection in ensure-deps
- Replace CPU-spinning busy-wait loop with Atomics.wait (yields CPU) - Fix acquireLock to return false when lock disappears (was unreachable) - Add PID validation for NaN/invalid values in lockfile - Add subprocess tests for npm install failure, chromium install failure, lockfile cleanup after failure, and stale lock detection
- README: replace manual playwright/chromium install with auto-install note - README: update Requirements section - CHANGELOG: add entry for auto-install feature - web-auth SKILL.md: update error handling to mention auto-install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
missing_dependencyerror classification with actionable install instructions as fallbackpeerDependenciestodependenciessonpm installactually installs itWEB_CTL_SKIP_AUTO_INSTALL=1env var to disable auto-install in CI/sandboxed environmentsImplementation
scripts/ensure-deps.js- dependency checker with lockfile coordination (Atomics.waitfor CPU-friendly sync sleep, PID-based stale lock detection)scripts/browser-launcher.js- callsensurePlaywright()beforerequire('playwright')inlaunchBrowser()andcanLaunchHeaded()scripts/web-ctl.js-missing_dependencyclassification added beforeelement_not_foundto prevent substring match collisionTest plan
tests/ensure-deps.test.js(happy path, caching, subprocess failure paths, stale lock detection)tests/web-ctl-actions.test.js(missing_dependency classification)Closes #66