Skip to content

feat(code-tidying): stop new comments with a lint on added lines - #16297

Merged
kyle-sexton merged 12 commits into
mainfrom
feat/code-tidying-comment-lint
Nov 15, 2026
Merged

kyle-sexton merged 12 commits into
mainfrom
feat/code-tidying-comment-lint

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: #15647

Summary

Problem: issue 15647 asked for a no-comments posture, a default and a way to stop new comments, and none of it was locked. Intent: "That way, we're staged. We have all the tools, and then, going forward through PR reviews and additional changes, we'll slowly be removing these comments."

This pull request ships the comment lint, the posture settings and the review wiring, and sets the lint to report here. Turning the commit-time hook on in this repository is a second pull request.

Fix

  • code-tidying ships comment-lint, a language-agnostic git-hook entry that judges the comment lines a change adds through the pygments token stream and names the fix for each one outside the posture. Settings, team file only: comment_lint: off | report | block (default off) and comment_lint_allow.
  • scripts/check-comment-lint.sh runs the same entry in CI Status, reading the level, posture and allow list from the merge base, so a branch cannot lower its own level.
  • This repository pins comment_posture: necessary, comment_edit_scope: files and comment_lint: report in docs/conventions/code-tidying.yaml.
  • /code-tidying:remove-comments takes --base <ref> and keeps the version comment on an action pinned to a commit id; /code-tidying:tidy reads the posture.
  • Plans and worker briefs name the repository's review-criteria files, so an agent has the comment rule before it writes code.
  • ADR 0108 records the decision: new comments are stopped by a lint on added lines and by review, not by a count.

Reach: with comment_lint unset the entry exits silent, so consumers see no change until they set it. Here the CI step prints findings and passes. Undo: remove comment_lint from the convention file.

Verification

  • Judge, entry and gate tests: test_comment_lint.py ran 63 tests OK; comment-lint.test.sh printed 45 passed, 0 failed; scripts/check-comment-lint.test.sh printed all checks passed (14 cases).
  • Dry run over the added lines of 50 merged pull requests, after a control with one planted comment reported exactly that line: 631 findings, each read, no false positive; re-runs over the same 50 commits after each later change to the judge changed none. The table is in ADR 0108.
  • The judge over this branch's own added lines printed no finding.
  • Security review and code-design review ran locally; their findings are fixed in the last commit.
  • Left out: a CI run before this pull request; the Phase 4 eval fixtures' comment-only proof, because tree-sitter is not installed on this machine.

Related

Acceptance criteria

  • AC1: docs/conventions/code-tidying.yaml holds comment_posture: necessary and comment_edit_scope: files and passes its schema.
  • AC2: with the lint on, a commit or pull request that adds a comment outside the allowed shapes fails with a message naming the fix; one that adds an allowed shape passes; the same command runs at commit time and in CI; with the lint off, nothing changes.
  • AC3: under necessary and none, the comment pass keeps the version comment on a pinned action.
  • AC4: a planning or implementing agent in this repository is given the comment posture before it writes code.
  • AC5: under necessary, /code-tidying:tidy adds no comment outside the keep list; under explanatory it is unchanged.
  • AC6: docs/upstream/cursor-pstack.md states the three floor differences; the owner's user-scope plugin options hold comment_posture: necessary.
  • AC7: the playbook's smallest-change clause says the smallest change removes the cause, in its own pull request with no issue, and the upstream record no longer lists issue 15837 as pending.
  • AC8: issue 15647's body matches this contract, and one decision record exists for "new comments are stopped by a lint on added lines and by review, not by a count gate".

Remaining

  • The commit-time hook is on in this repository (second pull request). It needs Python 3 with pygments on each machine that commits.

🤖 Generated with Claude Code

kyle-sexton and others added 10 commits November 14, 2026 21:30
…n root

The reader moves to scripts/comment-settings.sh so a git-hook entry and
/code-tidying:tidy can read the comment posture without opening another
skill's directory; skills/remove-comments/scripts/settings.sh stays as the
skill-local entry point. It gains the team-only comment_lint level and a
--list mode for comment_lint_allow, finds its lib beside itself in an
installed hook copy, and starts child scripts with the running bash.

