refactor(stella-pipeline): retire every too_many_arguments allow behind three parameter objects - #1880
Merged
Merged
Conversation
…nd three parameter objects The candidate plane threaded the same values positionally through every layer — the task view (goal, staged prefix, plan, assessment), the money pair (budget guard + running total), and the per-candidate tallies — and nine functions across pipeline.rs and fanout_stage.rs carried #[allow(clippy::too_many_arguments)] to keep it lawful. Each addition (#1701's mutating_actions, #1798's opaque_actions) widened half a dozen signatures and re-justified the allows. Three groupings, each transport for values that already travel together: - TaskFrame (new pipeline/task_frame.rs): the immutable per-turn view, built once in run() where its last field settles. - Spend (in pipeline/stage_budget.rs beside FanOutBudget): the budget guard and running total, borrowed so mutations land at run()'s locals with no write-back on early returns. - ChangeSignals (already the warrant's input type) replaces the three loose u32 counters on CandidateState, so run_engine_turn accumulates directly into the type the warrant reads and the counts can never be transposed en route — the #1701 recurrence the deleted change_signals() accessor guarded against by hand. revise_turn now takes &mut CandidateState like its only caller already did, instead of seven exploded fields. Every function in the plane is at or under clippy's argument threshold; the crate carries zero too_many_arguments allows. pipeline.rs shrinks by 88 lines. Pure refactor: no behavior change; 566 existing stella-pipeline tests pass unchanged. Closes #1809
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
There was a problem hiding this comment.
Sorry @macanderson, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Contributor
Reviewer's GuideRefactors the stella-pipeline candidate plane to eliminate clippy too_many_arguments allows by introducing TaskFrame and Spend parameter objects and by threading ChangeSignals structurally instead of loose counters, updating all candidate/verification paths accordingly. Sequence diagram for candidate execution with TaskFrame, Spend, and ChangeSignalssequenceDiagram
participant P as Pipeline
participant W as Worker
participant E as Engine
participant S as Spend
participant C as CandidateState
P->>P: run()
P->>P: TaskFrame{goal, base_messages, plan, assessment}
P->>S: Spend{budget, total}
P->>P: run_best_of_n(frame, n, frames, authored_witness, &mut Spend)
alt shared_tree
P->>P: run_shared_candidates(frame, &worker, n, &mut Spend)
else isolated_workspaces
P->>P: dispatch_isolated_candidates(frame, &worker, authoring, workspaces, width, &mut Spend)
P->>P: run_isolated_candidate(frame, &worker, authoring, ws, fan, &mut Spend)
end
P->>P: run_candidate(frame, authoring, &Engine, surface, &mut Spend)
P->>C: init CandidateState{messages, final_text, signals = ChangeSignals::default()}
P->>P: execute_plan(frame.plan, &Engine, &mut Spend, &mut CandidateState)
loop per_engine_turn
P->>E: run_engine_turn(&Engine, &mut messages, Spend.budget, &mut C.signals, flip_halt)
E-->>P: TurnOutcome{cost_usd}
P->>S: Spend.total += cost_usd
end
P->>P: verify_candidate(frame, witness, &Engine, surface, &mut Spend, CandidateState)
P->>P: warrant(&C.diff_text, C.signals)
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
What — #1809, Option A as triaged
The candidate plane (
run→run_best_of_n→dispatch_isolated_candidates→run_candidate→verify_candidate→revise_turn→run_engine_turn) threaded the same values positionally through every layer, and nine functions acrosspipeline.rsandfanout_stage.rscarried#[allow(clippy::too_many_arguments)]to keep it lawful (the issue counted seven; the sweep found two more infanout_stage.rs). Each new stage input — #1701'smutating_actions, #1798'sopaque_actions— meant widening half a dozen signatures and re-justifying allows.Three parameter objects, each grouping values that already always travel together (transport, not semantics — every field keeps its own documented meaning):
TaskFrame(newpipeline/task_frame.rs, per thedriver/settlement.rssibling-module pattern): goal, staged prefix, plan, assessment. Built once inrunwhere its last field settles;Copy, so the fan-out closures each take their own.Spend(inpipeline/stage_budget.rs, besideFanOutBudget): the budget guard + running total. Borrowed rather than owned so every mutation lands atrun's locals with no write-back on early returns — one missed return would be a silently vanished spend. The fan-out builds a per-candidateSpendover its claimed allowance, which is the shape that code already had.ChangeSignals— no new type: the warrant's input struct replaces the three looseu32counters onCandidateState, sorun_engine_turnaccumulates directly into the type the warrant reads. The deletedchange_signals()accessor existed to stop the counts being transposed en route (the warrant() waives the witness as "NothingChanged" for a candidate that dispatched 10 mutating calls — a false deterministic pass on system-config tasks #1701 recurrence); holding the struct makes that protection structural.revise_turnnow takes&mut CandidateState— its only caller already held one and exploded seven fields out of it.Result
rg too_many_arguments crates/stella-pipeline/src→ zero allows (one doc-comment mention).cargo clippy -p stella-pipeline --all-targetsadds no warnings from this change.pipeline.rsshrinks by 88 lines (3487 against its 3642 ceiling); the god-file and file-size guards pass for every touched file.Verification
Pure refactor — no behavior change, so no witness test (per AGENTS.md). Evidence: all 566 existing
stella-pipelinetests pass unchanged (544 lib + integration suites),cargo fmt --checkclean, scopedRUSTDOCFLAGS="-D warnings" cargo docclean.Known-red main caveat: clippy currently fails on main with two
witness_stage.rswarnings from #1813's auto-merge, and the file-size gate onevent.rs/deck_render.rsskew — peer unbreaks #1859 and #1845 cover those; this PR deliberately does not duplicate them, so its CI stays red on those two axes until they land.Exemplar for the parameter-object shape:
rustc's ownSession/context threading and this repo's existingWitnessAuthoringbundle.Closes #1809
Refs #1798, #1808
Summary by Sourcery
Introduce parameter objects for shared task context, budget, and change signals to simplify the candidate execution/verification pipeline and remove all too_many_arguments allowances.
Bug Fixes:
Enhancements:
Tests: