feat(core): PipelineState.shared + Stage.local_state#37
Merged
Conversation
Two additive state interfaces for cross-stage and per-stage data: - `PipelineState.shared: Dict[str, Any]` — per-run bucket any stage can read/write for cross-stage communication. Resets each run. - `Stage.local_state(state)` — returns `state.metadata[self.name]` (auto-created), giving each stage a private scratchpad without key-prefixing. Both are purely additive: no shipped stage uses them yet. The 16 existing stages continue to operate unchanged; downstream PRs in this cycle (resolve_model_config, unified llm_client, s06_api migration, memory stages) will be the first consumers. Tests: 8 new unit tests cover empty defaults, per-state isolation, roundtrip, idempotence, inter-stage disjointness, and bucket separation from legacy `metadata`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR-1 of the 20260421_4 cycle — foundational state interfaces. Purely additive.
PipelineState.shared: Dict[str, Any]— cross-stage communication bucket, fresh per run.Stage.local_state(state) -> Dict[str, Any]— per-stage scratchpad backed bystate.metadata[self.name], auto-created.No shipped stage uses either helper yet; downstream PRs in this cycle (resolve_model_config, unified llm_client, s06_api migration, memory stages) will be the first consumers. See
Geny/dev_docs/20260421_4/index.mdfor the full sequence.Rationale
metadatahas accumulated a mix of legacy pipeline signals and stage-local bookkeeping. Splitting cross-stage data intosharedand per-stage data intolocal_statemakes intent explicit without breaking any existing reader/writer.Test plan
tests/unit/test_state_shared_and_local.pycover empty defaults, per-state isolation, roundtrip, idempotence, inter-stage disjointness, andshared/metadataseparation — all passing locally.pytest tests/suite: 1061 passed, 18 skipped (no regressions).ruff checkandruff format --checkon touched files — clean.🤖 Generated with Claude Code