tractor/ai/prompt-io/claude/20260702T161624Z_65bf9df5_p...

2.6 KiB
Raw Blame History

Prompt

attempt to resolve https://github.com/goodboy/tractor/issues/474 do it with /open-wkt.

Issue #474: “We need test suite for .trionics.start_or_cancel()” — dig out the use case from modden as a unit test (and provide motivation for upstream trio to possibly provide better porcelain around this case). The wrapper landed via PR #464 with no tests.

Response summary

New tests/trionics/test_taskc.py (9 tests) covering start_or_cancel(), authored in wkt start_or_cancel_tests_474.

Behaviour was first probed empirically (trio 0.29): the lossy RuntimeError('child exited without calling task_status.started()') only fires when the child exits pre-.started() WITHOUT propagating the ambient Cancelled — i.e. when the child (or lib code it calls) absorbs the cancel in a graceful-teardown pattern; a well-behaved child surfaces Cancelled straight out of .start(). The modden progman.open_wks() use case was reconstructed from modden/runtime/progman.py accordingly.

Tests (each use_start_or_cancel parametrization also pins upstream trios current lossy behaviour as wart-documentation):

  • test_sibling_err_not_masked_by_startup_rte — the modden case: sibling error OOB-cancels the shared nursery scope; with the wrapper ONLY the root-cause ValueError escapes; bare .start() adds the lossy RTE alongside.
  • test_pure_oob_cancel_not_morphed_to_rte — plain ancestor cs.cancel(): wrapper → clean exit; bare → eg-wrapped RTE.
  • test_genuine_startup_rte_still_raised — no cancellation → protocol-bug RTE re-raised same as bare.
  • test_childs_own_rte_never_demoted_to_cancel — a childs own RuntimeError('never got started!') / RuntimeError(1234) under ambient cancel is never demoted to Cancelled (exact-msg-match + str-guard regression cover).
  • test_started_value_and_args_passthru — happy path: positional args, name=, .started() value.

Verified: 9/9 pass; 0 flakes across 50 hammer runs; two impl mutations (checkpoint removed; guard relaxed to substring match) each caught by exactly the targeted tests; tests/trionics/ + tests/test_trioisms.py subset green (23 passed, 5 xfailed); ruff clean; 69-col style.

Files changed

  • tests/trionics/test_taskc.py — new start_or_cancel() unit-test suite (gh #474).

Human edits

Pending review — session paused pre-commit per user deadline; nothing committed as of this entry.