Repository navigation
agents: no comments unless needed, plus comment budget guard - #14764
Conversation
AGENTS.md now says no comments by default in every language, keeping only what tools read and at most one short line where code cannot say it. //tools/ci:comment_budget_test counts comment lines that are not exempt in Rust, Go, Starlark, Python, shell, JS/TS, C++ and YAML sources, per top-level directory, and fails when a directory goes over the budget in tools/ci/comment_budget.txt, naming the files that grew. The snapshot repo rule gains other_code.json for the non-Rust, non-Starlark sources. No issue: owner request to drop comments repo-wide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xut2hxcqqAoDeuSr83mscS
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xut2hxcqqAoDeuSr83mscS
|
Review: changes requested The test fails only when a directory's total grows. It never asks for an exact match, so the sweep PRs #14758–#14763 will not trip it. It has no unwrap, panic, unsafe, network use or tags, and its output is deterministic (BTreeMap). These need fixing:
Minor: 🤖 Generated with Claude Code |
comment_budget_test now checks each file against its own budget. An unlisted file has a budget of 0. A file under its budget passes and prints a note naming //tools/ci:comment_budget_update, which rewrites comment_budget.txt to the lower of budget and current count and drops zero lines. fixture/ and *_fixture(s)/ directories are skipped like fixtures/ and testdata/. AGENTS.md keeps the comment rule short with the exceptions as a list, drops the old "Three exceptions only" line and limits the "one line on what a thing does" sentence to docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xut2hxcqqAoDeuSr83mscS
|
Addressed the review in a64f019:
Not done: the minor 🤖 Generated with Claude Code |
|
Review: changes requested The three earlier code findings are fixed at a64f019:
The non-test Rust has no Still open in AGENTS.md:
Nothing else in AGENTS.md or docs/AGENTS.md conflicts with the rule. The 🤖 Generated with Claude Code |
…sed lines AGENTS.md drops the platform-quirk allowance, since budgets only shrink, and puts the rule on two lines plus one exceptions line. The budget test now skips `# Why:` and `# Upstream:` lines, which tools parse, and its failure message says to delete the comment and never raise a budget. comment_budget.txt is lowered to match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xut2hxcqqAoDeuSr83mscS
|
Addressed the re-review in 53df380:
🤖 Generated with Claude Code |
|
Review: approve Both requested changes are in at 53df380:
Exemptions ( Non-blocking:
🤖 Generated with Claude Code |
Part of #14766
Linked Issue
No issue: owner request to drop comments repo-wide; the sweep PRs delete the comments, this one sets the rule and the guard.
Changes
AGENTS.md: the Comments bullet is now "none by default, in every language", including Rust//////!and Go doc comments. It keeps only what tools read: one-line Starlark docstrings, clap///help,// SAFETY:, lint/format/gazelle directives,LCOV_EXCL_*,# floor:, Actions pin comments, license headers and shebangs. Where code truly cannot say it, at most one short line is allowed. The rules on issue numbers, links andSee:chains, onprose_rules_test, and on assigned strings stay. No other doc stated the old rule (I checked docs/AGENTS.md, CONTRIBUTING.md, .claude/ and the prose rules).//tools/ci:comment_budget_test(tools/ci/comment_budget_test.rs)://inside a string is not counted.//, and skipped/generated files.tools/ci/comment_budget.txt: per-file budgets at main 73bbcc2 (19531 lines). Top directories: cli 7146, tools 4404, core 3076, deploy 1585, gazelle 1561.tools/ci/repos.bzl: the@dx_test_tags_sourcessnapshot also writesother_code.json(go, py, sh, js, mjs, ts, cc, h, yml, yaml).Verification
tools/dx test //tools/ci:comment_budget_test //tools/ci:host_env_test: comment_budget_test passed (8/8). host_env_test failed 14/15; all 4 of its problems are in files this PR doesn't touch (.bazelrc,cli/prebuilt/bundle.bzl,haskell/private/toolchain/repos.bzl,julia/private/runtime/julia_src.BUILD.bazel).tools/ci/repos.bzl not-reproducible 1matches its allowlist line. unreferenced_files reportstools/ci/BUILD.bazel orphan-target 1from filegroups that already exist on main; this diff adds no filegroup or exports_files.tools/dx check --affected: widened to//...because repos.bzl feeds a module extension. Its generate phase reported drift in 37 BUILD files and 4 stale locks, all outside this diff. The Bazel server then crashed withjava.lang.OutOfMemoryError: Java heap spaceon the//...build. Scoped instead:tools/dx check --apply //tools/ci:comment_budget_testpassed generate, format, lint and typecheck (the rustfmt fix is the second commit), and comment_budget_test passed 8/8 again after it.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xut2hxcqqAoDeuSr83mscS