Refs: #15647

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfc5AyfmgUPS3tiv2d
/planning:plan lists each review-criteria file the plan's paths match in
its Standards grounding table, and /implementation:implement-dispatch
carries them in each brief as a Review criteria line, so an author reads
the rule before the first edit.

Pull-request prep hands the comment pass the base ref only
(--pipeline --base), leaving the granularity to the comment pass's own
comment_edit_scope; session-flow's pre-PR text no longer fixes the scope
to added comments.

Refs: #15647

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfc5AyfmgUPS3tiv2d
…he posture

/code-tidying:remove-comments takes --base <ref>: the scope is the
branch's changed code files against the merge base, through
scope-code-files.sh --branch-only, which never widens to the repository,
and comment_edit_scope sets the granularity. The floor keeps the comment
trailing a uses: line pinned to a full commit id.

/code-tidying:tidy resolves comment_posture through its own entry point
to the shared settings reader: under necessary it adds only a comment the
keep list keeps, under none it adds none, and explanatory is unchanged.

Refs: #15647

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfc5AyfmgUPS3tiv2d
comment-lint judges the comment lines a change adds against the comment
posture, through the pygments token stream the census uses: a comment
outside the allowed shapes (directives, license cues, TODO(#issue), a
pinned uses: line's trailer, doc comments, a linked note, an ignore
marker, or a comment_lint_allow pattern) is a finding that names the
fix. comment_lint sets the level (off by default, report, block); under
explanatory it does not run.

The entry registers under the check-placement contract: manifest,
vendored installer and check lib, a lefthook remote config, setup's
install action and the session drift probe. A python3 that cannot import
pygments follows the missing-tool rule under the name pygments.

sh-entries.test.sh now scans every entry's shell assets for a bash
command and for syntax newer than bash 3.2, and reads every plugin's
lefthook remote config.

Refs: #15647

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfc5AyfmgUPS3tiv2d
…nts in CI

This repository sets comment_posture: necessary, comment_edit_scope: files
and comment_lint: report, with allow patterns for the test-scope header.
CI runs the comment lint over a pull request's whole diff through
scripts/check-comment-lint.sh, which reads the level, posture and allow
list from the merge base so a branch cannot lower its own level.

ADR 0108 records that new comments are stopped by a lint on added lines
and by review, not by a count, with the dry run over the last 50 merged
pull requests: 631 findings, no false positive. The review rule and the
upstream record say how the lint and the floor differ from her agent.

Refs: #15647

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmfc5AyfmgUPS3tiv2d
The judge ends a comment run at a blank line, keeps a license header
across blank-separated paragraphs, passes Go doc comments on grouped
and member declarations, reads .mts and .cts as TypeScript, ignores a
PowerShell # inside a word, and narrows the global and modeline
directives. The CI gate takes the base's team file and refuses a head
that is no commit id.

ADR 0108 records that a second dry run over the same 50 commits
changed no finding.

Refs: #15647
Co-authored-by: Claude Fable 5.2 <[email protected]>
…c bits

Two case statements had no default branch, one test printed a backtick
from single quotes, and two fixtures that start with a shebang were
mode 100644.

Refs: #15647
Co-authored-by: Claude Fable 5.2 <[email protected]>
The plugin contract validator refuses < or > in a skill description.

Refs: #15647
Co-authored-by: Claude Fable 5.2 <[email protected]>
Inside one block comment a blank or bare-star line did not end the
run, so one link passed every paragraph of prose in the block. The
link rule now reads the paragraph the line sits in. The dry run over
the same 50 commits is unchanged at 631 findings.

Refs: #15647
Co-authored-by: Claude Fable 5.2 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 15, 2026 05:28
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T05:32:45.459179Z 6acc48d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6acc48d1a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check-comment-lint.sh Resolved
The comment lint's CI gate resolved the convention home in the head
worktree, so a branch that renamed the base's home directory fell back
to docs/conventions and the lint read as unset. The gate now resolves
the home at the merge base.

The test-lane planner gives lefthook to every plugin's lefthook-remote
suite, not only the guardrails one, so the code-tidying suite's
end-to-end cases run on whatever leg they land.

Refs: #15647
Co-authored-by: Claude Fable 5.2 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 43681266472

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/apply-patch
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 43681266472

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 890d57e4b40c6f27aae90f031166a9b8cd1618ef: read 5 of 5 changed file(s); 0 finding(s), 0 as inline comments.

Security review: incremental, d3ddd6b..890d57e

No security issues found.

This lane already reviewed an earlier head, so this review was blocking only: it reports only CRITICAL and IMPORTANT findings.

I read every hunk of all 5 files in scope.

  • plugins/code-tidying/git-hooks/comment-lint.sh: when the lint skips a file because it is generated, it now names that file on stderr. The path comes from checks_files (git output) and is passed to printf as a %s argument, never as the format string, so it cannot inject format directives. The skip rule itself (generated → continue) is unchanged. This is a local hook and a lint gate, not a merge hold or trust control.
  • plugins/code-tidying/git-hooks/comment-lint.test.sh: the test now also checks the new stderr line. Test only.
  • plugins/code-tidying/scripts/scope-code-files.sh: git ls-files --others --exclude-standard --full-name -z -- ':/' now lists untracked files from the repository root, not just the current directory. The list is still NUL-delimited, still filtered by code_only, and gitignored files are still excluded, so no new input class reaches the script.
  • plugins/code-tidying/scripts/scope-code-files.test.sh: adds fixtures in subdirectories. The cleanup now uses rm -rf with ${bo:?} guards, so an empty variable cannot delete from /. Test only.
  • plugins/session-flow/skills/workflow/context/pre-pr.md: the comment-pass step now passes --base <remote>/<base-branch>. This narrows what the pass covers and removes no rule. The instruction-surface lens finds nothing deleted or softened.

Notes

  • Manifests: none of the files in scope is a plugin.json or marketplace.json.
  • Trust controls: none of the files in scope matches a trusted-path glob or touches a trust control.
  • Prior findings: the one prior entry is the earlier review's summary comment, which reported 0 findings, so there is nothing to carry forward.
  • Settled threads: no settled thread applies to these lines.
  • Spend: none.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 3 inline finding(s) on d3ddd6ba7c3a55d3cc1bdc2d585edfbeb565220a; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 890d57e4b40c6f27aae90f031166a9b8cd1618ef: read 5 of 5 changed file(s); 0 finding(s), 0 as inline comments.

claude-review: incremental review of d3ddd6ba..890d57e4. Read 5 of 5 changed files, all hunks. Blocking-only review, because this lane already reviewed an earlier head.

No findings.

The push fixes all three findings this lane posted on d3ddd6ba:

  • comment-lint.sh names each skipped file. It now prints one stderr line for each file it skips because of a generated marker. The check() helper in comment-lint.test.sh captures stderr exactly (2>&1 >/dev/null), so the three marker cases now assert that line. No other test in the entry, CI-gate or sh-entries suites stages a marked file and expects empty stderr. Not changed: the marker is still honoured on a line the change adds. The owner settled that as a design decision in the resolved thread, so it is not raised again.
  • scope-code-files.sh lists untracked files from the repository root. --branch-only now uses git ls-files --others --exclude-standard --full-name -z -- ':/', so both halves of the list are root-relative and cover the whole repository. The new test runs from src/ and asserts both src/inner.ts and lib/other.ts. Its rm -rf cleanup is guarded with ${bo:?}, and nothing else in the fixture repo tracks src/ or lib/.
  • pre-pr.md step 4 is scoped. It now passes --pipeline --base <remote>/<base-branch>, the same scope as prep.md.

Not reproduced: the author's test results. This lane has no shell.

Verifier dropped 0 of 0 candidates.

…les from the root

The comment lint names each file it skips for a generated marker, so
a skip shows at commit time and in the CI log. scope-code-files.sh
--branch-only lists untracked files root-relative across the whole
repository, as its diff half does. The pre-PR sequence runs the
comment pass with --base, the scope prep uses.

Refs: #15647
Co-authored-by: Claude Fable 5.2 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 3c3f44f Nov 15, 2026
79 checks passed
@kyle-sexton
kyle-sexton deleted the feat/code-tidying-comment-lint branch November 15, 2026 06:39
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant