Skip to content

feat(build-cli): adopt effection for structured concurrency#26409

Draft
tylerbutler wants to merge 4 commits intomicrosoft:mainfrom
tylerbutler:bt-effection-cli
Draft

feat(build-cli): adopt effection for structured concurrency#26409
tylerbutler wants to merge 4 commits intomicrosoft:mainfrom
tylerbutler:bt-effection-cli

Conversation

@tylerbutler
Copy link
Member

Summary

  • Replace async.mapLimit with effection's spawn-based worker pool in BasePackageCommand.processPackages, preserving bounded concurrency, error accumulation, and spinner UI
  • Wrap StateMachineCommand's infinite state loop in effection run() with SIGINT/SIGTERM handlers for graceful shutdown (exit code 130 on interrupt)
  • Add effection@^4.0.0 dependency; remove async and @types/async
  • New src/concurrency.ts: reusable processWithConcurrency<T> operation with progress callbacks
  • New src/subprocess.ts: useExecaCommand/useExeca helpers with ensure() cleanup for automatic subprocess termination on scope exit

No changes required to any PackageCommand subclasses or StateMachineCommand test mode paths.

Test plan

  • TypeScript compilation passes (tsc --noEmit)
  • All 397 mocha tests pass (1 pre-existing flaky test unrelated to changes)
  • Manual: flub exec --all "echo hello" — verify concurrent execution with spinner
  • Manual: start a long-running flub release command, Ctrl+C — verify graceful shutdown

Replace async.mapLimit with effection's spawn-based worker pool in
BasePackageCommand.processPackages, preserving bounded concurrency,
error accumulation, and spinner UI. Wrap StateMachineCommand's
infinite loop in effection run() with SIGINT/SIGTERM handlers for
graceful shutdown.

- Add effection@^4.0.0 dependency, remove async and @types/async
- New src/concurrency.ts: processWithConcurrency<T> operation
- New src/subprocess.ts: useExecaCommand/useExeca with ensure() cleanup
- BasePackageCommand: no subclass changes required
- StateMachineCommand: test mode path unchanged, non-test path gains
  signal handling with exit code 130 on interrupt
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.

1 participant