Concurrent workspace builder (opt-in)#1067
Open
tony wants to merge 3 commits into
Open
Conversation
why: The per-window pane-construction body was inlined in ClassicWorkspaceBuilder.build(), leaving no override point for a builder that wants a different pane-creation strategy without duplicating the window iteration, plugin hooks, focus handling, and build events. what: - Move the per-window pane loop into an overridable _build_window() that returns the window's focus pane - Have build() call _build_window() and keep on_window_create, config_after_window, after_window_finished, focus, and window_done unchanged around it - Add a doctest for the new seam
why: Loading a workspace waited on each pane's shell prompt one at a time, so a window with several panes paid the prompt-startup cost serially even though tmux warms every pane's shell concurrently. what: - Add ConcurrentWorkspaceBuilder, an opt-in builder that creates a window's panes up front, waits for their prompts in one shared barrier, lays out once, then dispatches each pane's commands - Port _pane_has_drawn_prompt and _wait_for_panes_ready (one shared-timeout polling loop, 10ms interval) from the source change - Port _split_pane_reclaiming_space (reclaim layout space only on a no-space split failure) and the sequential fallback for panes whose start_directory depends on an earlier pane's command - Respect workspace_builder_options.pane_readiness via the classic _pane_readiness_wait resolution; skip the barrier under never - Register the `concurrent` entry point and export the class - Register the module's doctests with the tmux-fixture set in conftest - Add functional tests: multi-window/pane build, command dispatch, single-pass layout, readiness policy, space reclaim, sequential start_directory fallback
why: The new opt-in builder needs user-facing guidance and an API reference page, and the change should be discoverable in the changelog. what: - Add a Concurrent builder section to the custom-workspace-builders guide and list it under Choosing an approach and Reference - Add the concurrent autodoc page and link it from the builder index grid and toctree - Add a What's new CHANGES entry under 1.74.0
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1067 +/- ##
==========================================
- Coverage 82.56% 82.50% -0.06%
==========================================
Files 31 32 +1
Lines 2770 2933 +163
Branches 518 550 +32
==========================================
+ Hits 2287 2420 +133
- Misses 346 364 +18
- Partials 137 149 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
ConcurrentWorkspaceBuilder, an opt-in builder (workspace_builder: concurrent) that observes a window's pane readiness through one concurrent barrier instead of waiting pane-by-pane — addressing the serial per-pane wait that made loads scale with pane count (Very slow performance opening layouts/workspaces #1053).ClassicWorkspaceBuilder._build_windowseam so the variant overrides only per-window construction; classic builder behavior is unchanged (the full classic suite passes).workspace_builder_options.pane_readiness(auto/always/never) and fall back to the classic one-pane-at-a-time path when a later pane'sstart_directorydepends on an earlier pane's command.Changes
workspace/builder/concurrent.py(new): builder, readiness barrier, adaptive space-reclaim (no space for new pane with main-horizontal and a few panes #800), sequential fallback.workspace/builder/classic.py: extract behavior-preserving_build_windowseam.pyproject.toml+builder/__init__.py: register/export theconcurrententry point.Supersedes #1056, re-homed onto the #1066 builder framework as a separate opt-in builder rather than changing the default. #1056's CLI progress / before_script / synchronize-panes follow-ons are intentionally out of scope here.
Test plan
uv run py.test --reruns 0— full suite greenuv run mypy .,ruff check .,ruff format --check .just build-docs— no new warnings