Skip to content

feat(code-tidying): pass an ADR pointer in the comment lint and keep ADR-named code uncertain - #18185

Merged
kyle-sexton merged 3 commits into
mainfrom
fix/code-tidying-adr-pointer-lint
Nov 22, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
fix/code-tidying-adr-pointer-lint

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Closes #18189

Summary

  • The comment lint passes an ADR pointer, under the necessary posture, when the record it names exists. Today the keep list keeps that pointer but the lint has no shape for it, so it fails CI under comment_lint: block.
  • /code-tidying:audit-dead-code treats a candidate that a decision record names as uncertain, citing the record, never dead.
  • /docs-hygiene:rename-references matches a glossary-driven rename's term inside identifiers (addLearner for learner) by the "Counting a term" contract of /domain-driven-design:ubiquitous-language, gated on that skill being available. Ordinary renames keep \b.
  • The ## Next section of rename-references lists conditional successors.

Fix

  • plugins/code-tidying/git-hooks/comment-lint.py: new _adr_pointer pass. A one-line comment whose whole content is an id (ADR-0042, ADR 42, adr0042) or one relative path, optionally after See, passes only when the record exists in the decision-record folder. For an id, that means a file whose leading number matches. For a path, it must resolve inside the folder, from the repository root or from the file's own directory, and either name an existing file or the stem of one (docs/adr/0042 matches 0042-*.md). A missing record, a pointer followed by reason text, or a pointer inside a longer comment all fail.
  • The folder is the new team-file setting comment_adr_dir (default docs/adr), resolved by scripts/comment-settings.sh like comment_lint and comment_lint_allow and documented in the schema and README. A value outside the repository is invalid there, and comment-lint.py falls back to the default for one that escapes, so the default applies. The architecture plugin has no folder key (plugins/architecture/reference/config.md), and its discovery ladder (reference/adr-discovery.md) is prose a model runs, not something a script can walk.
  • The record is judged on the same snapshot as the source. comment-lint.sh lists the folder from the index, from the work tree with --worktree, or from the pushed tips, and passes that set as --records.
  • keep-list.md: the ADR pointer bullet says what the lint passes, like the exit-code list bullet does.
  • audit-dead-code/context/adjudication.md: adds a "Named by a decision record" evidence row and one line under Verdict rules.
  • rename-references: the SKILL.md "Glossary-driven renames" section adds the identifier-part pass and names the contract by skill, not by path. context/triage.md says such a hit is never Certain (declarations and call sites go to the refactor-tool list, other hits to Ambiguous). context/patterns.md points at the section.
  • ## Next bullets: /docs-naming:audit-file-names for a whole-tree casing check, and /toolchain:check when the sweep edited code or config. An "IDE or refactoring tool" bullet is left out because .claude/rules/skill-bodies-state-current-rules.md requires every bullet to name a /plugin:skill. docs/skill-cheat-sheet.md is regenerated from it.
  • comment-lint.test.sh declares its read of plugins/code-tidying/.claude-plugin/plugin.json in its test-scope line.
  • Changelog fragments for code-tidying and docs-hygiene (minor).

Verification

  • python3 -I plugins/code-tidying/git-hooks/test_comment_lint.py: 99 tests, exit 0, including 11 AdrPointer cases (existing id, existing path with and without extension, a path relative to the source file, a block comment, missing record, a path outside the folder, pointer plus reason, pointer inside a longer comment, posture none, no repository, a configured folder, and a folder outside the repository falling back).
  • bash plugins/code-tidying/git-hooks/comment-lint.test.sh: 62 passed, exit 0. End-to-end cases:
    • only a missing record's pointer fails;
    • an untracked record does not pass a staged pointer, but passes it with --worktree;
    • a staged record deleted from the work tree still passes;
    • comment_adr_dir: docs/decisions passes ADR-0007 against docs/decisions/0007-x.md.
  • bash plugins/code-tidying/scripts/comment-settings.test.sh: all checks passed, exit 0. The new cases check that the team file is read and the personal override ignored, and that /etc, ../outside and docs/../.. are invalid.
  • scripts/run-ruff.sh check on both Python files: exit 0. shellcheck on comment-lint.sh and comment-settings.sh: exit 0.
  • scripts/check-next-graph.py: exit 0.
  • The pre-commit code-tidying-remote-comment-lint hook passed on both commits.

