Skip to content

feat(adr-lint)!: check ADR files in shell instead of adr-check - #37

Merged
furedea merged 7 commits into
mainfrom
feat/check-adr-files-without-adr-check
Dec 2, 2026
Merged

furedea merged 7 commits into
mainfrom
feat/check-adr-files-without-adr-check

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

概要

furedea/agent-config#293 の L2.adr-lint から agent-config の adr-check への依存を外し,ADR ファイルの検査を shell で行う(この PR では #293 を閉じない).

変更

  • adr-lint.yml: adr-check の手順,agent-config-ref 入力,AGENT_CONFIG_REF,agent-config の pin を削除.新しい「Check ADR files」手順を追加(markdownlint,MD043,lychee は変更なし).
    • ファイル名が NNNN_<小文字words>.md(単語は _ 区切り)
    • 番号の重複がない
    • 先頭が ---(front matter)ならエラー.front matter を削除し,置き換えた ADR も削除するよう案内する
    • PR では,追加された ADR の番号が base までの履歴で一度でも使われた番号ならエラー(改名は追加とみなさない).push では省く
    • 違反は全件報告してから失敗する
  • README.md: adr-lint.yml の節を新しい検査の説明に更新
  • renovate.json: agent-config 追従の対象から adr-lint.yml を外し,nixpkgs 追従に ci.yml を追加
  • テスト: tests/adr-lint/check_files.bats(12 ケース,各条件に合格例と違反例)を追加.ci.yml の adr-lint-files ジョブで実行.fixtures から front matter を除去

破壊的変更

front matter を持つ ADR は失敗し,agent-config-ref 入力は廃止される.呼び出し側は Renovate の更新 PR の中で front matter を削除し,置き換えられた ADR を削除する.

BREAKING CHANGE を含むので release-please が major リリースにする.

🤖 Generated with Claude Code

Remove the adr-check step, the agent-config-ref input and the agent-config
pin of adr-lint.yml, and check the ADR files directly in a shell step: file
name, duplicate numbers, leftover front matter, and reuse of a number that an
ADR ever had in the history of the base commit. Drop adr-lint.yml from the
Renovate manager that follows agent-config, update the README, strip front
matter from the fixtures and test each condition with a passing and a failing
case.

Refs furedea/agent-config#293

BREAKING CHANGE: adr-lint fails on ADRs that start with front matter and no
longer accepts the agent-config-ref input. Delete the front matter, and delete
any ADR that a newer one replaced.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Dec 2, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 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-12-02T10:24:23.464565Z 4cacb8c Manual request
ℹ️ 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.

Comment thread .github/workflows/adr-lint.yml Resolved
Comment thread .github/workflows/adr-lint.yml Resolved
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Review summary

No blocking issues found. I read the diff and reasoned through the shell logic. I could not run the bats suite in this sandbox.

  • P2 (inline, adr-lint.yml): the number-reuse check silently does nothing when adr-dir is written as ./docs/adr, because git prints repo-relative paths and the regex is anchored on the raw $dir. The unquoted $dir in the regex is also treated as a pattern. No test covers a non-normalised dir.
  • P3 (inline, adr-lint.yml): a comment refers to check_files.test.sh, but the file is check_files.bats.

Checked and fine:

  • The [[ ... ]] && assign pattern at the end of the while loop does not trip set -e, since bash ignores errexit there.
  • Front matter detection handles CRLF and empty files.
  • Rename and rename-then-delete history cases are covered by tests.

🤖 Generated with Claude Code

@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: 5b089e426b

ℹ️ 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 .github/workflows/adr-lint.yml Resolved
Comment thread .github/workflows/adr-lint.yml Resolved
furedea and others added 3 commits December 2, 2026 17:53
…bering renames

Reduce ADR_DIR to Git's repository-relative form and compare paths literally,
so ./docs/adr, docs//adr, a trailing slash or an absolute path no longer turn
the reuse check off. Drop rename detection and exempt only a number that the
pull request itself deletes, so renaming an ADR to a deleted number is
reported while a rename that keeps the number still passes.

Refs furedea/agent-config#293

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Dec 2, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Review summary (read-only): no blocking findings. No P0/P1/P2 issues, so no inline comments.

