You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A cluster of small, individually-trivial consistency and dead-code fixes
surfaced by the refactoring audit. Grouped here as one gated cleanup; each is a
checklist item.
Tasks
get_stream_backend exhaustiveness (cuprum/_backend.py:148-165) —
the match requested: has no case _ and no terminal raise, so a future
enum member falls off the end returning None typed as StreamBackend. Add case _: raise AssertionError(f"unreachable backend {requested!r}").
ExecHook provenance (cuprum/__init__.py:45) — ExecHook is
re-exported from cuprum.context though it is defined in cuprum.events:84,
while ExecEvent is imported from cuprum.events. Import both from their
definition site; drop ExecHook from context's public re-export.
Spurious # type: ignore[assignment] (cuprum/logging_hooks.py:43-44)
— fields are typed HookRegistration | None, so assigning None should not
need the ignore. Verify and remove (or narrow with a specific reason).
Dead FD aliases (cuprum/_pipeline_streams.py:103-110) — _extract_reader_fd / _extract_writer_fd are pure pass-throughs to _extract_stream_fd. Inline at the two call sites and delete.
Lazy in-function imports / import cycle — the pipeline modules use
in-function imports and a _sh_module()sys.modules service-locator
(cuprum/_pipeline_internals.py:40-45; also _pipeline_config.py:49, _pipeline_stage_streams.py:62,84, _process_lifecycle.py:140,187-188) to
dodge a real cycle. Relocate the shared dataclasses (_StageObservation, _EventDetails, result types) into a dependency-free leaf module so these
become normal top-level imports, and delete the _pipeline_spawn.py re-export
shim.
en-GB spelling — cuprum/adapters/logging_adapter.py:96
"Programme" -> "Program"; align mixed serialise / serializable prose to
en-GB-oxendict (identifiers may stay ecosystem-standard).
Verification
make check-fmt lint test green; make markdownlint for any doc touched.
Summary
A cluster of small, individually-trivial consistency and dead-code fixes
surfaced by the refactoring audit. Grouped here as one gated cleanup; each is a
checklist item.
Tasks
get_stream_backendexhaustiveness (cuprum/_backend.py:148-165) —the
match requested:has nocase _and no terminal raise, so a futureenum member falls off the end returning
Nonetyped asStreamBackend. Addcase _: raise AssertionError(f"unreachable backend {requested!r}").ExecHookprovenance (cuprum/__init__.py:45) —ExecHookisre-exported from
cuprum.contextthough it is defined incuprum.events:84,while
ExecEventis imported fromcuprum.events. Import both from theirdefinition site; drop
ExecHookfromcontext's public re-export.# type: ignore[assignment](cuprum/logging_hooks.py:43-44)— fields are typed
HookRegistration | None, so assigningNoneshould notneed the ignore. Verify and remove (or narrow with a specific reason).
cuprum/_pipeline_streams.py:103-110) —_extract_reader_fd/_extract_writer_fdare pure pass-throughs to_extract_stream_fd. Inline at the two call sites and delete.in-function imports and a
_sh_module()sys.modulesservice-locator(
cuprum/_pipeline_internals.py:40-45; also_pipeline_config.py:49,_pipeline_stage_streams.py:62,84,_process_lifecycle.py:140,187-188) tododge a real cycle. Relocate the shared dataclasses (
_StageObservation,_EventDetails, result types) into a dependency-free leaf module so thesebecome normal top-level imports, and delete the
_pipeline_spawn.pyre-exportshim.
cuprum/adapters/logging_adapter.py:96"Programme" -> "Program"; align mixed
serialise/serializableprose toen-GB-oxendict (identifiers may stay ecosystem-standard).
Verification
make check-fmt lint testgreen;make markdownlintfor any doc touched.References