108 lines
3.7 KiB
Markdown
108 lines
3.7 KiB
Markdown
|
|
---
|
||
|
|
model: claude-fable-5
|
||
|
|
service: claude
|
||
|
|
timestamp: 2026-07-02T16:16:24Z
|
||
|
|
git_ref: 65bf9df5
|
||
|
|
diff_cmd: git diff main..wkt/start_or_cancel_tests_474
|
||
|
|
---
|
||
|
|
|
||
|
|
# Raw output — gh #474 `start_or_cancel()` test suite
|
||
|
|
|
||
|
|
## Generated test code
|
||
|
|
|
||
|
|
> `git diff main..wkt/start_or_cancel_tests_474 -- tests/trionics/test_taskc.py`
|
||
|
|
|
||
|
|
Prose summary of the generated module
|
||
|
|
(`tests/trionics/test_taskc.py`):
|
||
|
|
|
||
|
|
- module docstring framing the `trio.Nursery.start()`
|
||
|
|
startup-cancellation wart, the wrapper's repair, and
|
||
|
|
the intent that `use_start_or_cancel=False` params
|
||
|
|
double as upstream-trio wart-documentation (break on
|
||
|
|
a trio upgrade → upstream may have shipped porcelain,
|
||
|
|
re-audit the wrapper); cites gh #474 / PR #464 and
|
||
|
|
`modden`'s `progman.open_wks()` as the source use
|
||
|
|
case.
|
||
|
|
- shared children: `absorbs_cancel_pre_started()` (the
|
||
|
|
graceful-teardown cancel-absorber which triggers the
|
||
|
|
lossy RTE path) + `raise_val_err()` (fast-erroring
|
||
|
|
sibling).
|
||
|
|
- `test_sibling_err_not_masked_by_startup_rte`
|
||
|
|
(parametrized `use_start_or_cancel`): asserts eg
|
||
|
|
contains exactly one `ValueError` and, wrapper-case,
|
||
|
|
NO residual RTE (`eg.split(ValueError)` remainder is
|
||
|
|
`None`); bare-case, the residual RTE carries trio's
|
||
|
|
exact "child exited without calling" wording.
|
||
|
|
- `test_pure_oob_cancel_not_morphed_to_rte`
|
||
|
|
(parametrized): wrapper-case runs clean and asserts
|
||
|
|
`cs.cancelled_caught`; bare-case asserts the
|
||
|
|
eg-wrapped RTE.
|
||
|
|
- `test_genuine_startup_rte_still_raised`
|
||
|
|
(parametrized): no-cancel protocol bug → RTE with
|
||
|
|
trio's wording from both call forms.
|
||
|
|
- `test_childs_own_rte_never_demoted_to_cancel`
|
||
|
|
(parametrized `rte_arg` in `'never got started!'`,
|
||
|
|
`1234`): child cancels the ambient scope then raises
|
||
|
|
its own RTE synchronously (no checkpoint between →
|
||
|
|
deterministically under-cancellation at catch time);
|
||
|
|
asserts the RTE survives with `args[0]` intact.
|
||
|
|
- `test_started_value_and_args_passthru`: `.started()`
|
||
|
|
value, positional args and the `name=` kwarg (via
|
||
|
|
`trio.lowlevel.current_task().name`) all forward.
|
||
|
|
|
||
|
|
## Non-code output (verbatim highlights)
|
||
|
|
|
||
|
|
Behaviour probe (trio 0.29, scratchpad scripts) — the
|
||
|
|
decision basis for the test shapes:
|
||
|
|
|
||
|
|
```
|
||
|
|
== B-sibling-err use_soc=False
|
||
|
|
start raised: RuntimeError('child exited without
|
||
|
|
calling task_status.started()')
|
||
|
|
top-level: ExceptionGroup([ValueError('sibling blew
|
||
|
|
up!'), RuntimeError('child exited without calling
|
||
|
|
task_status.started()')])
|
||
|
|
== B-cs-cancel use_soc=False
|
||
|
|
top-level: ExceptionGroup([RuntimeError('child
|
||
|
|
exited without calling task_status.started()')])
|
||
|
|
== B-sibling-err use_soc=True
|
||
|
|
start raised: Cancelled()
|
||
|
|
top-level: ExceptionGroup([ValueError('sibling blew
|
||
|
|
up!')])
|
||
|
|
== B-cs-cancel use_soc=True
|
||
|
|
start raised: Cancelled()
|
||
|
|
top-level: clean return
|
||
|
|
== own-rte-under-cancel (both) -> RTE('never got
|
||
|
|
started!') propagates unchanged
|
||
|
|
```
|
||
|
|
|
||
|
|
Key finding: with a WELL-BEHAVED (non-absorbing) child
|
||
|
|
an OOB ancestor cancel surfaces `Cancelled` directly
|
||
|
|
from `.start()` on trio 0.29 — the lossy RTE requires
|
||
|
|
the child to absorb its cancel pre-`.started()`, which
|
||
|
|
is what `modden`'s `open_from_wks` teardown did. Trio's
|
||
|
|
nursery-exit wait defers cancel delivery to children,
|
||
|
|
so all tested shapes are deterministic (0 flakes / 50
|
||
|
|
runs).
|
||
|
|
|
||
|
|
Mutation verification:
|
||
|
|
|
||
|
|
```
|
||
|
|
mutation 1 (checkpoint_if_cancelled removed):
|
||
|
|
FAILED test_sibling_err_not_masked_by_startup_rte[True]
|
||
|
|
FAILED test_pure_oob_cancel_not_morphed_to_rte[True]
|
||
|
|
mutation 2 (guard relaxed to 'started' substring,
|
||
|
|
isinstance dropped):
|
||
|
|
FAILED test_childs_own_rte_never_demoted_to_cancel[never got started!]
|
||
|
|
FAILED test_childs_own_rte_never_demoted_to_cancel[1234]
|
||
|
|
```
|
||
|
|
|
||
|
|
Final runs:
|
||
|
|
|
||
|
|
```
|
||
|
|
tests/trionics/test_taskc.py: 9 passed in 0.03s
|
||
|
|
hammer: 0/50 runs failed
|
||
|
|
tests/trionics/ + tests/test_trioisms.py:
|
||
|
|
23 passed, 5 xfailed in 3.02s
|
||
|
|
```
|