tractor/tractor/spawn
Gud Boi f7033e7bbf Split forkserver backend into variant 1/2 mods
The `subint_forkserver` name was always aspirational —
today's impl forks from a regular main-interp worker
thread and the child runs trio on its own main interp;
NO subinterp anywhere in parent or child. Splitting the
backend into two clearly-named variants drops the lie:

- **variant 1** — `main_thread_forkserver` (the working
  impl). New `SpawnMethodKey` literal + `_methods`
  dispatch entry + `_runtime.Actor._from_parent()`
  match-arm. The spawn-coro `subint_forkserver_proc`
  moves to `_main_thread_forkserver` and is renamed
  `main_thread_forkserver_proc()`.

- **variant 2** — `subint_forkserver` (future, reserved).
  Module shrinks to a placeholder describing the
  variant-2 design (subint-isolated child runtime, gated
  on jcrist/msgspec#1026 + PEP 684). Today the legacy
  `'subint_forkserver'` key aliases to
  `main_thread_forkserver_proc` so existing
  `--spawn-backend=subint_forkserver` invocations keep
  working; flipped to a `NotImplementedError` stub in a
  follow-up.

Deats,
- `Actor._from_parent()` spawn-method gate now accepts
  both `'main_thread_forkserver'` and
  `'subint_forkserver'` (both go through the
  IPC-`SpawnSpec` path).
- the variant-1 spawn-coro stamps its own `SpawnSpec` /
  log lines with `spawn_method='main_thread_forkserver'`
  so subactor renders reflect the actual mechanism.
- docstring reorg: trio×fork hazard breakdown, POSIX
  fork-survival semantics, in-process-vs-stdlib
  forkserver design notes, and the TODO/cleanup section
  all move from `_subint_forkserver` to
  `_main_thread_forkserver` (lives with the working
  code). `_subint_forkserver` keeps a tight forward-
  looking doc that motivates the reserved key.
- `run_subint_in_worker_thread()` stays in
  `_subint_forkserver` as the companion primitive — it's
  the subint counterpart to `fork_from_worker_thread()`
  and will plug into the future variant-2 spawn-coro.

(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code

(cherry picked from commit 57dae0e4a6)
2026-06-24 18:19:16 -04:00
..
__init__.py Restore fn-arg `_runtime_vars` in `trio_proc` teardown 2026-04-23 18:30:11 -04:00
_entry.py Tidy `spawn/` subpkg docstrings and imports 2026-04-17 19:03:00 -04:00
_forkserver_override.py Mv core mods to `runtime/`, `spawn/`, `discovery/` subpkgs 2026-04-02 17:59:13 -04:00
_main_thread_forkserver.py Split forkserver backend into variant 1/2 mods 2026-06-24 18:19:16 -04:00
_mp.py Tidy `spawn/` subpkg docstrings and imports 2026-04-17 19:03:00 -04:00
_mp_fixup_main.py Fix typos + typing in `_mp_fixup_main` 2026-04-10 20:58:54 -04:00
_reap.py Add `tractor.spawn._reap.unlink_uds_bind_addrs()` 2026-06-17 17:39:44 -04:00
_spawn.py Split forkserver backend into variant 1/2 mods 2026-06-24 18:19:16 -04:00
_subint.py Log subint bootstrap excs + cancel-leak state 2026-06-24 18:19:16 -04:00
_subint_fork.py Doc `subint_fork` as blocked by CPython post-fork 2026-06-24 18:19:16 -04:00
_subint_forkserver.py Split forkserver backend into variant 1/2 mods 2026-06-24 18:19:16 -04:00
_trio.py Add `tractor.spawn._reap.unlink_uds_bind_addrs()` 2026-06-17 17:39:44 -04:00