feat(cli-docs-lint): preamble + cross-ref validator in push-runner quality_gate (ranks 95+96 land)#179
Conversation
… + cross-ref checks
…-lint compliance)
…up + pnpm lint:docs
… — landed via cli-docs-lint
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthrough新しいドキュメント検査ツール Changesドキュメント検査ツール統合と実装
Sequence Diagram(s)sequenceDiagram
participant User as User/CI
participant Main as main()
participant Parse as parse_args()
participant Run as run()
participant Preamble as preamble::check()
participant CrossRef as cross_ref::check()
participant Violations as Violation[]
User->>Main: cli-docs-lint --check all --docs-dir ./docs
Main->>Parse: 引数解析
alt 解析成功
Parse-->>Main: CliArgs { mode, docs_dir }
Main->>Run: mode, docs_dir
alt mode == All
Run->>Preamble: check(docs_dir)
Preamble-->>Violations: preamble 違反[]
Run->>CrossRef: check(docs_dir)
CrossRef-->>Violations: cross-ref 違反[]
else mode == Preamble
Run->>Preamble: check(docs_dir)
Preamble-->>Violations: preamble 違反[]
end
Run-->>Main: 全違反集約
alt 違反なし
Main-->>User: exit code 0
else 違反あり
Main->>Main: 違反一覧出力
Main-->>User: exit code 1 + 違反表示
end
else 解析エラー
Parse-->>Main: Err
Main->>Main: エラー + ヘルプ出力
Main-->>User: exit code 2
end
sequenceDiagram
participant CrossRef as cross_ref::check()
participant Walk as walk(docs_dir)
participant File as ファイルシステム
participant CheckFile as check_file()
participant Validate as validate_link()
CrossRef->>Walk: Markdown ファイル収集
Walk->>File: readdir + 再帰走査
File-->>Walk: パス[]
Walk-->>CrossRef: sorted .md paths
loop 各 Markdown ファイル
CrossRef->>File: 内容読み込み
File-->>CheckFile: content
CheckFile->>CheckFile: 正規表現でリンク抽出
loop 各リンク
CheckFile->>Validate: link target
alt http(s):// 等の絶対URL
Validate-->>CheckFile: skip (ok)
else # のみのアンカー
Validate-->>CheckFile: skip (ok)
else 相対パス
Validate->>Validate: # で分割→パス部抽出
Validate->>File: resolve して存在確認
File-->>Validate: exists?
alt 存在する
Validate-->>CheckFile: ok
else 見つからない
Validate-->>CheckFile: Violation { file, line, message }
end
end
end
end
CheckFile-->>CrossRef: Violation[]
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/cli-docs-lint/src/main.rs`:
- Around line 31-87: The code defaults to CheckMode::All and lacks the ADR-039
experimental-feature pattern; update parse_args, CliArgs, and run to require
explicit opt-in (e.g., add an --enable-experimental flag or read a config opt-in
field in CliArgs), implement a kill-switch (check an env var like
DISABLE_EXPERIMENTAL or a config boolean and refuse to run experimental checks
when set), and enforce a bounded lifetime by adding a compile/time-constant
expiry date checked at startup (in parse_args or run) that returns an error if
expired; wire these checks so CheckMode::All only runs experimental checks when
opt-in is present, the kill-switch is not set, and the expiry has not passed.
In `@src/cli-docs-lint/src/preamble.rs`:
- Around line 18-21: The code always subtracts one from expected_total to
compute expected_without_summary, causing undercount when todo-summary.md is
absent; change the logic in the area around list_todo_files(docs_dir) /
expected_total / expected_without_summary to detect whether the returned
todo_files includes "todo-summary.md" (or check filesystem for
docs_dir/todo-summary.md) and only decrement by 1 when it exists (e.g.,
expected_without_summary = expected_total.saturating_sub(if todo_files contains
"todo-summary.md" {1} else {0})); keep the rest of the flow unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1e1f8a82-37eb-4abf-a754-8bc42cf4141e
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (20)
Cargo.tomldocs/handoff-rank-8-weekly-review-phase-b.mddocs/todo-summary.mddocs/todo.mddocs/todo2.mddocs/todo3.mddocs/todo4.mddocs/todo5.mddocs/todo6.mddocs/todo7.mddocs/todo9.mdpackage.jsonpush-runner-config.tomlscripts/deploy-hooks.tssrc/cli-docs-lint/Cargo.tomlsrc/cli-docs-lint/src/cross_ref.rssrc/cli-docs-lint/src/lib.rssrc/cli-docs-lint/src/main.rssrc/cli-docs-lint/src/preamble.rstemplates/push-runner-config.toml
…(kill-switch + bounded lifetime) + preamble has_summary check
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
順位 95 (preamble file count 自動照合) + 順位 96 (Markdown cross-reference validator) を統合した新 workspace member
cli-docs-lintを導入し、push-runner のquality_gate.lintgroup にpnpm lint:docsとして統合する PR。同時に発見された既存の outdated preamble (5 ファイル) + broken cross-ref (13 件) も本 PR で修正。Commits
otwyvnqqnvkltmnktuorutsrrqyyokznnuuznkplDetails
cli-docs-lintbinary--check preamble:docs/todo*.mdの preamble に書かれた Kanji 数詞 (例: 十つ) と実ファイル数の一致を検証--check cross-ref:docs/**/*.mdの relative link を directory-aware で resolve (起点 file の親 directory を base に解決、PR docs(todo): split summary and todo5.md tasks to keep files under 50KB #133 で markdown-link-check が見逃した../docs/adr/...形式の broken link を検出)--check all(default): 両方実行検出した既存の品質問題 (本 PR で同時 fix)
docs/todo.mdPhase B forward ref 7 件 (.takt/facets/instructions/review-*-whole.md等の未存在ファイル) → inline code に変換docs/todo.mdproject-root 起点 path 5 件 (.takt/workflows/post-merge-feedback.yaml等) →../prefix で正規化docs/todo2.mdADR-032 forward ref 1 件 → inline code配置先の判断 (handoff doc の
.github/workflows/lint.yml案からの変更)本リポジトリは
.github/workflows/未存在で、既存品質ゲートはpush-runner-config.tomlの[quality_gate](= push 前の lint/test/build/rust-test) に集約済。新 CI workflow を作る代わりに既存パターンに沿って統合。派生 repo 用のtemplates/push-runner-config.tomlも同時更新。Test plan
cargo test -p cli-docs-lint: 26 tests pass./.claude/cli-docs-lint.exe: OK (preamble + cross-ref)pnpm build:all: clean buildpnpm pushの pre-push-review (simplicity + security + supervise) APPROVEDpnpm lint:docs統合済Removed task entries
docs/todo6.mdの順位 95 (preamble file count スクリプト) + 順位 96 (Markdown cross-ref validator) を削除docs/todo-summary.mdの対応 2 行を削除docs/todo.md/docs/todo9.md/docs/handoff-rank-8-weekly-review-phase-b.mdの関連参照を「cli-docs-lint で land 済」表記に更新Follow-up
Summary by CodeRabbit
New Features
Chores