refactor(policy): write a run's kept rows by operations of its buffers #9236
All Vouch review confidence checks passed
Residual risk 0.41 = Change Risk (0.52) × (1 − Review Confidence (0.21)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 32% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #9236"
general
weight: 0.35
claude[bot]
Description
The structure linter reads two findings on main that this change works on.
Buffers::before_softis known outsideBuffersin 2 places of one module: this change takes that finding away.Buffers::keptis known in 49 places of 4 modules: this change takes 25 of them. Of the 24 left, 18 read the list and 6 are the picker's narrowing at two sites.A reader holds the change by one search.
grep -rnE '&mut [a-z_.]*\bkept\b|\.kept\.(clear|push|extend|retain|truncate)\(|\.before_soft\.(clear|extend)' src/engine/framework.rs src/engine/framework/prints 19 lines: 15 insideimpl Buffers, and four that later changes take. On main it prints 26 lines, 25 of them outside that block.Problem
Buffersholds the lists of one profile run. The passes cleared, opened and lent its kept rows themselves, and the filter pass kept a soft filter's backup. The same statements stood at up to seven places.Solution
Buffersgains thirteen operations, one for each thing a pass does when it writes the kept rows. Each holds the statements that its callers held, in the order they ran in, and is inlined into them. The filter pass no longer names the backup of a soft filter.Changes
Paths are under
crates/grand_central.Buffersis private tosrc/engine/framework.rs. This is the second of four changes on that type, behind #9148, which did the same for the scores.| what | detail |
|---|---|
|
Buffers::keep_none| no row kept: the list's clear. Five places:filter,Half::emptied_limit_aside,Half::usable, andby_enginestwice. A pass calls it where it cleared the list ||
Buffers::open| the set a decision opens with, written behind the rows that stand:places::open. Four places:filtertwice,Half::emptied_limit_asideandHalf::usable||
Buffers::keep_rows| rows written behind the rows that stand, in the order they come. Three places:filtertwice, for the rows of a class, andby_engines, for the two rows that stand for two engines ||
Buffers::keep_among| those of an engine's rows that a test keeps, written a row at a time. One place,by_engines. It holds that loop as the place wrote it: askeep_rowsover a filter it would be another loop ||
Buffers::keep_folded| the freekeep_folded, lent the list. Three places:run_whole,vetoed::overload_passandengines::run_engines||
Buffers::reserve_empty| room for a pool, and no row kept. Four places: the three drawn runs andengines::run_owned||
Buffers::draw_first| the picker's draw into the kept rows. Three places: the three drawn runs ||
Buffers::join_named| the rows a host named join the rows drawn: the freejoin_named, lent the list. One place,order_joined. The free function stays: two cases call it ||
Buffers::retain| the kept rows that a test keeps. Seven places:filterfive times,Half::usableandvetoed::paired_decode||
Buffers::retain_by| one filter's pass over the kept rows. Two places:filter, for a hard filter, andHalf::emptied_limit_aside||
Buffers::retain_soft| a soft filter's pass: the backup, the pass, and the rows back where it leaves none. One place,filter. It ties the backup to its return. It takes the profile's holder of the filter and reads the filter behind the backup's copy, wherefilterread it ||
Buffers::name_row| the one row a number reaches, left as the set's one row: the freenamed_row, lent the list. One place,filter||
Buffers::is_empty| the read of whether a row is kept. Thirteen lines in six functions. The plan of these changes had it with the reads: it comes here because the lines that ask it are the lines this change rewrites || why the emptying is an operation of its own |
filterempties the list once, ahead of the three ways its set opens. A form of this change emptied it insideopenandkeep_rows, so each way emptied for itself.filterthen compiled to other code and ran more instructions on three of the four cells counted: the second table under Numbers. Sokeep_nonestands where the clear stood, andopen,keep_rowsandkeep_amongempty nothing || why
retain_softtakes the holder | an argument is read ahead of an operation's body. Handed the filter,retain_softhad its pointer read ahead of the backup's copy and kept across it. Handed the profile'sBox, it reads the pointer behind the copy, asfilterdid. The same table counts both || what stays for the next change | the 18 places that read the kept rows; the picker's narrowing at
score_andandrun_ranked, 6 places; and two functions whose one name writes the list and reads it:engines::run_ownedbehind its first line, andvetoed::paired_prefill|| why the narrowing stays | as an operation it left
run_rankedone compare, one branch and one failing block more behind the narrowing, by the listing of both bench executables. No cell of the bench decides by rank, so no count could hold it. It comes with the reads ||
Engine::pool_turn| it stays as it stands: it draws into the backup through its pattern ofBuffersand searches the rows kept || what
impl Buffersnames besides | three more free functions that take lists,keep_folded,join_namedandnamed_row;places::open; two calls of a stage,Picker::draw_firstandFilter::retain. None namesBuffers, and none is a function of a pass || two imports |
src/engine/framework/vetoed.rsandsrc/engine/framework/engines.rsno longer importkeep_folded. One doc link and one comment in them nameBuffers::keep_folded.src/engine/framework.rsimportsstd::ops::Dereffor the holder's bound || three cases added |
tests/unit/engine/framework/engines/tests.rs:the_trace_of_a_pick_over_one_engine_scores_each_row_handed_at_its_place, which holds the two rows handed out and the score the trace gives each. #9148's page said that no case held the second row's score.tests/unit/engine/framework/tests/columns_and_named_rows.rs:a_scorer_asked_over_scores_not_sized_to_the_rows_kept_stops_a_debug_build, andthe_operations_that_write_kept_rows_write_behind_the_rows_that_stand, which askskeep_rows,keep_amongandopenover a list that holds rows || a debug check added |
Buffers::score_byasserts in debug builds that the scores are as many as the rows kept. A review of #9148 asked for it. The second new case stops a debug build at it || cases | none changes |
| test gates | the change adds no
cfg(test)line undersrc, and none of its lines stands in a test-gated item || the structure linter | no run of it read this commit. A reading by text that counts as the linter's rule counts gives
before_soft0 places for 2 andkept24 for 49 || lines of code and of comment |
src/engine/framework.rs: 5,111 lines of code for 5,023, and 3,427 of comment for 3,385.framework/engines.rs: 250 for 254, and 101 for 101.framework/vetoed.rs: 589 for 592, and 530 for 530.framework/pair.rs: 904 for 904, and 805 for 805. The engines' cases file: 1,336 for 1,318, and 191 for 186.columns_and_named_rows.rs: 742 for 709, and 103 for 94. The change adds 208 lines of code and removes 76, and adds 65 of comment and removes 9 || the file's length |
src/engine/framework.rsholds 8,933 lines for 8,790. The block ofBuffers, from its doc to the end of itsimplblock, stands at lines 1386 to 1820. The file's split by concern is another change's, and this block stays whole in it || other open pull requests | ten change a file of this change. Seven join main and this change clean by text and share no changed line with it: #9231, #9220, #9201, #9185, #9182, #9041 and #9003. In
src/engine/framework.rsthe nearest changed lines stand 14 lines apart, with #9185. Three do not join main themselves: #8994, #8722 and #8274 || size | 6 files: 289 lines added and 85 removed |
Breaking changes
None. No decision changes: each operation holds the statements of the places it stands for.
Test Plan
The commit is one change on main
165f8bb04. Main changed none of its six files since9fa2c1e12, where it stood before.| ran on | the proofs |
|---|---|
| this commit | the format check, every lint step, the wasm32 check, the docs builds, the whole suite, the hooks |
| the change on main
9fa2c1e12, before one doc line and the comment of the third new case were reworded and one place of that case's last opening went from 4 to 3 | those again, the counts, the two executables, the built forms || two other forms of the change on main
7ffb232e4| the last table under Numbers |Both times means this commit and the change on main
9fa2c1e12.| proof | result |
|---|---|
|
cargo +nightly fmt -p smg-grand-central -- --check| exit 0, both times ||
cargo test -p smg-grand-central --all-features| 32 programs both times, with 0 cases failed and 35 ignored. On this commit 5,977 cases passed, and on main9fa2c1e125,972. Main added five cases between9fa2c1e12and165f8bb04||
cargo clippy --all-targetswith warnings denied, under six feature sets | exit 0 each, both times ||
cargo clippy --libunderworker-hostalone, andcargo checkforwasm32-unknown-unknownunderoperatoralone | exit 0 each, both times ||
cargo doc --no-depswith warnings denied: every feature, every feature with private items, and the default features | exit 0 each, both times || the repository's hooks on the 6 files, without seven of them: the workspace lint hook, the two format hooks, and four that read a branch or a commit message | exit 0 both times: no hook failed, and none rewrote a file |
| the trace case against three built forms of the trace's statement | each fails the case |
| the case of the three writing operations against three built forms, each with the clear back inside one of them | each fails the case, at that operation's list |
| five built forms that each leave one
keep_none()call out, against the 578 cases underframework| two fail cases: withoutfilter's, 30 cases fail, and withoutby_engines' second, 4. Three fail none of the 578:Half::emptied_limit_aside's,Half::usable's andby_engines' first. Each of the five stands where main's clear stood, and the two executables holdHalf::emptied_limit_asideandHalf::usableas main compiled them. Cases for those three are booked for a later change || no instruction more a decision: the
in_processbench's cells, 6 counts a side | 0 of 40 ranges lie apart at 8 workers, 0 of 33 under--overloaded 1, and 0 of 12 on the gate's six cells: under Numbers || two bench executables,
in_processanddispatch_credit, on both sides, held function by function |filterreads the same. One function differs in both, with as many instructions: under Numbers |Numbers
Instructions a decision in the
in_processbench under Callgrind, for the change on main9fa2c1e12. A range holds the lowest and highest of 6 counts.| what was counted | result |
|---|---|
| all 40 cells at 8 workers | 0 of 40 ranges lie apart. 21 of the cells run
filter|| the 33 cells that count under
--overloaded 1, at 8 workers | 0 of 33 ranges lie apart. Each of them runsfilter|| the six cells of the gate at 8 and at 64 workers | 0 of 12 ranges lie apart, and one side's widest range is 6.61 instructions. None of the six runs
filter|| the first count of each side of those six, function by function | no function of the crate costs a decision 0.05 of an instruction more or less, on any of the 12 cells |
Four of the cells that run
filter, at 8 workers:| cell | main | this change | the two ranges |
|---|---|---|---|
|
encode_round_robin| 11,904.93 to 11,906.67 | 11,903.56 to 11,907.25 | overlap ||
pair_round_robin| 7,322.49 to 7,325.53 | 7,322.44 to 7,325.51 | overlap ||
pair_round_robin_later| 11,624.74 to 11,629.50 | 11,627.15 to 11,629.63 | overlap ||
round_robin_on_runtime| 4,040.33 to 4,043.91 | 4,040.17 to 4,042.86 | overlap |Two bench executables, built on main
9fa2c1e12and on the change there, held function by function.| executable | functions | instructions on main | on the change | what differs |
|---|---|---|---|---|
|
in_process| 9,617 | 1,457,388 | 1,457,388 | one function,engines::run_engines: 3,778 instructions on both sides. Two adjacent stores stand in the other order, and four jumps go to the twin of a block of four instructions. None of the 170 profiles of this change's first counts names it ||
dispatch_credit| 5,518 | 925,892 | 925,892 | that function, with the same six lines |filterreads the same on both sides, instruction for instruction.Two other forms of this change were built and counted on main
7ffb232e4. The table holdsfilter's own instructions a decision, and each gap as a share of the cell.| cell, and its count on that main | main | each opening operation empties the list, and
retain_softis handed the filter | each opening operation empties the list, andretain_softis handed the holder |keep_noneahead, and the holder ||---|---|---|---|---|
|
encode_round_robin, 11,903.45 to 11,907.10 | 1,452 | 1,525: 73 more, 0.61 percent | 1,470: 18 more, 0.15 percent | 1,452 ||
pair_round_robin, 7,322.70 to 7,326.24 | 772 | 797: 25 more, 0.34 percent | 778: 6 more, 0.08 percent | 772 ||
pair_round_robin_later, 11,624.86 to 11,628.75 | 1,224 | 1,265: 41 more, 0.35 percent | 1,234: 10 more, 0.09 percent | 1,224 ||
round_robin_on_runtime, 4,030.84 to 4,032.11 | 165 | 172: 7 more, 0.17 percent | 163: 2 fewer, 0.05 percent | 165 |The first of those forms read 19 of the 40 cells apart and 31 of the 33 under
--overloaded 1, each of them more.Release note
refactor(policy): internal. The passes of a profile run write the run's kept rows through operations of its buffers. No decision, option or metric changes.