build(bazel): buildifier as a required pre-commit check, format Bazel files #4040
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
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: 100% · 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 #4040"
general
weight: 0.35
Alexandr-Solovev
Summary
Two commits, in review order:
The
.git-blame-ignore-revsentry for the formatting commit comes as a follow-up PR after this merges, with the formatting commit's real SHA onmain. A merge may not keep the SHA of this branch.buildifierruns in check mode: it fails and does not rewrite a file it would reformat. AzureFormatterChecksrunspre-commit run --all-files, so this is the required check.-lint=off).buildifier -lint=warnreports 140 warnings in 14 categories, mostly unusedload()symbols, missing docstrings andconstant-glob. Fixing them is a semantic change to review on its own, so they are a TODO item. Turn lint on once they are fixed.-buildifier_disable=listsort -buildifier_disable=callsort). Buildifier sortsdepsandsrcs, and reorders keyword arguments. A sorteddepslist reorders the-I/-Dflags of compile actions, which changes the aquery output. Sorting keyword arguments moves comments, which fails the two-line comment-block check. The formatting keeps list order and argument order. (The flag takes one rewrite name per occurrence; a comma list disables nothing.).tpl.BUILDfiles are not valid Starlark untilexpand_templatefills them in; formatting the others would only be churn..bzl,.BUILD); 177 need reformatting.dev/bazel/AGENTS.mdlists the same set. The count is 177, not 178 as before:dev/bazel/flags.bzlcame in formatted with #4041.Regenerate the formatting on top of another branch (run from the repo root):
Evidence
origin/main7301a40f1 (includes #4014, #4038, #4041 and #4050). The hook commit was cherry-picked; the only overlapping hunk (indev/bazel/TODO.md) auto-merged. The formatting commit was regenerated with buildifier 8.2.1 and the flags above, and the blame-ignore entry is left to a follow-up after merge. Nothing was conflict-resolved by hand.buildifier -mode=checkfails on 177 files (the-mode=fixrun changes exactly those files).buildifier -mode=checkwith the same flags over all 203 files: exit 0. A second-mode=fixpass changes nothing (idempotent).python3 dev/bazel/tests/check_starlark_policy.py .:OK (2 allowed site(s)).bazel query '//...'(2682 lines) andbazel aquery 'deps(//:release)'(3463 actions) are byte-identical toorigin/main7301a40f1.bazel aquery 'deps(//dev/bazel/...)'(15425 actions) differs only inActionKeyon 40 runfiles actions: the source manifests and runfiles trees of thedev/bazel/teststargets, whose inputs are the reformatted files. Their command lines, inputs and outputs are identical.load()statements abovepackage()and sorts them and their symbols (161 of the 177 files). It shortens 5 labels in 2 files,@x//:xto@x(Bazel resolves both to the same label).dal_depslabels are not rewritten. A Python AST comparison of each changed file before and after: 14 identical, 161 identical once load order and load symbol order are ignored, 2 identical once the label rewrites are also normalized, 0 other (14 + 161 + 2 = 177).dev/bazel/AGENTS.mdlists the same set for this tree. The hook'sfilesregex is wider (it also matches.bazel,.sky,WORKSPACE), so a new file of those kinds would trip the hook but not the one-liner.Merge Danger
Door: two-way. The formatting commit reverts with
git revert; the hook can be removed from the config.Blast Radius: Bazel file diffs only (177 files). No code, no build flags, no targets change, but every open Bazel PR that edits a reformatted file will conflict on rebase. The hook also downloads buildifier from GitHub on the first run; CI needs
bashandsha256sumorshasum, which the Linux agents have.🤖 Generated with Claude Code
<details>
<summary>Checklist:</summary>
Completeness and readability
origin/main7301a40f1; the formatting commit was regenerated, not conflict-resolved.)Testing
Performance
queryand the//:releaseaquery are byte-identical to the base, and the//dev/bazel/...aquery differs only in ActionKey on 40 runfiles actions (see Evidence).</details>