Three concrete refactors that reduce surface area for future bugs and
make the codebase easier to maintain by hand or by LLM.
1. backend/app/services/workflow_service.py — run_pipeline and
run_pipeline_stream used to be two 100+ line copies of the same
dispatch loop. Extract a single _execute_pipeline generator and
make both functions thin wrappers (one collects into a list, the
other yields). Per-node dispatch (input / built-in / plugin /
skipped) and the post-step circuit_shape stamping are factored
into _dispatch_one_node. Plugin hydration becomes a named helper
instead of an inline block duplicated on both paths.
Also pulled out _clamp_shots and _set_backend_ctx so the two
backend handlers share their shots-clamping and ctx-writing
patterns; _cache_put's prefix_types argument becomes required
(all call sites pass it; the dead 'None means skip sidecar'
branch is gone); the run_cache.qpy_dump_bytes import moves to
the top of the file with the …