Skip to content

Inside Review blocks

Ilia edited this page Nov 19, 2026 · 4 revisions

A pull request too big for one review is read in blocks (sclaude/lib/review/review_blocks.sh, review_blocks.py). Past a few thousand changed lines a review pass reads part of the diff and calls the rest clean — one of ~9,700 lines was covered a third — so step 4 cuts such a pull request once, as it starts, and reads the blocks one after another. It is about size, not parts: a big feature built in one go is cut too, and a split one whose diff is small is read whole.

The cut (blocks_ensure, from the review gate before the mode is decided): nothing while blocks.total is set (0 when the pull request is read whole) or the project has no review; read whole at or under reviewBlocks.from changed lines (5000; size in review_blocks.py, which leaves generated files out — lock files, snapshots, files marked @generated). Past it a headless, read-only session (blocks_cut_session, the review's model) is handed the changed files, their sizes, whether a tool wrote them and which parts changed them, and the plan, and answers with the cut's JSON (take reads it from around a fence): each block a group of the plan's criteria with the files that carry them — by behaviour, not by layer, since a rule's bugs are where the database, the server and the screen meet; tests with their code; manuals last; rules for criteria every behaviour follows (permissions, errors, notifications); the foundation — the data model and its rules, the shared files, the files that build the rules, the most important behaviour — leaning into the first blocks, with the behaviour that rests most directly on it rather than as a block of one layer; a leaning, not a law, since a fix there reaches every block and the later ones then read on code already reviewed. validate checks every changed file in exactly one block, every criterion in one block or rule, no block past reviewBlocks.size changed lines (3000) unless it is one file; a second try is told what the first got wrong. Two refusals fall back to draft, the parts as blocks — each file owned by the part whose range changed most of it, each criterion by its tag — and, for a feature not built in parts, to a single read. Fewer than two blocks is a single read. The cut is review-blocks.json; the state keeps blocks.total (the blocks and the seams) and blocks.current. The person is told the blocks in the topic and the terminal, and the review does not wait for them. The pull request takes the no-review label (blocks.label_before keeps whether GitHub said it carried one already: the seams leave on only a label that plainly was there — one nobody could tell about comes off, a review too many being better than none): while review-blocks.json is there project_review_mode and review_mode in pr_context.py answer local over a GitHub answer, as a review in Actions reads the whole and cannot be held to a block — and, under github or under github-local with no move here (a move for Actions minutes or a runner keeps its own rule), in_blocks and project_review_in_blocks keep the project's CI in the verdict, as for a review moved here for Claude's limit. blocks.pr names the first pull request seen since the node was emptied, decided or not: it owns the cut, and another one — after a merged one was reopened — empties the node, the cut on disk with it, and is decided afresh.

A block's first read (local_review_run, blocks_scope): its criteria quoted from the plan, the rules, its own files to read whole at HEAD with git diff <base>..<head> -- <files>, its contracts, and the other blocks by name — opened only to follow its criteria end to end or check a contract. A changed file no block owns (a fix of an earlier block added it) goes to the block read now. The journal tags every run with block and read (SCLAUDE_REVIEW_BLOCK, SCLAUDE_REVIEW_READ, tag in local_review.py): first asks whether the block's first read is still to come, round and cached count the block's runs, and since stays the pull request's last head. Its rounds read the new commits across the whole pull request, with the closed blocks' files they touched and the criteria each answers for (blocks_touched): a fix made for one block may break another's rule, and the diff alone does not say which. A block whose own files, with those no block owns, changed by reviewBlocks.size lines or more since its last whole read (whole in local_review.py names that head, stale in review_blocks.py counts, generated files left out) — a rework at the person's word, a large fix — is read whole again on the next pass, so that no line of it is left to a diff too long to read well.

A block outgrows its cut: its fixes add files, which its whole read takes, or a rework adds code, until a pass cannot read it whole in earnest. Before a whole read — a block's first, or a stale block's again, not a capped first read followed up on its head — a block past reviewBlocks.size changed lines, with the files no block owns, and more than one file (outgrown) is split (blocks_split, from local_review_run): a session like the cut's, given the block alone (brief: its criteria, its files now, its contracts), answers with its parts in the cut's shape, and split checks them — every file and criterion of the block in exactly one part, two parts or more, none past the size but a single file — a second try told the faults, and failing that the block is read as it is, and — once an answer was judged and did not hold — not split again on that head (tried: a pass retried by itself would pay for the sessions each time); a session that failed, or a crash of the check (said as such, its trace in the log), judged nothing and marks nothing — a passing failure does not leave the block unsplit for the head, at the price of a retry paying again. A part may not own only files no longer changed. Its files the pull request no longer changes are offered too, each to go with its behaviour. The prompt names a block by its id; the menu, the close question and the topic by its place of the total, with its id before it once a split moved the places (blocks_label: "block 2/5", "block 3 (4/5)", and the last place "the seams (5/5)"). The seams have no id: the journal names their pass by its place, blocks.total, and journal_runs in review_report.py — the one grouping the report and the review map read — calls it seams there ("seams.1", "Seams · round 1"). The parts take its place, blocks.total grows, and the read goes to the first part. A block keeps its id for good (its place until a split first moved the places), and the journal and the history name it by that, so old rounds stay the old block's: the parts of 1 are 1a, 1b, of 1a 1a1, 1a2, and the blocks after keep theirs. The cut as it stood is kept in earlier, which the review's map plays: played back, the columns are grouped by the cut of that moment, and a dashed line across the map at the first round after a split names the block and its parts; a click on it opens a card of what happened — when, the block as it was, and each part with its files and criteria (earlier keeps the criteria too). A split costs what a cut does, under a dollar; the whole read it comes before was to be paid anyway.

Closing a block (blocks_next, from after_step): a block changed past reviewBlocks.size lines since its last whole read (blocks_stale, the branch's own commits only, merges left out) is not closed before it is read whole: its next pass reads it whole (local_review_run, past the cache of a head already read as a diff), and the gate runs a pass before every close of a review read here; local_review_done answers "not done" meanwhile, so that pass is reported like any. With the search ended the pass only checks the fixes, and a block closing still stale — the search ended, or the head let go unreviewed — says in the terminal and the topic that its change was not read whole. A review step that closed with nothing open closes the block instead while it is not the last — the head kept in the cut's closed, step 4's record begun again with its conversations kept and the old one under blocks.<k>, so the block's rounds, its [s] and the [g] ceiling count afresh — and step 4 runs again on the next block. The last block is the seams (seams in review_blocks.py): the behaviours together, what changed in each closed block's files since it closed, the rules across the feature, the criteria against the whole. After it the cut is taken off — the review goes back to where the project runs it, for a return from QA, the no-review label off again where that is GitHub — and step 4 closes as any other. step_label says 4/7 review · block 2/5; review.md tells the fixing session which block it is in (<if:in-blocks>, <block>, <blocks>, <block-title>).


Generated from docs/sclaude.md; edit it there, then rebuild with wiki/build.py.

Clone this wiki locally