Skip to content

infra(cargo): Cargo workspace 化 + rust-test push pipeline 統合 (ADR-026) - #46

Merged
aloekun merged 1 commit into
masterfrom
infra/cargo-workspace
Apr 17, 2026
Merged

infra(cargo): Cargo workspace 化 + rust-test push pipeline 統合 (ADR-026)#46
aloekun merged 1 commit into
masterfrom
infra/cargo-workspace

Conversation

@aloekun

@aloekun aloekun commented Apr 16, 2026

Copy link
Copy Markdown
Owner

Summary

Summary by CodeRabbit

リリースノート

  • New Features
    • 複数クレートをまとめるルートのCargoワークスペースを追加し、ルートでの一括ビルド/テスト運用を可能にしました。
  • Chores
    • ルートのビルド生成物を無視する.gitignoreを追加・整理しました。
    • ビルドスクリプトをルート実行に合わせて簡素化しました。
  • Documentation
    • ワークスペース導入を記録するADRと運用手順を追記しました。
  • Tests
    • テスト実行をワークスペース単位に統一しました(ignoredテスト実行も継続)。

## 背景

PR #44 で push pipeline に rust-test group を追加したが、本プロジェクトが
Cargo workspace ではないため cargo test --manifest-path の個別指定が必要だった。
また各 package に target/ が独立し、compile cache が共有されない問題もあった。

## 変更内容

### workspace 化
- ルート Cargo.toml 新規作成 ([workspace] + 10 members + [profile.release])
- 各 member Cargo.toml から重複していた [profile.release] を削除
  (workspace 化で ignore される警告の解消)
- .gitignore: /target/ (workspace 共有) を追加、src/*/target/ も legacy 互換で維持

### build スクリプト統一
- package.json の build:* を "cargo build --release -p <name>" 形式に統一
- target path を workspace root (target/release/) 基準に変更
- cd 不要に、cache 共有で再ビルド時間短縮

### push pipeline 簡素化
- push-runner-config.toml の rust-test command を
  "cargo test" / "cargo test -- --ignored --test-threads=1" に簡素化
- templates/push-runner-config.toml にコメントアウト済みの rust-test group
  テンプレート追加 (派生プロジェクトで有効化可能)

### ドキュメント
- ADR-026: Cargo workspace による Rust パッケージ統合 (新規)
- CLAUDE.md: ADR index 更新
- docs/todo.md: task #4 を実装済みに更新

## 回帰テスト

- cargo test: 10 packages 合計 318 tests passed + 1 integration (ignored)
- cargo test -- --ignored --test-threads=1: 1 integration test passed
- pnpm build:all: 全 8 exe 警告なしで成功
@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 507abb0b-6ba5-45f8-a417-1090729f9091

📥 Commits

Reviewing files that changed from the base of the PR and between ca52002 and 466704a.

⛔ Files ignored due to path filters (10)
  • Cargo.lock is excluded by !**/*.lock
  • src/check-ci-coderabbit/Cargo.lock is excluded by !**/*.lock
  • src/cli-merge-pipeline/Cargo.lock is excluded by !**/*.lock
  • src/cli-pr-monitor/Cargo.lock is excluded by !**/*.lock
  • src/cli-push-pipeline/Cargo.lock is excluded by !**/*.lock
  • src/cli-push-runner/Cargo.lock is excluded by !**/*.lock
  • src/hooks-pre-tool-validate/Cargo.lock is excluded by !**/*.lock
  • src/hooks-session-start/Cargo.lock is excluded by !**/*.lock
  • src/hooks-stop-quality/Cargo.lock is excluded by !**/*.lock
  • src/lib-report-formatter/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (17)
  • .gitignore
  • CLAUDE.md
  • Cargo.toml
  • docs/adr/adr-026-cargo-workspace.md
  • docs/todo.md
  • package.json
  • push-runner-config.toml
  • src/check-ci-coderabbit/Cargo.toml
  • src/cli-merge-pipeline/Cargo.toml
  • src/cli-pr-monitor/Cargo.toml
  • src/cli-push-pipeline/Cargo.toml
  • src/cli-push-runner/Cargo.toml
  • src/hooks-post-tool-linter/Cargo.toml
  • src/hooks-pre-tool-validate/Cargo.toml
  • src/hooks-session-start/Cargo.toml
  • src/hooks-stop-quality/Cargo.toml
  • templates/push-runner-config.toml

📝 Walkthrough

Walkthrough

リポジトリのRustパッケージ群をルート Cargo.toml によるCargo workspaceへ統合。workspaceレベルの [profile.release] を追加し個別crateの同設定を削除、.gitignore・npmビルドスクリプト・CIテスト設定をworkspace向けに更新。

Changes