Related

  • Owner decisions Q1517, Q1518, Q1524 and Q1527 in alignment pass 02 build on Q809.
  • A parallel PR renames record-decision to adr. This PR changes no line that names record-decision.

session: AI Hero

🤖 Generated with Claude Code

https://claude.ai/code/session_01RAoAtTH8RQe4ZKtmQdB7Rh

…ADR-named code uncertain

The comment lint now passes, under the necessary posture, a one-line comment
holding only an ADR id or one relative path into docs/adr, when that record
exists; a missing record or added reason text still fails. audit-dead-code
adjudicates a candidate a decision record names as uncertain. The
rename-references glossary sweep matches identifier parts as the glossary
contract counts a term, and its Next lists conditional successors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RAoAtTH8RQe4ZKtmQdB7Rh
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 22, 2026 17:12
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 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-22T17:16:11.580934Z 62a2bca 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: 62a2bcaa53

ℹ️ 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".

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs

Run 45048135188, attempt 1

Field Value
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 45048135188

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review: PR #18185 (head b7b004b)

I found no security issues. This lane already reviewed an earlier head (blocking only: yes), so this review reports only CRITICAL and IMPORTANT findings, and there are none of either.

Files read: all 16 changed files, every hunk, in .claude-lane/pr.diff. None of them matches a trusted-path glob.

The ADR-pointer pass and the comment_adr_dir setting (comment-lint.py, comment-lint.sh, comment-settings.sh, the schema):

  • Where the value comes from: only the team file. comment-settings.sh adds the key to TEAM_ONLY_KEYS, so the personal override cannot set it.
  • Values that try to leave the repository:
    • comment-settings.sh rejects an absolute path and any .. component.
    • For a folder that exists, it also requires inside_root "$root/$2/.".
    • In the Python check, _adr_folder falls back to docs/adr when the resolved folder is the root itself or falls outside it.
  • How the value reaches git and Python: git gets it as a quoted :(literal) pathspec, so glob magic and option injection don't apply. python3 gets it as one quoted argument.
  • The scratch records tree under $CHECKS_TMP/records:
    • It is built from paths that git ls-files / git ls-tree print. Git, and GitHub's receive-side fsck, reject tree entries named .., so these writes stay inside the temporary directory.
    • The files are created empty. The lint checks only whether a record exists; it reads no record's contents and runs nothing.
  • What the lint gates: whether a comment is allowed. It is not a trust control. Nothing here exposes a token or secret, grows a token's scope, trusts a new actor, or sends untrusted text to a lane that holds credentials.

Skill and doc text (adjudication.md, keep-list.md, rename-references SKILL.md/patterns.md/triage.md, README, cheat sheet, changelog fragments):

  • No standing guardrail is deleted or softened.
  • adjudication.md adds a more conservative verdict: a candidate a decision record names is uncertain, never dead.
  • rename-references gains an identifier-part pass whose hits are never Certain, plus a list of next skills to run.

Other checks:

  • No plugin manifest, workflow, token request, kill switch, trusted-actor file or merge-hold file changed.
  • comment-lint.test.sh only adds plugin.json to its test-scope line.
  • No new spend.

critical-findings: 0

…apshot

The comment lint read the record from the working tree while the source came
from the index, so an untracked record passed a staged pointer and a staged
record deleted from the work tree failed it. comment-lint.sh now lists the
record folder from the index, the work tree under --worktree, or the pushed
tips, and passes that set to comment-lint.py as --records.

The record folder is no longer fixed: the team-file setting comment_adr_dir
(default docs/adr) names it, and a value outside the repository is invalid,
so the default applies.

