Skip to content

Lifecycle(feat): Add owned tmux resource scopes - #27

Draft
tony wants to merge 2 commits into
masterfrom
lifecycle-mvp
Draft

tony wants to merge 2 commits into
masterfrom
lifecycle-mvp

Conversation

@tony

@tony tony commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Ordinary Ruby examples use the normal tmux endpoint. An external harness redirects the same code through captured socket and child-environment defaults, then cleans up its daemon. The displayed examples retain their imports and match their source files.

adopt accepts cleanup responsibility for an existing server, session, window or pane. OwnedResource retains the accepted daemon generation and resource ID, checks them before destruction, and permits retry after a failed close. Block scopes preserve both body and cleanup errors. Creation receipts support rollback after failed readback or cancellation. Uncertain outcomes remain explicit.

Bounded discovery reports endpoints, diagnostics and truncation. Find-or-create returns owned creations or borrowed matches, with exact session/window names and pane-local identities. Calls serialize within this Ruby process. Unrelated clients do not join that coordination. The Async facade defers cancellation during ownership handoff and uses the bound core executor for ownership commands.

The rebase preserves the released socket selectors. environment: supplies socket-selection defaults and env: explicitly captures the child environment. Core and Async use the same distinction. Discovery resolves an implicit relative or home-relative tmux directory with the endpoint’s path rules. RBS retains the receiver type when adopting a session, window, pane or Async server. Endpoint · Lifecycle contracts

Validation

  • On Linux arm64, Ruby 4.0.7 and tmux 3.8 passed 378 unit tests, 405 integration tests and 8 installed-gem tests. Each suite reported zero failures, errors and skips. Four existing process-identity scenarios were excluded from this local integration run. The focused lifecycle, default-endpoint and Async run passed 65 cases and 446 assertions. The same head passed RBS validation, the 877-method API check and all 192 rendered documentation pages. The combined checks took 148 seconds. Tested head
  • At the supported floor, Ruby 3.3.12 with tmux 3.3a passed 16 native cases and all 8 installed-gem tests, including 614 packaging assertions. An independent check also verified relative socket-directory discovery, the released selector’s executable lookup, and the concrete return and block types of adopt. Discovery and lifecycle tests · Installed consumer

Earlier draft measurements

Fresh independent review at the source committed as 730aad76 passed 46 core/Async cases and 396 assertions on each of tmux 3.7d and tmux 3.2a, plus 11 gate and native Async cancellation cases with 95 assertions. Removing the adoption check failed eight cases; removing the reuse handoff check failed six. The observer recorded 128 accepted daemon exits before exact fixture-root removal.

Remaining work

This PR stays in draft. Whole-harness crash recovery, complete descendant accounting and the shared documentation adapters listed in the original proposal remain outstanding. The current Ruby work runs the programs and checks their Markdown and YARD bindings. Plain Markdown, Astro Markdown/MDX, Sphinx reST/MyST and Python doctest remain in the wider example-testing scope.

tony added 2 commits December 5, 2026 12:15
why:
Ruby callers need to clean up the resources they accepted, including
when a block raises or an ownership handoff is cancelled.

what:
- Add receipt-backed scopes, adoption, discovery and find or create
- Capture the endpoint and child environment across Core and Async
- Defer cancellation during receipt handoff through the bound Core
  executor and retain recovery owners after failed cleanup
- Exercise the public scopes in ordinary Ruby and installed examples
why:
Callers need to find the ownership and discovery APIs shared by Core
and Async.

what:
Record block cleanup, bounded discovery and ownership retry in the
root changelog.

This branch was previously deployed

1 inactive (outdated) deployment
docs-preview — f09661bb Deployed Oct 10, 2026 by tony via publish (pr-27, pr, false, docs-preview, true) / publish #104
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