Skip to content

feat(code-tidying): add comment_lint_exclude path globs to the comment lint - #18811

Merged
kyle-sexton merged 3 commits into
mainfrom
feat/code-tidying-comment-lint-exclude
Nov 24, 2026
Merged

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

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: #14293

Owner decision: Q156 option (1), a path-scoped comment-lint exclusion for the vendored credential-legs fixture (owner, in session 2026-11-24T15:15:05Z, verbatim: "Go with recommendations. I'm fine with lint exclusions, but those need to be heavily justified, and they should be far and few between."; recorded in the org's architecture repository, melodic-software/architecture#232, and quoted on #14293).

Summary

The comment lint gains comment_lint_exclude, a team-file list of repository-relative path globs it skips. This repository sets one entry: the directory of ci-workflows contract files that PR #18710 vendors byte-identical to a pinned commit so the credential-legs test runs offline. It ships on its own because the pre-commit hook runs main's lint and CI restores code-tidying.yaml from the merge base (scripts/check-comment-lint.sh:13-19), so the setting and its entry must be on main before #18710's fixture can land.

Fix

  • plugins/code-tidying/git-hooks/comment-lint.sh: a file whose repository path matches an exclude glob is skipped before its text is read, with code-tidying: comment lint skipped <path> (comment_lint_exclude: <glob>) on stderr. Globs follow git's :(glob) pathspec: * and ? stay within one segment, **/ matches zero or more segments, every other character is literal, and the glob must match the whole path.
  • plugins/code-tidying/scripts/comment-settings.sh: comment_lint_exclude joins LIST_KEYS and is read with --list, the path comment_lint_allow already takes; team file only, so a personal override cannot exclude files.
  • Schema, README settings table, setup skill and the config-cascade contract row document the key. The plugin ships no entries.
  • docs/conventions/code-tidying.yaml: one entry, .github/scripts/pr-unblock/fixtures/ci-workflows-394af27bda4bda2e02e0ef0691eacd120389108f/**, with its justification and the owner's words beside it.
  • .changes/code-tidying/: a bump: minor fragment.

Loosened checks

  • Comment lint, one directory. The comment lint no longer judges files under .github/scripts/pr-unblock/fixtures/ci-workflows-394af27bda4bda2e02e0ef0691eacd120389108f/. Why: those files are ci-workflows' select-model-credential contract, kept byte-identical to commit 394af27bda so the credential-legs suite runs without a network fetch (the fetch's HTTP 403s ejected merge-group runs, Find why the merge queue keeps ejecting groups #14293); their comments are upstream's, not ours, and editing them would break the byte identity the test's provenance check relies on. The lint has no other path-scoped way to skip them: comment_lint_allow matches comment text in every file, and a generated marker would change the vendored bytes. The owner approved this exclusion (Q156) with the condition that exclusions be heavily justified and rare; this is the only entry.

Verification

  • bash plugins/code-tidying/git-hooks/comment-lint.test.sh: 68 passed, 0 failed. Six new cases: an excluded file is skipped with the notice and a sibling outside the glob is still judged; * and ? do not cross /; **/ matches zero segments and . is literal; unset and empty settings judge every file; a personal override's list is not read.
  • bash plugins/code-tidying/scripts/comment-settings.test.sh: all checks pass, including the team-file-only read of the exclude list.
  • scripts/check-comment-lint.test.sh 15 ok; scripts/check-affected-comment-lint.test.sh 7 passed; lefthook-remote.test.sh 24 passed.
  • scripts/check-convention-yaml.sh --check: 21 files validate. sync-config-cascade-semantics.py --check: up to date. check-changelog-fragments.sh --check: all fragments valid.
  • scripts/selection-audit.sh trace --strict on comment-lint.test.sh: no gap.

Remaining

Related

🤖 Generated with Claude Code

…t lint

The comment lint gains comment_lint_exclude, a team-file list of
repository-relative path globs it skips, each skip named on stderr. * and ?
stay within one path segment, ** spans segments, every other character is
literal. It is read through comment-settings.sh --list, the path
comment_lint_allow already takes, and the plugin ships no entries.

This repository sets one entry, the directory of ci-workflows contract files
vendored byte-identical to a pinned commit for the offline credential-legs
test, whose comments are upstream's (owner decision Q156).

Refs: #14293

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 24, 2026 15:38
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 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-24T15:43:39.859511Z ec49317 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.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 88c55f3443bb8ad4583ce292e1392d91ba5be2a1: read 10 of 10 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #18811, path globs for the comment lint (comment_lint_exclude)

No security issues found. This lane already reviewed an earlier head (9f04d0dd), so this pass reported only blocking findings (CRITICAL or IMPORTANT). I read every hunk of all 10 changed files in the full diff. The new head merges main into the branch. Apart from that merge, the only new change is a prose rewording in docs/contracts/config-cascade/README.md: a sentence split and "→" replaced by "becomes". It changes no rule.

What I checked

  • Glob-to-regex conversion. glob_ere in comment-lint.sh#L106-L128 converts each glob as follows:

    • **/, **, * and ? become fixed regex fragments.
    • Letters, digits, /, _ and - are copied unchanged.
    • \ and ^ are escaped.
    • Every other character becomes a one-character bracket expression ([.], []], [[]).
    • The whole pattern is anchored with ^…$.

    A glob therefore cannot inject regex syntax. It is matched only with [[ =~ ]] and never reaches eval or a shell command.

  • Who can set the list. Only the team file sets it: comment_lint_exclude was added to LIST_KEYS and is read with --list (comment-settings.sh#L10). A personal override's list is not read, and new tests cover that case.

  • Can a branch exempt its own files in CI? No. The CI gate restores code-tidying.yaml from the merge base, so the new entry in docs/conventions/code-tidying.yaml takes effect only after merge.

  • Trust controls. This change touches none of them: no trusted-actor check, token scope, kill switch, merge hold or isolation control. The comment lint is a style gate on comment text. Skipping it for one directory of vendored fixtures exposes no token or secret, opens no path to compromising the owner's accounts or machines, and cannot cause a charge.

  • Trusted paths. No changed file matches the TRUSTED PATHS list.

  • Instruction surfaces. skills/setup/SKILL.md gains one clause about listing the exclude globs. The config-cascade change is a rewording. No rule is deleted, narrowed or softened.

  • Plugin manifests. No plugin.json or marketplace.json is changed.

  • PR context. It contains no text addressed to this review.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 88c55f3443bb8ad4583ce292e1392d91ba5be2a1: read 10 of 10 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no blocking findings (blocking only)

This lane already reviewed an earlier head (9f04d0dd), so this pass reports blocking findings only. The new head is a merge from main. The PR's diff still covers the same 10 files, and I read every hunk of each.

The PR adds comment_lint_exclude to the code-tidying comment lint. It is a list of repository-relative path globs read from the team file only. This repository's convention file gets one entry, for the vendored ci-workflows fixture directory.

What I checked (by reading the code; nothing was run)

  • --list gate. comment-settings.sh accepts --list only for keys in LIST_KEYS (comment-settings.sh:61). It reads only $TEAM (L134-L141), so a personal override cannot add an exclusion. If the team file does not parse, the list comes back empty and every file is still judged. That fails closed.

  • Glob to ERE. glob_ere (comment-lint.sh:106-129) anchors the result with ^…$.

    • **/ becomes (.*/)?, a bare ** becomes .*, * becomes [^/]* and ? becomes [^/].
    • \ and ^ are backslash-escaped, and every other punctuation character becomes a one-character bracket expression.
    • The =~ right-hand side is an unquoted expansion, so bash treats it as a regex as intended.
  • Skip order. The exclude check runs after the extension filter and before checks_file_text. That matches the PR body.

  • Tests. The new cases cover:

    • a skipped file and a sibling outside the glob that is still judged;
    • * and ? not crossing /;
    • **/ matching zero segments, and . being literal;
    • an unset or empty list judging every file;
    • a personal override's list not being read.

    The pass counts in the PR body are the author's claim; I did not verify them.

  • Docs. The schema, README table, setup skill, --help text and config-cascade row describe the key consistently.

  • Changelog fragment. bump: minor fits an added, backward-compatible setting. No plugin.json or marketplace.json changed, so the manifest checks did not apply.

  • Closing issue. None: the PR only says Refs: #14293, so there are no acceptance criteria to check.

  • Paid usage. None.

Loosened checks

The new entry in docs/conventions/code-tidying.yaml loosens the comment lint, an ordinary lint check. It is kind 4 (an ignore entry added) and kind 9 (the check's settings now accept more). It passes.

  • The PR body's ## Loosened checks section names the loosening and gives a reason that holds: the files are upstream contract files kept byte-identical for an offline test.
  • The entry covers exactly that one directory, pinned to one commit, and has a justification comment beside it.
  • The plugin itself ships no entries, so its default accepts nothing new.
  • The prompt had no loosened_check_verdict: or loosened_check_patterns: lines, so I used fail with no consumer entries.
  • There was no loosened_check_decision_record: line either, so I did not check the citation requirement.

Loosened checks would be marked: fail (plugin default; no wrapper-supplied layers); patterns: 0

Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit 62098c5 Nov 24, 2026
48 checks passed
@kyle-sexton
kyle-sexton deleted the feat/code-tidying-comment-lint-exclude branch November 24, 2026 17:48
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 24, 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