Skip to content

Add .trionics.start_or_cancel() test suite#479

Open
goodboy wants to merge 1 commit into
mainfrom
wkt/start_or_cancel_tests_474
Open

Add .trionics.start_or_cancel() test suite#479
goodboy wants to merge 1 commit into
mainfrom
wkt/start_or_cancel_tests_474

Conversation

@goodboy

@goodboy goodboy commented Jul 2, 2026

Copy link
Copy Markdown
Owner

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

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
Copilot AI review requested due to automatic review settings July 2, 2026 16:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py covering out-of-band cancellation, sibling-error cancellation, genuine startup-protocol errors, and argument/started() value passthrough.
  • Include use_start_or_cancel=False parametrizations 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

We need test suite for .trionics.start_or_cancel()

2 participants