tractor/ai/conc-anal
Gud Boi c17579ecea Add trio-parent tests for `_subint_forkserver`
New pytest module `tests/spawn/test_subint_forkserver.py`
drives the forkserver primitives from inside a real
`trio.run()` in the parent — the runtime shape tractor will
actually use when we wire up a `subint_forkserver` spawn
backend proper. Complements the standalone no-trio-in-parent
`ai/conc-anal/subint_fork_from_main_thread_smoketest.py`.

Deats,
- new test pkg `tests/spawn/` (+ empty `__init__.py`)
- two tests, both `@pytest.mark.timeout(30, method='thread')`
  for the GIL-hostage safety reason doc'd in
  `ai/conc-anal/subint_sigint_starvation_issue.md`:
  - `test_fork_from_worker_thread_via_trio` — parent-side
    plumbing baseline. `trio.run()` off-loads forkserver
    prims via `trio.to_thread.run_sync()` + asserts the
    child reaps cleanly
  - `test_fork_and_run_trio_in_child` — end-to-end: forked
    child calls `run_subint_in_worker_thread()` with a
    bootstrap str that does `trio.run()` in a fresh subint
- both tests wrap the inner `trio.run()` in a
  `dump_on_hang()` for post-mortem if the outer
  `pytest-timeout` fires
- intentionally NOT using `--spawn-backend` — the tests
  drive the primitives directly rather than going through
  tractor's spawn-method registry (which the forkserver
  isn't plugged into yet)

Also, rename `run_trio_in_subint()` →
`run_subint_in_worker_thread()` for naming consistency with
the sibling `fork_from_worker_thread()`. The action is really
"host a subint on a worker thread", not specifically "run
trio" — trio just happens to be the typical payload.
Propagate the rename to the smoketest.

Further, add a "TODO — cleanup gated on msgspec PEP 684
support" section to the `_subint_forkserver` module
docstring: flags the dedicated-`threading.Thread` design as
potentially-revisable once isolated-mode subints are viable
in tractor. Cross-refs `msgspec#563` + `tractor#379` and
points at an audit-plan conc-anal doc we'll add next.

(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 25e400d526)
2026-06-29 19:20:21 -04:00
..
fork_thread_semantics_execution_vs_memory.md Add posix-multithreaded-`fork()` explainer doc 2026-06-17 13:45:31 -04:00
spawn_time_boot_death_dup_name_issue.md Add boot-race conc-anal, widen `xfail` to `n_dups=8` 2026-06-17 17:39:44 -04:00
subint_cancel_delivery_hang_issue.md Doc `subint` backend hang classes + arm `dump_on_hang` 2026-06-29 19:20:21 -04:00
subint_fork_blocked_by_cpython_post_fork_issue.md Doc `subint_fork` as blocked by CPython post-fork 2026-06-29 19:20:21 -04:00
subint_fork_from_main_thread_smoketest.py Add trio-parent tests for `_subint_forkserver` 2026-06-29 19:20:21 -04:00
subint_sigint_starvation_issue.md Expand `subint` sigint-starvation hang catalog 2026-06-29 19:20:21 -04:00
test_register_duplicate_name_daemon_connect_race_issue.md Add `test_register_duplicate_name` race analysis 2026-06-17 13:45:31 -04:00
trio_033_cancel_cascade_slowdown_depth3_issue.md Bump trio depth=3 cancel timeout 6→12s 2026-06-17 17:39:44 -04:00
trio_wakeup_socketpair_busy_loop_under_fork_issue.md Add `tractor.trionics.patches` subpkg + first fix 2026-06-17 17:39:44 -04:00