Skip to content

chore(lint): enable buf lint test, expand buildifier lint, and fix docs - #1673

Merged
VLukiantsev merged 2 commits into
chore/harden-ui-eslint-and-typecheckfrom
chore/enable-buf-lint-and-fix-bzl-docs
Nov 19, 2026
Merged

VLukiantsev merged 2 commits into
chore/harden-ui-eslint-and-typecheckfrom
chore/enable-buf-lint-and-fix-bzl-docs

Conversation

@VLukiantsev

@VLukiantsev VLukiantsev commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Enable //api:protos_lint_test via buf_lint_test (api/buf.yaml), add docstrings and $(execpath ...) in oci.bzl, expand buildifier from -warnings=unused-variable to -lint=warn in tools/lint/precommit_runner.py and CI (probing -warnings=-LANG_proto_library-single-deps,-inline-deps so both upstream OSS buildifier v8.0.3 and Google internal buildifier pass cleanly), fix all make-location and constant-glob warnings across active BUILD.bazel files + oci.bzl, replace the removed Blueprint v1 link in docs/design/topologies.md, and sync docs/developer.md.

Motivation & Context

Enabling Buf protobuf lint (while leaving frozen .proto sources untouched), full Buildifier lint checks across Bazel files, and clean doc links prevents schema style drift and deprecated $(location)/constant-glob BUILD bugs; docs/design/topologies.md is 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"), update buf.yaml header comment, and add lint: config (STANDARD minus 4 multi-directory PACKAGE_* rules, descriptor-path ignore_only legacy baseline, and an inline TODO tracking unused structured_message.proto import cleanup in api/protos/experiment/api.proto).
  • tools/lint/precommit_gates.py, tools/lint/precommit_runner.py, tools/lint/precommit_runner_test.py, & .github/workflows/lint.yml: Add stdin_devnull to gates.exec_cmd, add include_untracked: bool = False to gates.git_ls_files for Bazel file discovery in check_bazel (with gates.chunked(..., 500) batching), probe Google-only -LANG_proto_library-single-deps,-inline-deps exclusions for compatibility with CI OSS buildifier v8.0.3, run buildifier -lint=warn after fix, and add unit tests covering both probe paths in test_check_bazel_invokes_buildifier.
  • oci.bzl: Add module docstring and oci_image_for_service Args: docstring, and switch $(location //tools/common:build_oci.py) to $(execpath //tools/common:build_oci.py) in the generated *_tarball genrule (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 of glob(...), dropping redundant "package-lock.json" already matched by "*.json".
  • docs/design/topologies.md & docs/developer.md: Mark Blueprint v1 removed in topologies.md, and document //api:protos_lint_test, _PROTOS coverage (including //api/filter:filter_proto), and buildifier -lint=warn -mode=check in docs/developer.md.

Assumptions

  • Using descriptor-set paths (api/... and virtual-import xmanager_cloud/...) in api/buf.yaml ignore_only matches what rules_buf's buf_lint_test feeds to protoc-gen-buf-lint — buf_lint_test passes compiled descriptor names rather than api/-relative paths — running standalone buf lint CLI directly against api/ outside Bazel would mismatch ignore_only paths without adjusting config.
  • Probing -warnings=-LANG_proto_library-single-deps,-inline-deps before passing -warnings= keeps CI (buildifier v8.0.3) and Google-internal buildifier compatible while retaining multi-dep go_proto_library rules (grpc-gateway deps) and DRY _KIND_3P_DEPS in test/e2e/BUILD.bazel — upstream OSS buildtools rejects unrecognized -warnings= tokens whereas Google buildifier needs them excluded — future default warnings added in newer buildifier releases could fail until addressed or suppressed, and unintended multi-dep go_proto_library / deps-variable patterns are not flagged when excluded.
  • Listing //api:protos_lint_test targets explicitly in _PROTOS (api/BUILD.bazel) covers active repository .proto definitions except cloud_xmanager_v1_proto (excluded by design as a source-duplicate wrapper) — _PROTOS feeds both protos_breaking_test and CI uncovered-proto verification — any new proto_library added under //api skips lint until added to _PROTOS.
  • Moving explicit filenames (Chart.yaml, values.yaml, values-local.yaml, nginx.conf, generate_config.sh, karma.conf.js) out of glob(...) 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 corresponding BUILD.bazel list is updated.

Verification & Testing

  • Commands Executed:
    • ./.githooks/pre-commit --check & ./.githooks/pre-commit on #1673 commit (Buildifier -lint=warn, Ruff, Mypy, helm lint, test/helm 88 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, and bazel test --test_output=errors //tools/lint:precommit_gates_test //tools/lint:precommit_runner_test //api:protos_lint_test.
  • Coverage & Test Status:
    • //api:protos_lint_test, //api:protos_breaking_test, //tools/lint:all, //deploy/profiles/stable-2026b/... (8 targets), Buildifier -lint=warn, test/helm (88 tests), test/helm/profiles/stable2026b:stable2026b_test, and 321/321 backend Bazel tests on #1673 (149 prod lines / 41 test lines, threshold_exceeded: false) passed locally. Upstream OSS buildifier v8.0.3 verified in CI Code Quality & Linting.

Related Issues / Bugs

N/A (tracked pre-existing unused structured_message.proto import in api/protos/experiment/api.proto via inline TODO in api/buf.yaml).

TAG=agy
CONV=ba8411ef-c093-4f45-950a-b3bc1899268c

@VLukiantsev
VLukiantsev added this pull request to stack #1675 November 12, 2026 19:46

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread api/buf.yaml Resolved
@VLukiantsev VLukiantsev changed the title chore: enable buf lint test, full buildifier lint, and fix topologies link chore(lint): enable buf lint test, expand buildifier lint, and fix docs Nov 13, 2026
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch from 3bf7271 to 4f09559 Compare November 13, 2026 00:48
@VLukiantsev

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates Buf linting for protobuf files, updates Bazel build files to use $(execpath) instead of $(location), refactors Helm chart filegroups, and removes legacy Cluster Toolkit Blueprint v1 documentation. The pre-commit hook is also updated to use git ls-files for finding Bazel files. A review comment suggests ensuring that files gathered in the pre-commit hook actually exist on disk using a file existence check rather than just a non-empty string check, preventing potential failures with deleted but unstaged files.

Comment thread .githooks/pre-commit Resolved
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch 2 times, most recently from 08f58d0 to c345143 Compare November 13, 2026 09:19
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch from c345143 to 26329ad Compare November 13, 2026 10:14
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch from 26329ad to ff7de7a Compare November 13, 2026 10:56
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch from ff7de7a to b9e3435 Compare November 13, 2026 11:58
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch 2 times, most recently from 8b8fbc7 to e4b9803 Compare November 13, 2026 13:16
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch 2 times, most recently from b704614 to b147bd1 Compare November 13, 2026 14:58
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch from b147bd1 to b8d1571 Compare November 16, 2026 08:37
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch from b8d1571 to 1585f04 Compare November 16, 2026 09:17
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch from 9d24eac to 1e93c68 Compare November 16, 2026 20:13
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch 2 times, most recently from 1b72a67 to 6c754aa Compare November 17, 2026 11:58
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch from 6c754aa to 4b75d34 Compare November 17, 2026 13:17
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch from 4b75d34 to 944f1d9 Compare November 17, 2026 14:09
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch from 944f1d9 to ff36160 Compare November 18, 2026 17:27
AntonTyb
AntonTyb previously approved these changes Nov 18, 2026

@AntonTyb AntonTyb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multi-Specialist Review Summary (Round 1 · ff36160109)

  • Convergence Verdict: APPROVE_WITH_NON_BLOCKING_POLISH (S_1 = 2)
  • Inline Review Threads Opened: 0 (Zero-Thread APPROVE policy: 2 non-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:

  1. exec_mock.call_args_list[1].args[0] containing "-lint=fix" and "-mode=fix" in fix mode.
  2. Non-zero exit codes from buildifier in both fix and check modes setting ctx.failed = True.
  3. Empty files from git_ls_files returning early without calling exec_cmd.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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.

github-actions[bot]
github-actions Bot previously approved these changes Nov 19, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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
AntonTyb previously approved these changes Nov 19, 2026

@AntonTyb AntonTyb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multi-Specialist Review Summary (Round 2 · f6a40e9d25)

  • Convergence Verdict: APPROVE_CLEAN (S_2 = 0 (down from S_1 = 2, 100% contraction))
  • Inline Review Threads Opened: 0 (Zero-Thread APPROVE policy: 0 non-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.

@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch from f6a40e9 to 0724e72 Compare November 19, 2026 13:00
- 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
@VLukiantsev
VLukiantsev force-pushed the chore/enable-buf-lint-and-fix-bzl-docs branch from 0724e72 to 18d68e0 Compare November 19, 2026 13:59

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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 AntonTyb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multi-Specialist Review Summary (Round 3 · 18d68e07ac)

  • Convergence Verdict: APPROVE_CLEAN (S_3 = 0)
  • Inline Review Threads Opened: 0 (Zero-Thread APPROVE policy: 0 non-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.

@VLukiantsev
VLukiantsev added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 065416f Nov 19, 2026
25 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants