Commit Graph

2 Commits (b6316ed776f5533044bdefe138418fda44315000)

Author SHA1 Message Date
Gud Boi b6316ed776 Avoid `raise None` after successful `asyncio` exit
An asyncio-side task can handle the issued `TrioTaskExited` and
return normally. With `suppress_graceful_exits=False`, the strict
reporting branch in `translate_aio_errors()` nevertheless tried
to raise `trio_to_raise=None`, replacing successful completion
with TypeError('exceptions must derive from BaseException').

Require an actual pending exception before that strict-policy
raise. Existing errors retain their reporting and cause handling;
strict reporting does not manufacture an error after a successful
asyncio-side return with no remaining trio-side error.

Deats,
- run the channel-exit matrix directly in an infected root as well
  as through sequential TCP RPCs in an infected child;
- add direct/cached cases where the asyncio-side task suppresses
  the issued TTE and returns, under graceful and strict policies,
  with native and Greenback task execution;
- test a child suppressing TTE and staying blocked: check channel
  startup state, then require receipt of that channel's exact
  issued TTE with trio-side exit set and asyncio still running;
- publish the receipt marker only after those checks, before the
  responsive parent awaits `an.cancel()`; require nursery exit
  to join the retained child process handle;
- bound that probe from another process, failing if its watchdog
  must rescue the test group; successful child exit does not prove
  that hard-kill escalation was needed;
- explicitly `raise signal`, rename the caller-cancellation flag
  to `cancel_trio_side`, and format signal/callback diagnostics;
- retain the maintainer's test layout and helper documentation.

Qualification: expanded matrix before the guard: 8 failed / 33
passed; all eight failures are strict-policy successful returns.
After the guard, selected exit/root/infected-asyncio/formatter
suites: 70 passed / 18 deselected, with 24 fork deprecation
warnings. Strengthened blocked-child state checks: 1 passed.
Interactive SIGINT/debugger cases remain excluded.

(this patch was generated in some part by `opencode` using
`gpt-6.1-sol` (`openai`))
2026-10-30 13:10:53 -04:00
Gud Boi 540dd2bf73 Test `trio`-side channel exit in an infected child
Exercise the exit-signal handling fixed in 4dfcf6f6 using the real
`to_asyncio.open_channel_from()` API in an infected child actor.
An expected `TrioTaskExited` must not escape graceful teardown or
be raised again as an unhandled asyncio done-callback exception.

Deats,
- run six cases with native and Greenback-wrapped asyncio tasks:
  direct channel closure, last cached caller exit/cancellation,
  strict TTE reporting, and distinct RuntimeError/TTE cleanup faults;
- use `block_until_trio_side_exit()` to record task identity,
  complete startup, send one channel value and block until signalled;
- wrap the channel API in `maybe_open_context()` for cached cases,
  proving overlapping `trio.Task`s receive the same channel;
- synchronize the second subscription with `tn.start()` and an
  event, then join its task before checking asyncio is still alive;
- open two asyncio tasks sequentially, checking each finishes when
  its channel closes and retains the expected exception identity;
- raise a NEW TTE during cleanup to reject blanket type-based
  suppression, retaining the issued TTE as the new error's cause;
- drain a host-loop callback before checking unhandled exceptions
  for expected shutdown, separately from actor/RPC usability;
- await two sequential `Portal.run()` calls in the same child,
  then explicitly cancel the actor before leaving its nursery.

Keep the Piker reproduction as context rather than describing the
blocking asyncio task as a quote/feed implementation. Document case
selection, closure contracts and the assertions at their call sites.

Qualification: latest matrix 12 passed. Earlier combined asyncio
and task-formatter run: 41 passed / 18 deselected. This matrix does
not yet cover an infected root or an asyncio task suppressing TTE
and returning or remaining blocked; those are follow-up coverage.

(this patch was generated in some part by `opencode` using
`gpt-6.1-sol` (`openai`))
2026-10-30 11:37:16 -04:00