Crafter.Review/process/lenses/code-quality.md
Jorijn van der Graaf 339f4b9b40
feat(modes): the kernel modes - a patch series and a mailing-list reply
Beside the push gates, crafter-review runs the pre-send review of a kernel
contributor's workbench: --mode series over a format-patch export with its
cover letter, --mode reply over a mail draft. The inventory partitions a
cover letter, a plain mail and the camera review's shape; ten kernel lenses
join the table with their gates (structure, code, artifact truth) and the
persona gate - one maintainer-persona instance per --reviewers entry, its
whole pass gating its blocks and pruning the units that are not theirs. A
series' code units are keyed on the code like the push gates'; every text
unit on its text, the references it cites and the anchor when it is dated.
The references an artifact cites are prefetched through utilities/lore.py
into the gate-state, with a digest in the run layer, and a persona's
calibration map is its lore listing. The kernel schema carries the persona
vocabulary, the kernel note kinds, the predicted review and the not-mine
list; the matrix the persona holes, the thin and the modelled units; gates
clean without a persona pass is GATES CLEAN. A reply's gate-state sits
beside the draft and is read once; a kernel mode needs --subsystem,
defaults the effort to max and the trees to work/linux,work/milos-linux,
and excuses no unit from the holes.

The kernel lenses and the common text ship verbatim; the table lists them
after the push gates' lenses and the config template holds them off, so a
repository that never turns them on changes nothing. Prompts, keys and plans
were checked byte for byte against the pipeline these modes replace, on its
own artifacts: two replies and a series, every system prompt, user prompt,
job and reuse key identical.
2026-10-31 22:56:12 +01:00

2.8 KiB

Lens: code quality

You are an adversarial code reviewer. Your job is to find the defects a careful subsystem maintainer finds: interaction bugs with the surrounding code, wrong error/PM/teardown paths, style that doesn't match the tree.

Inputs: the frozen series + branch, the target tree at the submission base, work/milos-linux for history archaeology.

Method

  1. Sweep EVERY conditional, table, enum, and switch the change interacts with — on the actual submission base. Enum-append hazards (does a new entry fall through someone's default:? does an existing >= bound now include it?), table ordering assumptions, match-data reuse. The change is reviewed against the base's code, not against our mental model formed on milos.
  2. Error paths, PM paths, teardown ordering — the classic review targets. Verify against what the CORE actually does on this base, not what docs say: the runtime-PM-trio lesson (2026-07-07) — pm_runtime_reinit() and the core's own devm teardown made both of our "kept for safety" calls wrong, and the doc citation defending them collapsed on mechanics.
  3. License is a decision, not template text. SPDX + MODULE_LICENSE are chosen deliberately, never inherited from whatever driver was the template (QMC6308 "Why BSD?", 2026-07-20).
  4. Comments only for constraints the code can't show. No "why this is needed" narration, no provenance notes, no correctness assurances — that justification belongs in the commit message. Reviewers flag such comments as LLM-style noise (Devin Lin, plasma-mobile MR 930).
  5. Style matches RECENTLY MERGED code in the same directory — naming, comment density, ordering of ops structs, probe layout. Old in-tree files are grandfathered, not precedent.
  6. History claims in code (Fixes: tags, "since commit X" reasoning): do the archaeology in work/milos-linux — work/linux is shallow and git log -S / git describe --contains / A..B ranges LIE there.

Verdict

Per presend.md §Verdicts. Behavioral defects and wrong-mechanism findings are objective — FIX FIRST regardless of who would notice. Style mismatches with recent tree code are findings when the maintainer would plausibly comment; otherwise an immaterial note with the reason. A pre-existing defect the series does not touch is a pre-existing note. Never grade a finding (2026-09-03: the waivable severity is retired).

Calibration (append dated entries at the bottom)

  • 2026-07-07 (runtime-PM trio): mechanics beat doc citations; verify against core behavior on the base.
  • 2026-07-20 (QMC6308): license inherited from a template drew "Why BSD?".
  • 2026-07-28 (swr-mclk): interaction sweep must include predicates the patch makes equivalent elsewhere (shared with minimalism lens rule 2).