Skip to content

refactor(adr-lint)!: reject a non-canonical adr-dir instead of normalizing it - #39

Merged
furedea merged 2 commits into
mainfrom
refactor/reject-non-canonical-adr-dir
Dec 2, 2026
Merged

furedea merged 2 commits into
mainfrom
refactor/reject-non-canonical-adr-dir

Conversation

@furedea-agent

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

Copy link
Copy Markdown
Contributor

adr-lint の「Check ADR files」で,adr-dir を正規化する normalize_dir(約 17 行)をやめ,正規の形でない adr-dir を,ADR_DIR を使うどの手順よりも前の独立した手順「Validate 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 件のメッセージで理由を示す)
.(リポジトリ直下) 通る エラー
空文字 既定値に戻る エラー

検証

  • ローカルで bats tests -r: 19 件すべて成功(正規でない書き方の拒否と docs/adr の受理を含む)
  • CI(head 872f1ff,18 件成功.adr-lint-files,ast-grep,gha-lint,all-green ほか)
  • Claude / Codex review: 初回の P2(検査が ADR_DIR を使う手順より後にある)2 件を 872f1ff で修正(Validate adr-dir を最初の手順に分離),再レビューは指摘なし
範囲・関連

🤖 Generated with Claude Code

…izing it

Fail the Check ADR files step with one error when adr-dir is empty, absolute,
has a . or .. component, contains // or ends with /, and use adr-dir as it is
afterwards. This replaces the normalization added for review findings about
inputs that no caller uses. The repository root (.) is rejected too.

Refs furedea/agent-config#293

BREAKING CHANGE: adr-dir values such as ./docs/adr, docs/adr/ or . are errors.

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-02T11:10:30.420981Z 872f1ff 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
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Review summary: one finding, no blockers.

  • P2 (inline, .github/workflows/adr-lint.yml:93): the canonical-path check runs in the fourth step, after markdownlint, the MADR check and lychee have already used the unvalidated ADR_DIR. An empty adr-dir makes markdownlint glob /**/*.md, and an absolute or .. path makes those steps scan files outside the repo. An earlier failure also hides the clear error message. I suggest validating in the first step that uses adr-dir.

The validation expression handles every case in the PR table (I traced each by hand; I did not run the tests). The ${2-docs/adr} change in the bats helper correctly lets an empty string through, and the new tests cover both rejection and acceptance. The remaining "$ADR_DIR" uses in adr_number_of and the git pathspecs are consistent with the canonical form.

🤖 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: 6545f2d348

ℹ️ 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
@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

No findings. I read the diff and traced the validation logic; I did not run the bats tests or CI.

  • Validation condition: the [[ ... ]] check in Validate adr-dir rejects every form the PR lists. Wrapping the value as /$ADR_DIR/ catches a . or .. component at the start, middle or end (., .., ./docs/adr, docs/x/../adr, docs/.). It does not reject legitimate names such as .github/adr or docs/....
  • Step order and scope: ADR_DIR is set at job level, so the validation step sees it before checkout. Later steps (markdownlint, lychee, MADR heading check, ADR file check) use the validated value unchanged.
  • Callers: ci.yml passes tests/adr-lint/fixtures/valid and tests/adr-lint/fixtures/madr-from, both canonical, so there is no regression there.
  • Tests: the awk extraction handles the new step, and the rejection and acceptance tests cover the listed spellings. run_step now uses ${2-docs/adr} instead of ${2:-docs/adr}, so an empty ADR_DIR can be passed through. That matches the removal of the default.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 872f1ff01e

ℹ️ 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 60f069a into main Dec 2, 2026
18 checks passed
@furedea
furedea deleted the refactor/reject-non-canonical-adr-dir branch December 2, 2026 11:18
@furedea
furedea restored the refactor/reject-non-canonical-adr-dir branch December 2, 2026 11:28
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