Checked:

  • The Check ADR files step logic: ADR_DIR normalisation, filename regex, duplicate detection, front matter with CRLF, README skip, and -e and fail behaviour with the process-substitution loops.
  • The history and rename handling: --no-renames with the deleted-here exemption.
  • Shell injection: inputs reach the step through env, not through expression interpolation.
  • Leftover agent-config-ref references: none remain in adr-lint.yml or ci.yml. The only hits in .github are in ast-grep.yml, which keeps its own input.
  • The bats awk extraction of the step, and the Renovate and all-green wiring for the new adr-lint-files job.

Observations, not findings:

  • P3, unverified (I could not run it here). git log "$BASE_SHA" -- "$dir" uses default history simplification. A number that was added and deleted entirely on a side branch of a merge-commit history may never show up, so it could be reused. --full-history would close that. This only matters for merge-commit workflows, and such a number was never in force on the base branch.
  • P3. adr-dir: . would skip the reuse check, because git prints paths without a ./ prefix and adr_number_of requires "$dir"/. This is unlikely in practice.
  • The README diff re-indents many unrelated list continuations from 3 to 4 spaces. That is noise, and a separate formatter-only commit would make the real change easier to read.

The 14 bats cases cover each condition with a passing and a failing example, and they look correct against the script.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 261ba02ce7

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

Fixes the ast-grep rules bash_local_underscore_prefix and
bash_readonly_constant_name that failed CI on the bats file.

Refs furedea/agent-config#293

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Dec 2, 2026

Copy link
Copy Markdown
Owner

@codex review

Comment thread .github/workflows/adr-lint.yml Resolved
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Review summary

I read the full diff and found one minor problem. Nothing blocks the merge. I only read the code and didn't run the workflow or the bats tests.

P2 (inline, adr-lint.yml:150): The number_deleted_here exemption also lets a PR delete ADR NNNN_a and add an unrelated NNNN_b. Without rename detection that looks the same as a rename, so a deleted number can be reused. This is the case the check is meant to catch, and no test pins the behaviour either way. Use rename detection or document the loophole, and add a bats case.

Checked, no findings:

  • The set -e handling of the number=$(...) && ... lines is safe.
  • CRLF front-matter detection works.
  • fetch-depth: 0 is set where the history check needs it.
  • BASE_SHA is empty on push events, so the history check is skipped there.
  • ADR_DIR normalization is covered by tests.
  • The Renovate changes and the new adr-lint-files job are wired into all-green.

Tests cover each new condition with a passing and a failing case.

🤖 Generated with Claude Code

@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: ced714ed46

ℹ️ 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 .github/workflows/adr-lint.yml Resolved
Comment thread .github/workflows/adr-lint.yml Resolved
Exempt only a rename that git detects and that keeps the number, so deleting
an ADR and adding an unrelated one with its number is reported. Follow the
full history so a number added and deleted on a merged side branch is taken,
and handle adr-dir at the repository root.

Refs furedea/agent-config#293

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Dec 2, 2026

Copy link
Copy Markdown
Owner

@codex review

Comment thread .github/workflows/adr-lint.yml Resolved
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Review summary

The shell check is carefully built. It runs under bash -e -o pipefail, passes ADR_DIR through env rather than interpolating it, and normalizes the directory path. The tests are thorough and cover each condition with a pass and a fail case. I found nothing that blocks the merge.

P2

  • Reuse detection can be bypassed by git rename detection (inline comment on adr-lint.yml). Delete NNNN_old.md and add NNNN_new.md with a similar MADR skeleton, and the default 50% -M threshold can pair them as a rename. The check then treats it as number-preserving and passes. This is not run-verified, and the tests only use dissimilar content.

Not blocking

  • Any .md in <adr-dir> other than README.md that isn't NNNN_words.md now fails, for example template.md or 0000-template.md. The MADR-heading step only globs NNNN_*.md, so this is stricter than before. The README documents it, but callers may need a note since this is a breaking release.
  • Reuse is not checked on push or merge_group. This is documented, so enforcement relies on the PR check being required.

@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: c572b20a02

ℹ️ 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 .github/workflows/adr-lint.yml Resolved
…n adr-dir

Use a 90% similarity threshold for the rename that keeps an ADR number, so a
replacement that only shares the MADR skeleton is reported as a reuse, and
canonicalize ., .. and empty components of adr-dir before comparing it with
Git's paths.

Refs furedea/agent-config#293

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Dec 2, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Review summary

No P0 or P1 findings, and nothing I considered worth an inline comment. This was a read-only review of the diff. I did not run the bats suite.

