Skip to content

risundle が対応できるライブラリの条件を新規文書化する#93

Merged
TwoSquirrels merged 12 commits into
mainfrom
docs/compatibility
Jul 15, 2026
Merged

risundle が対応できるライブラリの条件を新規文書化する#93
TwoSquirrels merged 12 commits into
mainfrom
docs/compatibility

Conversation

@TwoSquirrels

@TwoSquirrels TwoSquirrels commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Closes #20

概要

risundle が正しくバンドルできるための十分条件 (必要十分条件そのものではない) を docs/compatibility.ja.md / docs/compatibility.md に新規文書化する。

  • 核となる条件は「各ライブラリファイルはそれ単独で構文的に完結した宣言であること」で、以下を実験で確認した反例として載せている。
    • 関数の宣言と実装をファイルにまたいで分割する構成 (コンパイルエラーになる)
    • namespace で他ファイルの #include をラップする構成 (黙ってスコープが変わりうる、唯一のサイレント破壊ケース)
    • マクロで宣言名を生成する構成 (X-macro。登録時にプリプロセスをしないため生成される名前が認識されない。回避策として前方宣言の併記を実験で確認して記載)
  • 「risundle は削るだけで足さない」という大前提 (元の解答がコンパイル・リンク可能であること、実装ファイルも解答側で include すること、単一ソースファイルであること) も明文化した。

付随する変更

  • docs/spec.* の「既知の制限」節を compatibility へ移設し、リンクに置き換え
  • README.* の謳い文句を「実際に使っている部分/コード」から「実際に使っているヘッダーファイル」へ正確化 (tree-shaking はファイル単位のため)
  • README.* の NOTE を書き直し、維持の仕組みの説明をやめて compatibility への誘導に整理 (実装ファイルが自動追加されると誤読しうるというレビュー指摘への対応)
  • 「実装先の型名」という用語を「実装先の名前」へ全ドキュメント・コードコメントで統一 (implements に記録されるのは型名に限らないため。コードの動作変更なし)
  • docs/cheatsheet.* に「自分のライブラリが対応しているか確認したい」の FAQ を追加
  • どこからもリンクされていなかった cheatsheet への導線を README に追加、仕組み節から spec への導線も追加

日本語版は文脈なしの読者によるテストを 2 巡実施し、指摘 (総括と例の矛盾、未説明の内部用語など) を反映済み。調査過程は #20 のコメント欄に記録している。

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

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: 4813b4bc-e702-4353-abf4-0794df7e93e5

📥 Commits

Reviewing files that changed from the base of the PR and between 943a417 and 11bde78.

📒 Files selected for processing (1)
  • src/library/tags.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/library/tags.rs

📝 Walkthrough

Summary by CodeRabbit

  • ドキュメント
    • README(JA/EN)で、tree-shakingやライブラリ互換性の前提条件、クイックスタート後の導線、開発時の参照先を整理・拡充しました。
    • チートシートに、提出用ファイル生成の説明更新と、互換性確認の具体例(非対応例)を追記しました。
    • 互換条件を体系化したドキュメント(JA/EN)を新規追加し、必要判定の考え方や破綻時の挙動を詳述しました。
    • 仕様・アーキテクチャ・関連文書で「実装対象」を「型」から「名前」へ統一しました。

Walkthrough

ライブラリのバンドル互換条件を英日ドキュメントとして追加し、READMEとcheatsheetから参照できるようにした。あわせて、実装対象の表現を「型名」から「名前」へ統一し、関連する仕様とソースコメントを更新した。

Changes

ライブラリ互換性ドキュメント

Layer / File(s) Summary
互換条件の定義
docs/compatibility.md, docs/compatibility.ja.md
バンドル前提、ファイル単位のtree-shaking、スコープ分割、X-macro、依存検出、include形式などの条件を英日で整理した。
利用案内と互換性確認導線
README.md, README.ja.md, docs/cheatsheet.md, docs/cheatsheet.ja.md
互換性確認、submission.cppの生成内容、機能別説明、開発・仕様資料への案内を更新した。
実装対象名の仕様統一
docs/architecture.md, docs/spec.md, docs/spec.ja.md
実装対象を「型名」ではなく「名前」として説明し、implementsやtree-shakingの仕様に反映した。
ソースコメントの用語整合
src/bundle/inventory.rs, src/library/identifiers.rs, src/library/tags.rs
実装ロジックを変更せず、関連コメントの用語を更新した。

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • TwoSquirrels/risundle#94: ライブラリの自己完結性や互換条件違反の検出・警告に関するIssueで、今回追加された互換条件の文書と関連する。

Possibly related PRs

  • TwoSquirrels/risundle#36: implements と実装対象名に関する仕様・コメント更新と直接関連する。

Poem

互換条件、ぴょんと整え
名前の違いも、すっきり消えて
include の森を、道しるべに
木を刈る仕様を、英日で歌う
うさぎも安心、文書を読むよ 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PRの主変更である互換条件の新規文書化を端的に表しており、内容に合っています。
Description check ✅ Passed 説明文はcompatibility文書の追加と周辺の追従変更を正しく述べています。
Linked Issues check ✅ Passed 十分条件の文書化、非対応例、回避策、既知制限の移設が行われており、#20の要求を満たしています。
Out of Scope Changes check ✅ Passed README、cheatsheet、spec、コメントの用語統一は目的に沿っており、明確な逸脱は見当たりません。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

