refactor(pipeline): drop sequence variable and resumed_completed duplicate#242
Merged
miguelgfierro merged 1 commit intoMay 28, 2026
Merged
Conversation
…icate sequence was always len(completed) after each increment (or len(completed)+1 in the failed-node audit case). Replace the running counter with len(completed) expressions at the call sites. resumed_completed was a separate alias for completed during resume; assign into completed directly. _run_fanout no longer takes or returns sequence — derives it from len(completed) like the main loop. Behavior unchanged.
ancongui
pushed a commit
that referenced
this pull request
May 31, 2026
…ping refactor(pipeline): drop sequence variable and resumed_completed duplicate
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.
Addresses finding #7 from the simplifier review of #232.
Two redundant bookkeeping variables in `StatePipeline.invoke`:
`sequence` — A running counter incremented in lockstep with `completed.append(...)`. The invariant held everywhere: `sequence == len(completed)` after each increment, and `sequence + 1 == len(completed) + 1` for the pre-append error-audit case. Removed in favour of inline `len(completed)` / `len(completed) + 1`.
`resumed_completed` — A separate list populated only during resume, then immediately copied into `completed` via `completed = list(resumed_completed)`. Collapsed into `completed` directly.
`_run_fanout` lost its `sequence: int` parameter and `-> tuple[BaseModel, int]` return type — it now returns just the new state and derives sequence from `len(completed)` internally, matching the main loop.
Behavior
Unchanged. Same checkpoint sequence numbers, same audit sequence numbers, same error semantics.
Verification
Diff stats
`state_pipeline.py`: 13 insertions, 21 deletions (net −8 LOC).