What I checked:

  • "Check ADR files" step. I traced it for bash -e behaviour: the && and || lists, the read ... || true on an empty file, and the fail calls inside the while ... < <(...) loops. All of them run in the main shell, so status is kept and every violation is reported before the step exits.
  • normalize_dir and adr_number_of. Directory spellings (./, //, a trailing /, x/.., an absolute path) and the repository-root case (. with an empty prefix) are handled consistently with the git pathspecs. Subdirectories are excluded by the [^/]* in the regex.
  • History scan. git log --full-history --no-renames --name-only against git diff -M90% --diff-filter=AR covers delete-then-add, rename-then-delete, side-branch add and delete, and renumbering to a deleted number. The same-number rename exemption is correct.
  • Test extraction. The awk extraction of the step by name and indentation matches the workflow layout.
  • Renovate. The regex for ci.yml matches the NIXPKGS_REV line, and removing adr-lint.yml from the agent-config manager is consistent with deleting the # renovate: marker.
  • all-green. adr-lint-files is added to needs.

Optional notes (P3, not blocking):

  • Small-file renames. A rename that also edits the file (for example slug and H1 title in one commit) drops below the 90% similarity threshold on short ADRs. It is then reported as number reuse. This is documented and intentional, but the error message does not hint at splitting the rename and the edit into separate commits.
  • .. above the root. normalize_dir clamps leading .. components silently. adr-dir: ../x is checked as x instead of failing. This only matters for a misconfigured caller.
  • Front matter and BOM. The front matter check compares the first line to --- exactly after stripping \r. A UTF-8 BOM before --- would slip through.
  • README churn. The README diff re-indents list continuations in sections unrelated to adr-lint. That is probably formatter output, but it adds noise to a breaking-change PR.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 4cacb8c9ab

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

@furedea
furedea merged commit 9dc6a04 into main Dec 2, 2026
18 checks passed
@furedea
furedea deleted the feat/check-adr-files-without-adr-check branch December 2, 2026 10:39
furedea added a commit that referenced this pull request Dec 2, 2026
…izing it (#39)

`adr-lint` の「Check ADR files」で,`adr-dir` を正規化する `normalize_dir`(約 17
行)をやめ,正規の形でない `adr-dir` を手順の冒頭でエラーにする.
理由:正規化は #37
のレビュー指摘(`./docs/adr`,`.`,`docs/./adr`,`..`,`//`,絶対パス)ごとに足したもので,呼び出し側はすべて既定の
`docs/adr` を使っている.入力は境界で一度だけ検査する.
**release PR #38(2.0.0)より先にマージする**: 同じ破壊的変更として 2.0.0 に含めるため.

| `adr-dir` | #37(未リリース) | この PR |
|
-------------------------------------------------------------------------------
| ----------------- | -------------------------------------- |
| `docs/adr`(既定) | 通る | 通る |
| `./docs/adr`,`docs/adr/`,`docs//adr`,`docs/./adr`,`docs/x/../adr`,絶対パス
| 正規化して通る | エラー(1 件のメッセージで理由を示す) |
| `.`(リポジトリ直下) | 通る | エラー |
| 空文字 | 既定値に戻る | エラー |

## 検証

- [x] ローカルで `bats tests -r`: 19 件すべて成功(正規でない書き方の拒否と `docs/adr` の受理を含む)
- [ ] CI(`adr-lint-files`,`ast-grep`,`gha-lint`,`all-green` ほか)
- [ ] Claude / Codex review

<details><summary>範囲・関連</summary>

- Refs furedea/agent-config#293(ADR から front matter と `adr-check`
を廃止する計画の L2 の追補)
- 続き:#37(マージ済み)
- 範囲外:ファイル名,番号の重複,front matter の残存,番号の再利用(90%
のリネーム規則,`--full-history`)の検査は変えない.

</details>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
furedea pushed a commit that referenced this pull request Dec 2, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.0.0](v1.6.0...v2.0.0)
(2026-12-02)


### ⚠ BREAKING CHANGES

* **adr-lint:** reject a non-canonical adr-dir instead of normalizing it
([#39](#39))
* **adr-lint:** check ADR files in shell instead of adr-check
([#37](#37))

### Features

* **adr-lint:** check ADR files in shell instead of adr-check
([#37](#37))
([9dc6a04](9dc6a04))


### Code Refactoring

* **adr-lint:** reject a non-canonical adr-dir instead of normalizing it
([#39](#39))
([60f069a](60f069a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: furedea-release[bot] <353651101+furedea-release[bot]@users.noreply.github.com>
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.

1 participant