[refactor] reduce xenon C-rank blocks to A (behavior-preserving)

Extract helpers / flatten conditionals in 11 blocks that rated C(11)+
under xenon --max-absolute B, dropping pr_gate.py module rank B->A in
the process. Pure move-and-call refactors: each extracted helper holds
the original logic verbatim and the caller delegates to it; no control
flow, return values, or side effects changed.

Sites: validators._extract_strs, sequencing.dev_task_collision_edges,
evidence_builder.build_task_handoff, intake_driver._coerce_draft,
task.claim_task_for_agent (2 guards), prompter.create_task_from_draft
(validate+assignee), pr_gate._gate_decision (3 helpers),
orchestrator._handle_stopped_container + _reap_with_service,
_impl._create_subtask_from_inputs + complete.

_impl helper returns tuple[TaskNature, list[str]] to preserve mypy
narrowing of acceptance_criteria at the TaskCreateRequest site.

Also fix vulture: rename unused __aexit__ param tb->_tb in
test_conventions_cache_put.py (was hidden while xenon short-circuited
the gate).
This commit is contained in:
Renn F
2026-06-29 03:03:41 +02:00
parent 0c1c3b345a
commit 3a4a3fe57a
10 changed files with 361 additions and 261 deletions
@@ -41,7 +41,7 @@ class _FakeNested:
async def __aenter__(self) -> None:
self._session.savepoint_started += 1
async def __aexit__(self, exc_type: Any, exc: Any, tb: Any) -> None:
async def __aexit__(self, exc_type: Any, exc: Any, _tb: Any) -> None:
if self._session._duplicate:
self._session.savepoint_rolled_back = True
raise IntegrityError(