Skip to content

Workspace builder: bulk set-option helper + 10ms readiness polling#1070

Open
tony wants to merge 1 commit into
masterfrom
builder-bulk-options
Open

Workspace builder: bulk set-option helper + 10ms readiness polling#1070
tony wants to merge 1 commit into
masterfrom
builder-bulk-options

Conversation

@tony

@tony tony commented Jun 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Add ClassicWorkspaceBuilder._bulk_set_options, a batch-shaped helper routing the four set-option loops (session, global, per-window, options_after) through one entry point.
  • Tighten _wait_for_pane_ready polling interval 50ms → 10ms.

Note

The helper is forward-compat plumbing: today it is a plain loop producing identical tmux commands; the batch speedup lands once libtmux exposes a batch API. The polling tweak is the only current perf change.

Changes

  • workspace/builder/classic.py, tests, CHANGES.

Supersedes #1040, rebased onto the builder/classic.py package.

Test plan

  • full suite / mypy / ruff / build-docs

why: Workspace loads wait on shell prompt readiness with a 50ms
poll, coarser than tmux's 50-150ms shell-ready band, so readiness
is noticed late. Separately, the classic builder fires one
set-option per loop iteration across four hot loops (session
options, global_options, per-window options, options_after) with
no shared seam for a future batched dispatch.

what:
- Tighten _wait_for_pane_ready interval default from 0.05 to 0.01
  so prompt readiness is detected sooner (same condition).
- Add ClassicWorkspaceBuilder._bulk_set_options(items, *, target,
  scope_flag): mirrors set_option's True/False -> on/off
  normalization and propagates errors via handle_option_error.
- Route the four set-option loops through the helper: session
  (-s, session_id), global (-g, None), per-window (-w, window_id),
  options_after (-w, window_id).
- Add tests/workspace/test_builder_bulk_options.py covering scope
  application, on/off normalization, empty no-op, and OptionError
  propagation.

Salvaged from PR #1040, adapted from the pre-refactor single-file
builder.py onto the builder package's classic.py. The helper body
issues N round-trips today; the batch-shaped API defers the perf
gain to a future libtmux batching API.
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.64%. Comparing base (812dcca) to head (d736069).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1070      +/-   ##
==========================================
+ Coverage   82.56%   82.64%   +0.08%     
==========================================
  Files          31       31              
  Lines        2770     2783      +13     
  Branches      518      520       +2     
==========================================
+ Hits         2287     2300      +13     
  Misses        346      346              
  Partials      137      137              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tony tony changed the title Workspace builder: bulk set-option helper + 10ms readiness polling Workspace builder: bulk set-option helper + 10ms readiness polling Jun 29, 2026
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