Repository navigation
chore(lint): enable buf lint test, expand buildifier lint, and fix docs - #1673
Conversation
There was a problem hiding this comment.
Code Review
This pull request integrates Protobuf linting by adding a buf_lint_test target to api/BUILD.bazel and configuring lint rules in api/buf.yaml. Additionally, it removes unused-variable warnings from the pre-commit buildifier check, updates documentation to note the deprecation of Cluster Toolkit Blueprint v1, and refactors oci.bzl to use $(execpath) and include docstrings. The review feedback correctly identifies that the paths specified in api/buf.yaml under ignore_only must be relative to the api/ directory (the Buf module root) rather than the workspace root, and that paths starting with xmanager_cloud/ cannot be resolved from this location.
3bf7271 to
4f09559
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request integrates Buf linting for protobuf files, updates Bazel build files to use
08f58d0 to
c345143
Compare
c345143 to
26329ad
Compare
26329ad to
ff7de7a
Compare
ff7de7a to
b9e3435
Compare
8b8fbc7 to
e4b9803
Compare
b704614 to
b147bd1
Compare
b147bd1 to
b8d1571
Compare
b8d1571 to
1585f04
Compare
9d24eac to
1e93c68
Compare
1b72a67 to
6c754aa
Compare
6c754aa to
4b75d34
Compare
4b75d34 to
944f1d9
Compare
944f1d9 to
ff36160
Compare
AntonTyb
left a comment
There was a problem hiding this comment.
Multi-Specialist Review Summary (Round 1 · ff36160109)
- Convergence Verdict:
APPROVE_WITH_NON_BLOCKING_POLISH(S_1 = 2) - Inline Review Threads Opened:
0(Zero-ThreadAPPROVEpolicy:2non-blocking notes collapsed below so automated merge/Grain loops are not disrupted) - Scoped Human Review Lenses:
CONTROL_PLANE_CI_OR_LINTER_EDIT,FILE_COUNT_CAP_EXCEEDED
PR #1673 (ff36160109) cleanly enables //api:protos_lint_test via api/buf.yaml, expands buildifier from -warnings=unused-variable to -lint=warn in both .github/workflows/lint.yml and tools/lint/precommit_runner.py (with an OSS-compatible warning probe), fixes make-location and constant-glob warnings across oci.bzl and 13 BUILD.bazel files, and updates docs/design/topologies.md and docs/developer.md in sync. All 14 executed CI checks pass, prior bot threads are resolved/addressed, and Panels P1, P2, and P4 reported zero findings; Panel P3 identified two non-blocking Medium-severity unit test coverage gaps in tools/lint/precommit_gates_test.py and tools/lint/precommit_runner_test.py, while CONTROL_PLANE_CI_OR_LINTER_EDIT and FILE_COUNT_CAP_EXCEEDED (22 > 15 files) require scoped human review sign-off on the protected CI, linter, and api/buf.yaml policy changes.
Non-blocking polish & follow-up notes (2 items — no action required to merge)
C1 · [Medium · Non-Blocking] Lost default-mode coverage in test_git_ls_files and untested exec_cmd stdin_devnull=True (tools/lint/precommit_gates_test.py:102)
Editing test_git_ls_files_dedupes_and_handles_failure in place to pass include_untracked=True removes assertion coverage for the default include_untracked=False path (where --cached, --others, and --exclude-standard must be omitted for check_workflows, check_shell, and check_nonui_js in tools/lint/precommit_runner.py). In addition, the new stdin_devnull=True parameter on gates.exec_cmd (tools/lint/precommit_gates.py:115,127) has no direct unit test in test_exec_cmd_handles_real_subprocess_and_missing_binary.
Consider retaining a case for include_untracked=False (asserting --exclude-standard is absent) alongside include_untracked=True, and adding a stdin_devnull=True subprocess check in test_exec_cmd_handles_real_subprocess_and_missing_binary (e.g., verifying sys.stdin.read() returns "").
C2 · [Medium · Non-Blocking] Missing failure-path, empty-files, and fix-flag assertions in test_check_bazel_invokes_buildifier (tools/lint/precommit_runner_test.py:41)
check_bazel (tools/lint/precommit_runner.py:67-95) replaced gates.run_mode_command with direct gates.exec_cmd loops, an early if not files: return guard, and separate failure handling for -lint=fix (ctx.failed = True) and -lint=warn (ctx.fail(...)), but test_check_bazel_invokes_buildifier only tests returncode=0 happy paths.
Consider adding assertions/cases for:
exec_mock.call_args_list[1].args[0]containing"-lint=fix"and"-mode=fix"infixmode.- Non-zero exit codes from
buildifierin bothfixandcheckmodes settingctx.failed = True. - Empty
filesfromgit_ls_filesreturning early without callingexec_cmd.
ff36160 to
f6a40e9
Compare
There was a problem hiding this comment.
🤖 Incremental PR Approval
Clean rebase detected with zero semantic patch lines changed. PR touches protected files, but the approved patches are unchanged.
Preserving prior approval by @AntonTyb on commit ff36160.
There was a problem hiding this comment.
🤖 Incremental PR Approval
Clean rebase detected with zero semantic patch lines changed. PR touches protected files, but the approved patches are unchanged.
Preserving prior approval by @AntonTyb on commit ff36160.
AntonTyb
left a comment
There was a problem hiding this comment.
Multi-Specialist Review Summary (Round 2 · f6a40e9d25)
- Convergence Verdict:
APPROVE_CLEAN(S_2 = 0(down fromS_1 = 2,100%contraction)) - Inline Review Threads Opened:
0(Zero-ThreadAPPROVEpolicy:0non-blocking notes collapsed below so automated merge/Grain loops are not disrupted) - Scoped Human Review Lenses:
CONTROL_PLANE_CI_OR_LINTER_EDIT,FILE_COUNT_CAP_EXCEEDED
Round 2 at f6a40e9d25 is clean and ready to approve from a technical and rule-compliance standpoint: all three active specialist panels (P1, P2, P3) reported CLEAN with zero findings, the Round 2 delta (tools/lint/precommit_gates_test.py and tools/lint/precommit_runner_test.py) strengthens walk_repo_files, git_ls_files, Path.is_dir mocking, and _run_linter_phase test coverage, and all 14 CI checks pass. Across the full 22-file diff, //api:protos_lint_test (api/buf.yaml + api/BUILD.bazel), OSS/Google buildifier -lint=warn parity (.github/workflows/lint.yml + tools/lint/precommit_{gates,runner}.py), oci.bzl docstrings and $(execpath ...) / constant-glob fixes across BUILD.bazel files, doc updates (docs/design/topologies.md, docs/developer.md), and the 3-clause ## Assumptions section are accurate, with both prior gemini-code-assist threads resolved and verified. Because the PR triggers CONTROL_PLANE_CI_OR_LINTER_EDIT and FILE_COUNT_CAP_EXCEEDED (22 > 15 files) and modifies protected files under .github/scripts/approval-policy.js (.github/workflows/lint.yml, api/buf.yaml, api/BUILD.bazel), scoped human sign-off on those control-plane/protected surfaces is required before merge.
f6a40e9 to
0724e72
Compare
- Add `//api:protos_lint_test` (`buf_lint_test`) and `lint:` config (`STANDARD` with multi-directory package exceptions and descriptor-path `ignore_only` baseline) in `api/buf.yaml`. - Expand `buildifier` to `-lint=warn` in `tools/lint/precommit_runner.py` and `.github/workflows/lint.yml` with a runtime probe excluding Google-only `-LANG_proto_library-single-deps,-inline-deps` when supported, use `git ls-files` cleanly in `check_bazel`, fix `make-location` (`$(execpath)`) and `constant-glob` warnings across 9 `BUILD.bazel` files + `oci.bzl`, and add `oci.bzl` docstrings. - Replace dead `deploy/ctk_v1/README.md` link in `docs/design/topologies.md` and document `//api:protos_lint_test` and `buildifier -lint=warn` in `docs/developer.md`. TAG=agy CONV=ba8411ef-c093-4f45-950a-b3bc1899268c
18d68e0
0724e72 to
18d68e0
Compare
There was a problem hiding this comment.
🤖 Incremental PR Approval
Clean rebase detected with zero semantic patch lines changed. PR touches protected files, but the approved patches are unchanged.
Preserving prior approval by @AntonTyb on commit 0724e72.
AntonTyb
left a comment
There was a problem hiding this comment.
Multi-Specialist Review Summary (Round 3 · 18d68e07ac)
- Convergence Verdict:
APPROVE_CLEAN(S_3 = 0) - Inline Review Threads Opened:
0(Zero-ThreadAPPROVEpolicy:0non-blocking notes collapsed below so automated merge/Grain loops are not disrupted) - Scoped Human Review Lenses:
CONTROL_PLANE_CI_OR_LINTER_EDIT,FILE_COUNT_CAP_EXCEEDED
Round 3 (18d68e07ac) of PR #1673 (chore(lint): enable buf lint test, expand buildifier lint, and fix docs) was evaluated via the ARBITER_DIRECT_DELTA micro-delta fast path (P1–P4 specialist fan-out skipped because pr_1673_r3_delta.patch changes only go-version from '1.26.0' to '1.26.11' in .github/workflows/lint.yml). Direct Mode B verification against pr_1673_r3_delta.patch and head_files/ confirms zero FIX_REGRESSION, INCOMPLETE_PRIOR_FIX, or PR_INTRODUCED defects, both prior gemini-code-assist threads (api/buf.yaml and .githooks/pre-commit) are properly resolved and backed by head_files/ (api/buf.yaml lines 35–36 and tools/lint/precommit_gates.py line 181), the PR description's ## Assumptions section is complete, and all CI checks pass. Although the code is ready for APPROVE with no proposed comments, SCOPED_HUMAN_REVIEW_REQUIRED applies because the PR triggers the CONTROL_PLANE_CI_OR_LINTER_EDIT and FILE_COUNT_CAP_EXCEEDED (22 > 15 files) escape hatches and modifies protected files under .github/scripts/approval-policy.js.
Summary
Enable
//api:protos_lint_testviabuf_lint_test(api/buf.yaml), add docstrings and$(execpath ...)inoci.bzl, expandbuildifierfrom-warnings=unused-variableto-lint=warnintools/lint/precommit_runner.pyand CI (probing-warnings=-LANG_proto_library-single-deps,-inline-depsso both upstream OSSbuildifier v8.0.3and Google internalbuildifierpass cleanly), fix allmake-locationandconstant-globwarnings across activeBUILD.bazelfiles +oci.bzl, replace the removed Blueprint v1 link indocs/design/topologies.md, and syncdocs/developer.md.Motivation & Context
Enabling Buf protobuf lint (while leaving frozen
.protosources untouched), full Buildifier lint checks across Bazel files, and clean doc links prevents schema style drift and deprecated$(location)/constant-globBUILD bugs;docs/design/topologies.mdis updated alongside this check-enabling slice to purge an obsolete Blueprint v1 reference.Key Changes
Modified 22 file(s):
api/BUILD.bazel&api/buf.yaml: Add//api:protos_lint_test(buf_lint_test,error_format = "msvs"), updatebuf.yamlheader comment, and addlint:config (STANDARDminus 4 multi-directoryPACKAGE_*rules, descriptor-pathignore_onlylegacy baseline, and an inlineTODOtracking unusedstructured_message.protoimport cleanup inapi/protos/experiment/api.proto).tools/lint/precommit_gates.py,tools/lint/precommit_runner.py,tools/lint/precommit_runner_test.py, &.github/workflows/lint.yml: Addstdin_devnulltogates.exec_cmd, addinclude_untracked: bool = Falsetogates.git_ls_filesfor Bazel file discovery incheck_bazel(withgates.chunked(..., 500)batching), probe Google-only-LANG_proto_library-single-deps,-inline-depsexclusions for compatibility with CI OSSbuildifier v8.0.3, runbuildifier -lint=warnafterfix, and add unit tests covering both probe paths intest_check_bazel_invokes_buildifier.oci.bzl: Add module docstring andoci_image_for_serviceArgs:docstring, and switch$(location //tools/common:build_oci.py)to$(execpath //tools/common:build_oci.py)in the generated*_tarballgenrule (tarball_target).cmd/ui/BUILD.bazel,deploy/helm/BUILD.bazel,deploy/profiles/stable-2026a/components/{clickhouse,ingestion-gateway,redpanda}/BUILD.bazel,deploy/profiles/stable-2026b/components/{clickhouse,hpo,ingestion-gateway,redpanda,vizier}/BUILD.bazel,internal/storage/{postgres,spanner}/migrations/version/BUILD.bazel: Replace$(location ...)with$(execpath ...)and move explicit files (Chart.yaml,values.yaml,values-local.yaml,nginx.conf,generate_config.sh,karma.conf.js) out ofglob(...), dropping redundant"package-lock.json"already matched by"*.json".docs/design/topologies.md&docs/developer.md: Mark Blueprint v1 removed intopologies.md, and document//api:protos_lint_test,_PROTOScoverage (including//api/filter:filter_proto), andbuildifier -lint=warn -mode=checkindocs/developer.md.Assumptions
api/...and virtual-importxmanager_cloud/...) inapi/buf.yamlignore_onlymatches whatrules_buf'sbuf_lint_testfeeds toprotoc-gen-buf-lint—buf_lint_testpasses compiled descriptor names rather thanapi/-relative paths — running standalonebuf lintCLI directly againstapi/outside Bazel would mismatchignore_onlypaths without adjusting config.-warnings=-LANG_proto_library-single-deps,-inline-depsbefore passing-warnings=keeps CI (buildifier v8.0.3) and Google-internalbuildifiercompatible while retaining multi-depgo_proto_libraryrules (grpc-gatewaydeps) and DRY_KIND_3P_DEPSintest/e2e/BUILD.bazel— upstream OSSbuildtoolsrejects unrecognized-warnings=tokens whereas Googlebuildifierneeds them excluded — future default warnings added in newerbuildifierreleases could fail until addressed or suppressed, and unintended multi-depgo_proto_library/ deps-variable patterns are not flagged when excluded.//api:protos_lint_testtargets explicitly in_PROTOS(api/BUILD.bazel) covers active repository.protodefinitions exceptcloud_xmanager_v1_proto(excluded by design as a source-duplicate wrapper) —_PROTOSfeeds bothprotos_breaking_testand CI uncovered-proto verification — any newproto_libraryadded under//apiskips lint until added to_PROTOS.Chart.yaml,values.yaml,values-local.yaml,nginx.conf,generate_config.sh,karma.conf.js) out ofglob(...)requires checked-in inputs to remain present —glob(...)would silently omit accidentally deleted files — deleting or renaming any of those files will now fail Bazel loading loudly until the correspondingBUILD.bazellist is updated.Verification & Testing
./.githooks/pre-commit --check&./.githooks/pre-commiton#1673commit (Buildifier-lint=warn, Ruff, Mypy,helm lint,test/helm88 tests, Trivy, and Bazel tests),bazel build //deploy/profiles/stable-2026b/...,python3 tools/analyze_diff_size.py --base-ref chore/harden-ui-eslint-and-typecheck, andbazel test --test_output=errors //tools/lint:precommit_gates_test //tools/lint:precommit_runner_test //api:protos_lint_test.//api:protos_lint_test,//api:protos_breaking_test,//tools/lint:all,//deploy/profiles/stable-2026b/...(8targets), Buildifier-lint=warn,test/helm(88tests),test/helm/profiles/stable2026b:stable2026b_test, and321/321backend Bazel tests on#1673(149prod lines /41test lines,threshold_exceeded: false) passed locally. Upstream OSSbuildifier v8.0.3verified in CICode Quality & Linting.Related Issues / Bugs
N/A (tracked pre-existing unused
structured_message.protoimport inapi/protos/experiment/api.protovia inlineTODOinapi/buf.yaml).TAG=agy
CONV=ba8411ef-c093-4f45-950a-b3bc1899268c