Cohort / File(s) Summary
Workspace Root Configuration
Cargo.toml, .gitignore
ルートにCargo.tomlを追加して[workspace]resolver = "2", 10メンバー)とルート[profile.release]を定義。.gitignoreをルート/target/src/*/target/src/*/Cargo.lock無視へ更新。
Documentation & Tracking
CLAUDE.md, docs/adr/adr-026-cargo-workspace.md, docs/todo.md
ADR-026を作成・登録し、CLAUDE.mdに追記。docs/todo.mdの状態・チェックリストをworkspace導入済みに更新。
Build Scripts
package.json
複数のbuild:*スクリプトをcd src/<crate> && cargo build --releaseからcargo build --release -p <crate>へ変更(repoルート実行)。artifactコピー先を../../.claude/....claude/...に変更。
Member Cargo Manifests
src/*/Cargo.toml (複数)
src/check-ci-coderabbit/Cargo.toml, src/cli-merge-pipeline/Cargo.toml, src/cli-pr-monitor/Cargo.toml, src/cli-push-pipeline/Cargo.toml, src/cli-push-runner/Cargo.toml, src/hooks-post-tool-linter/Cargo.toml, src/hooks-pre-tool-validate/Cargo.toml, src/hooks-session-start/Cargo.toml, src/hooks-stop-quality/Cargo.toml
各crateからローカル[profile.release]opt-level/lto/strip)を削除し、workspaceルートで集約している旨のコメントを追加。
CI / Templates
push-runner-config.toml, templates/push-runner-config.toml
rust-test品質ゲートのcargo test --manifest-path ...cargo testへ変更。templatesにコメント化されたrust-testグループのテンプレートを追加。

Sequence Diagram(s)

sequenceDiagram
    participant Dev as 開発者 / CI設定
    participant NPM as npm scripts
    participant Cargo as Cargo Workspace (repo-root)
    participant Art as .claude / target/
    participant CI as Push-Runner / テスト実行

    Dev->>NPM: npm run build:<crate>
    NPM->>Cargo: cargo build --release -p <crate>
    Cargo-->>Art: target/release/<binary>.exe を出力
    Cargo->>Art: cp target/release/<binary>.exe .claude/<binary>.exe
    CI->>Cargo: cargo test (workspace)
    Cargo-->>CI: 単体/ignored テスト結果
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは、リポジトリをCargoワークスペースに統合し、rust-testパイプラインを統合するという変更セットの主要な内容を正確に反映しています。タイトルは簡潔で、開発者の観点から最も重要な変更を明確に示しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
src/cli-push-runner/Cargo.toml (1)

10-10: LGTM!

他 member crate と同一パターンで [profile.release] を root に集約できています。

なお任意の改善として、今後 edition や共通依存バージョンが増えるようであれば、root Cargo.toml 側に [workspace.package] / [workspace.dependencies] を定義し、各 member で edition.workspace = trueserde.workspace = true のように継承する形も検討余地があります(本 PR のスコープ外)。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/cli-push-runner/Cargo.toml` at line 10, This is fine as-is (you've
centralized [profile.release] at the workspace root); optional improvement: if
shared settings (edition or dependency versions) increase, define
[workspace.package] and/or [workspace.dependencies] in the root Cargo.toml and
in member crates switch to inheriting those values (e.g., set edition.workspace
= true and serde.workspace = true in the member Cargo.toml files) so common
edition and dependency versions are managed centrally; update member manifests
to remove duplicated keys once the workspace entries are added.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/cli-push-runner/Cargo.toml`:
- Line 10: This is fine as-is (you've centralized [profile.release] at the
workspace root); optional improvement: if shared settings (edition or dependency
versions) increase, define [workspace.package] and/or [workspace.dependencies]
in the root Cargo.toml and in member crates switch to inheriting those values
(e.g., set edition.workspace = true and serde.workspace = true in the member
Cargo.toml files) so common edition and dependency versions are managed
centrally; update member manifests to remove duplicated keys once the workspace
entries are added.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a76fcce8-105a-4a01-9cae-c869f8859e42

📥 Commits

Reviewing files that changed from the base of the PR and between ca52002 and 466704a.

⛔ Files ignored due to path filters (10)
  • Cargo.lock is excluded by !**/*.lock
  • src/check-ci-coderabbit/Cargo.lock is excluded by !**/*.lock
  • src/cli-merge-pipeline/Cargo.lock is excluded by !**/*.lock
  • src/cli-pr-monitor/Cargo.lock is excluded by !**/*.lock
  • src/cli-push-pipeline/Cargo.lock is excluded by !**/*.lock
  • src/cli-push-runner/Cargo.lock is excluded by !**/*.lock
  • src/hooks-pre-tool-validate/Cargo.lock is excluded by !**/*.lock
  • src/hooks-session-start/Cargo.lock is excluded by !**/*.lock
  • src/hooks-stop-quality/Cargo.lock is excluded by !**/*.lock
  • src/lib-report-formatter/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (17)
  • .gitignore
  • CLAUDE.md
  • Cargo.toml
  • docs/adr/adr-026-cargo-workspace.md
  • docs/todo.md
  • package.json
  • push-runner-config.toml
  • src/check-ci-coderabbit/Cargo.toml
  • src/cli-merge-pipeline/Cargo.toml
  • src/cli-pr-monitor/Cargo.toml
  • src/cli-push-pipeline/Cargo.toml
  • src/cli-push-runner/Cargo.toml
  • src/hooks-post-tool-linter/Cargo.toml
  • src/hooks-pre-tool-validate/Cargo.toml
  • src/hooks-session-start/Cargo.toml
  • src/hooks-stop-quality/Cargo.toml
  • templates/push-runner-config.toml

@aloekun

aloekun commented Apr 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Apr 17, 2026

Copy link
Copy Markdown
✅ Actions performed

Full review triggered.

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