Fix issue #711: squad start --tunnel validates node-pty before side effects#715
Fix issue #711: squad start --tunnel validates node-pty before side effects#715andikrueger wants to merge 4 commits intobradygaster:devfrom
Conversation
…fore side effects Problem: 'squad start --tunnel' printed tunnel URL and created resources before checking if node-pty was available, leading to confusing failures. Solution: 1. Added node-pty (^1.1.0) and qrcode-terminal (^0.12.0) as optionalDependencies in packages/squad-cli/package.json 2. Moved node-pty import check to the START of runStart() function, before getGitInfo(), RemoteBridge instantiation, bridge.start(), or createTunnel() 3. Added regression test that verifies import order by parsing source This ensures missing node-pty is caught immediately without printing success messages or allocating resources. Test coverage: - test/cli/start.test.ts: Verifies node-pty import precedes side effects - test/cli-packaging-smoke.test.ts: Existing 'start' routability test Closes bradygaster#711 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…gaster#711) Update cli-packaging-smoke.test.ts to verify that the 'start' command shows a graceful error message when node-pty is missing, rather than excusing any MODULE_NOT_FOUND error. This ensures the fix in start.ts (checking node-pty before creating RemoteBridge or tunnel) works correctly in packaged installs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #711 by ensuring squad start --tunnel validates the presence of node-pty before starting the RemoteBridge/devtunnel flow, preventing tunnel/bridge side effects when the optional native dependency is missing.
Changes:
- Add an early dynamic import check for
node-ptyinrunStart()with a user-friendly error and immediate exit. - Tighten the packaging smoke test expectations so
startreports a gracefulnode-pty not availablemessage instead of a raw module-resolution crash. - Add a source-level regression test asserting the
node-ptycheck occurs before bridge/tunnel initialization.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| test/cli/start.test.ts | Adds a regression test that inspects start.ts source to ensure node-pty validation precedes bridge/tunnel construction. |
| test/cli-packaging-smoke.test.ts | Updates routing assertions to require a graceful node-pty error for the packaged start command. |
| packages/squad-cli/src/cli/commands/start.ts | Moves node-pty dynamic import to the start of runStart() (before RemoteBridge/tunnel side effects) and adds an explanatory error message. |
| packages/squad-cli/package.json | Declares node-pty and qrcode-terminal as optionalDependencies for the CLI package. |
…ion fix Closes bradygaster#711 (changelog gate requirement) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9fe19ae to
c12b3fe
Compare
- extract checkNodePty helper for start - sync workspace optional dependencies in lockfile - make packaging smoke tests detect ESM missing modules - add deterministic forced-missing node-pty coverage Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
c12b3fe to
8b9a5ea
Compare
|
🔄 Ralph PR status
Ready for review. Clean and focused — validates node-pty before tunnel side effects. |
🚀 Full Squad Review — Fix #711: squad start --tunnel validates node-ptyDomain: cli/tunnel
All 21 squad members reviewed and approved. |
🚀 Squad Team Review — PR #715Validates node-pty availability before creating RemoteBridge/tunnel, preventing terminal corruption. 6 files, +339/-73. |
|
📋 PR Lifecycle: Team review complete. Labeled \squad:pr-reviewed. Waiting for Dina's review. Add \squad:pr-dina-approved\ when ready to proceed. |
Validates node-pty availability before executing tunnel side effects, preventing crashes when the optional dependency is missing. Closes #715 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Validates node-pty availability before executing tunnel side effects, preventing crashes when the optional dependency is missing. Closes #715 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Validates node-pty availability before executing tunnel side effects, preventing crashes when the optional dependency is missing. Closes #715 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Validates node-pty availability before executing tunnel side effects, preventing crashes when the optional dependency is missing. Closes #715 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Closes #711
Summary
Validates that
node-ptyis available before attempting to tunnel, preventing unexpected terminal corruption when the package is missing.Changes
checkNodePty()helper insquad start --tunnelnode-ptymessagingnode-ptyscenarioIssue Status
This PR addresses #711. Issue #714 remains separate and will be handled in a different PR.
Testing
npm run build -w packages/squad-clinpx vitest run test/cli/start.test.ts --maxWorkers 1 --minWorkers 1 --reporter=dotnpx vitest run test/cli-packaging-smoke.test.ts --maxWorkers 1 --minWorkers 1 --reporter=dot