rename-references names the ubiquitous-language skill's "Counting a term"
contract by skill, not by repository path. comment-lint.test.sh declares its
read of plugin.json in its test-scope line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RAoAtTH8RQe4ZKtmQdB7Rh
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review: PR #18185 at b7b004bb, blocking findings only

I read every hunk of all 16 changed files in .claude-lane/pr.diff. I also read the PR context, the settled threads, this lane's earlier findings, the loosened-check criterion, and the setting() helper in comment-lint.sh. This lane already reviewed an earlier head (blocking only: yes), so this review reports blocking findings only. I found none.

Earlier blocking finding is now resolved

  • Fail a change that loosens a check (kind 9), earlier posted at comment-lint.py:304. Under necessary, the ADR-pointer pass in _passes/_adr_pointer still accepts more than before, and so does the configurable comment_adr_dir folder. But the PR now closes feat(code-tidying): pass an ADR pointer comment in the comment lint #18189, and that issue's text names both and says why:

    • the one-line id or relative-path pointer, optionally after See;
    • the record must exist in the comment_adr_dir folder (default docs/adr, inside the repository);
    • existence is judged on the same snapshot as the source;
    • the three shapes that stay blocked;
    • the reason, an owner decision with a line link and the owner's words quoted after verbatim:.

    The code does not go past that scope. A folder outside the repository falls back to the default. A path pointer must resolve inside the folder. A pointer counts only when it is the only prose in its comment run. Under the criterion this loosening passes, so I raise nothing on it.

    The settled thread on these lines (owner decision, lines changed since resolution: no) agrees. The prompt had no loosened_check_spec: line, so I took the closing issue's text as the spec but could not confirm that its author is on the trusted-actor list.

Closing issue #18189, "Done when"

  • "comment-lint.py passes the pointer shape above and fails the three shapes that stay blocked, with tests": met. AdrPointer in test_comment_lint.py covers both passing cases (existing id, existing path) and each blocked shape (missing record, pointer with reason text, pointer inside a longer comment). comment-lint.test.sh adds end-to-end snapshot cases.
  • "comment_adr_dir is read through the comment settings cascade and documented with its default": met. The key is in KEYS/TEAM_ONLY_KEYS in comment-settings.sh, with escape checks in valid(). The schema and README document the default docs/adr. comment-settings.test.sh covers the team-only read and the invalid escapes.

Other checks

  • Embedded text: I found no embedded directives in the PR context, the settled threads or the prior findings.
  • Plugin manifests: no plugin.json or marketplace.json changed, so no manifest lines apply. Both changelog fragments are bump: minor, which fits a new setting and new skill behaviour.
  • Paved paths: not resolved this run, so there are no paved-path findings.
  • Verification claims: the PR's results (99 unit tests, 62 end-to-end checks, ruff, shellcheck and check-next-graph.py) are the author's claims. I did not verify them: this lane has no shell.
  • Spend: none of note. No cost hold.

Loosened checks: the prompt had no loosened_check_verdict: or loosened_check_patterns: line, so I used fail with no consumer entries. It had no loosened_check_decision_record: line either, so the citation requirement was not checked; the closing issue carries a citation anyway. Loosened checks would be marked: fail (default: no wrapper settings lines); patterns: 0

Verifier dropped 0 of 0 candidates. I did not fan out to verifier subagents.

@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: 1 inline finding(s) on 9027389c67b3593b464adcd36922f0525cfafff0; the summary is in this lane's pull request comment.

claude-lane: claude-review

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 22, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit ac9899a Nov 22, 2026
49 checks passed
@kyle-sexton
kyle-sexton deleted the fix/code-tidying-adr-pointer-lint branch November 22, 2026 18:30
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 22, 2026
kyle-sexton added a commit that referenced this pull request Nov 22, 2026
The record's Lesson 5 row names the prune action (Q1526 supersedes Q204)
and the #18185 row drops "(open)" now that it merged. The repo-sweep
catalog's glossary step sends removals to prune.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RAoAtTH8RQe4ZKtmQdB7Rh
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.

feat(code-tidying): pass an ADR pointer comment in the comment lint

1 participant