Add .trionics.start_or_cancel() test suite#479
Open
goodboy wants to merge 1 commit into
Open
Conversation
Resolve #474 with a new `tests/trionics/test_taskc.py` (9 tests) covering the `trio.Nursery.start()` wrapper landed in PR #464, incl. the `modden.runtime.progman.open_wks()` use case dug out as a minimal repro. Deats, - the lossy `RuntimeError('child exited without calling task_status.started()')` only fires when the child absorbs its ambient cancel pre-`.started()` (graceful-teardown pattern); a well-behaved child surfaces `Cancelled` direct from `.start()` on `trio` 0.29 - verified empirically 1st. - `test_sibling_err_not_masked_by_startup_rte`: the `modden` case; ONLY the root-cause sibling `ValueError` escapes the nursery with the wrapper vs. bare-`.start()`'s lossy riding-along startup-RTE noise. - `test_pure_oob_cancel_not_morphed_to_rte`: plain ancestor `cs.cancel()` exits clean vs. bare's eg-wrapped RTE. - `test_genuine_startup_rte_still_raised`: sans cancellation the protocol-bug RTE re-raises same as bare. - `test_childs_own_rte_never_demoted_to_cancel`: exact-msg + `isinstance`-guard regression cover; a child's own `RuntimeError('never got started!')`/`RuntimeError(1234)` never demotes to a `Cancelled`. - `test_started_value_and_args_passthru`: positional args, `name=` and `.started()`-value forwarding. Also, - `use_start_or_cancel=False` params pin upstream `trio`'s current lossy behaviour as wart-documentation: a break on a `trio` upgrade likely means new upstream porcelain and the wrapper deserves a re-audit. - verified 0 flakes over 50 hammer runs + 2 impl mutations each caught by exactly the targeted tests. Prompt-IO: ai/prompt-io/claude/20260702T161624Z_65bf9df5_prompt_io.md (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code
There was a problem hiding this comment.
Pull request overview
Adds a dedicated unit-test suite for tractor.trionics._taskc.start_or_cancel() to prevent regressions around Trio’s Nursery.start() startup/cancellation edge cases (the issue #474 / PR #464 motivation), plus accompanying prompt-IO artifacts.
Changes:
- Add
tests/trionics/test_taskc.pycovering out-of-band cancellation, sibling-error cancellation, genuine startup-protocol errors, and argument/started()value passthrough. - Include
use_start_or_cancel=Falseparametrizations to explicitly pin (and document) current upstream Trio behavior alongside the wrapper behavior. - Add prompt-IO markdown artifacts under
ai/prompt-io/claude/describing the generation/session context.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/trionics/test_taskc.py | New test module validating start_or_cancel() behavior across cancellation/error scenarios and passthrough semantics. |
| ai/prompt-io/claude/20260702T161624Z_65bf9df5_prompt_io.raw.md | Raw prompt-IO capture for the test generation session. |
| ai/prompt-io/claude/20260702T161624Z_65bf9df5_prompt_io.md | Summarized prompt-IO metadata and rationale for the added test suite. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolve #474 with a new
tests/trionics/test_taskc.py(9 tests) covering thetrio.Nursery.start()wrapper landed in PR #464, incl. themodden.runtime.progman.open_wks()use case dug out as a minimal repro.Deats,
RuntimeError('child exited without calling task_status.started()')only fires when the child absorbs its ambient cancel pre-.started()(graceful-teardown pattern); a well-behaved child surfacesCancelleddirect from.start()ontrio0.29 - verified empirically 1st.test_sibling_err_not_masked_by_startup_rte: themoddencase; ONLY the root-cause siblingValueErrorescapes the nursery with the wrapper vs. bare-.start()'s lossy riding-along startup-RTE noise.test_pure_oob_cancel_not_morphed_to_rte: plain ancestorcs.cancel()exits clean vs. bare's eg-wrapped RTE.test_genuine_startup_rte_still_raised: sans cancellation the protocol-bug RTE re-raises same as bare.test_childs_own_rte_never_demoted_to_cancel: exact-msg +isinstance-guard regression cover; a child's ownRuntimeError('never got started!')/RuntimeError(1234)never demotes to aCancelled.test_started_value_and_args_passthru: positional args,name=and.started()-value forwarding.Also,
use_start_or_cancel=Falseparams pin upstreamtrio's current lossy behaviour as wart-documentation: a break on atrioupgrade likely means new upstream porcelain and the wrapper deserves a re-audit.Prompt-IO: ai/prompt-io/claude/20260702T161624Z_65bf9df5_prompt_io.md (this patch was generated in some part by [
claude-code][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code