ファイルの自己完結性・マクロ生成の非対応・識別子検出の走査範囲など、
バンドルが正しく成立する十分条件を docs/compatibility.ja.md にまとめる。
spec.ja.md の「既知の制限」節はここへ移設し、README・cheatsheet からも
リンクする。英語版は日本語版が固まってから翻訳してこの PR に足す。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
生成される名前を素の前方宣言として同じファイルに書けば、登録時に
定義識別子として記録されファイルが維持されることを実験で確認した。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
TwoSquirrels and others added 7 commits July 14, 2026 19:30
cheatsheet はこれまでどこからもリンクされておらず、README を入口に
する読者から辿れなかった。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
「開発」節のリンクは節名から利用者向けと伝わりにくいため、動作を
深く知りたい読者の動線として仕組みの直後にも一行置く。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- 普通のヘッダーオンリーライブラリは無条件で満たすという安心材料
- 条件が問われるのは展開されるライブラリだけという適用範囲
- 解答は単一ソースファイルという前提
- クラス外実装の救済は実装先が登録済みライブラリ内で定義されている
  場合に限る、という精度補正 (std::hash 特殊化だけのファイルは対象外)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
文脈なしの読者による通読テストで見つかった問題を直す。

- 「黙って壊れない」という総括と名前空間ラッパー例の矛盾を解消し、
  非修飾利用だけが唯一の例外であることを明示する
- 壊れ方の数え上げを整理し、std::hash の段落を分類の外に出す
- 未説明の内部用語「ダミー」を消し、keep 衝突の項を結論先行にする
- 「系」「識別子照合」などの硬い語を平易にし、自動フォールバックに
  一言の説明を添える
- 記号演算子には前方宣言の救済が効かないことを明記する
- 複数ソース制限とヘッダー分割の関係、ローカルヘッダー自体は丸ごと
  残ることを補う

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
見出しが処方そのものだが、再テストの読者は本文に回避策が無いと
受け取ったため、一文で明示する。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ダッシュ挿入 2 箇所を丸括弧に、プレゼン口調の前置きと「利点として
働く」を地の文に直す。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
日本語版で行った変更 (spec の既知の制限の移設、README の粒度表記と
NOTE のエラー種別、cheatsheet の FAQ 追加) を英語側にミラーする。
両言語版に相互の言語リンク行も付ける。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@TwoSquirrels
TwoSquirrels marked this pull request as ready for review July 15, 2026 00:18

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

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 `@README.md`:
- Around line 12-18: README.md lines 12-18: revise the English feature wording
to state that only headers and implementation files determined necessary for
bundling remain, not merely directly used headers. Apply the equivalent
clarification in README.ja.md lines 12-18. Update docs/cheatsheet.md line 48 and
docs/cheatsheet.ja.md line 48 to describe retaining files required by the bundle
rather than files directly used by main.cpp.
- Around line 20-21: Clarify the implementation-file behavior in the NOTE at
README.md lines 20-21 by stating that only already included files appearing in
the output are preserved and that implementation files must be explicitly
included alongside declarations; make the equivalent clarification in
README.ja.md lines 20-21, using wording that conveys only files appearing in the
output are retained and implementation files require explicit inclusion.
🪄 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: b96e7771-67ae-418d-abf9-3550beaeb780

📥 Commits

Reviewing files that changed from the base of the PR and between d527adf and 04dd57f.

📒 Files selected for processing (8)
  • README.ja.md
  • README.md
  • docs/cheatsheet.ja.md
  • docs/cheatsheet.md
  • docs/compatibility.ja.md
  • docs/compatibility.md
  • docs/spec.ja.md
  • docs/spec.md

Comment thread README.md
Comment thread README.md Outdated
TwoSquirrels and others added 2 commits July 15, 2026 10:34
「実装ファイルを辿って維持します」が自動追加と誤読され得るという
レビュー指摘への対応。維持の仕組み (実装先の型名) は README で説明
せず、「行儀の良いライブラリだけ対応」という結論と限界の例だけを
残して詳細は compatibility 文書へ誘導する。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
implements に記録されるのは型名に限らない (関数テンプレートの明示的
特殊化では関数名、修飾側が namespace のこともある) ため、実態に合う
呼び方へドキュメントとコードコメントを一括で改める。spec の定義文も
「どの型 (や関数テンプレート) の実装か」に正確化する。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

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

Actionable comments posted: 1

🤖 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 `@docs/spec.ja.md`:
- Line 21: 実装対象名を型に限定する表現を、実装先の名前全般を示す表現へ統一してください。docs/spec.ja.md
の「どの型」、docs/spec.md の “which type”、および src/library/tags.rs
の「対象とする型名」を、関数テンプレートの主テンプレート名も含む「実装先の名前」または同等の表現に変更してください。
🪄 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: 88b2c157-2f80-41df-87b1-96726aa4d6ab

📥 Commits

Reviewing files that changed from the base of the PR and between 04dd57f and 943a417.

📒 Files selected for processing (10)
  • README.ja.md
  • README.md
  • docs/architecture.md
  • docs/compatibility.ja.md
  • docs/compatibility.md
  • docs/spec.ja.md
  • docs/spec.md
  • src/bundle/inventory.rs
  • src/library/identifiers.rs
  • src/library/tags.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • docs/compatibility.ja.md
  • README.md
  • README.ja.md
  • docs/compatibility.md

Comment thread docs/spec.ja.md
「実装先の型名」の文字列一致だけで置換したため、言い回しの違う
この 1 箇所が漏れていた (レビュー指摘)。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@TwoSquirrels
TwoSquirrels merged commit 2888b69 into main Jul 15, 2026
10 checks passed
@TwoSquirrels
TwoSquirrels deleted the docs/compatibility branch July 15, 2026 03:28
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