Skip to content

Conversation

@koriym
Copy link
Member

@koriym koriym commented Jan 9, 2026

Summary

Add documentation for the new DataLoader feature that solves N+1 problems in Crawl operations.

Related PR: bearsunday/BEAR.Resource#346

Content Added (EN & JA)

  • Explanation of N+1 problem in Crawl
  • DataLoader pattern introduction (with reference to Facebook's DataLoader)
  • Implementation example using Aura.Sql
  • Alternative example using Ray.MediaQuery pattern (in comments)
  • Key inference from URI template
  • Multiple key support

Summary by CodeRabbit

  • ドキュメント
    • リソースリンクガイドに DataLoader の解説と使用例を追加しました。N+1 問題の回避、クエリのバッチ処理、Link 属性を使ったワイヤリング、複数キー(複合キー)処理やキー推論の説明を含みます。
    • 同内容が文書内に重複して含まれています。

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 9, 2026

Walkthrough

resource_link.mdガイドにDataLoaderの説明と使用例を追加。クエリのバッチ処理(N+1回避)に関する概念、図解、MetaDataLoaderの実装例、Link属性での配線方法、URIテンプレートからのキー推論と複数キー処理例を含む内容が追加され、同内容のブロックが文書内に重複して存在する。

Changes

Cohort / File(s) Change Summary
英語ドキュメント:DataLoader導入
manuals/1.0/en/resource_link.md
DataLoaderの概念説明、比較図(DataLoaderなし/あり)、MetaDataLoader実装例(DataLoaderInterface準拠、__invoke(array $queries): arrayでの一括INクエリ)、Link属性でのdataLoader: MetaDataLoader::class配線例、URIテンプレートからのキー推論テーブル、複数キー(例:(post_id, locale))のバッチ・配布例を追加。
日本語ドキュメント:DataLoader導入
manuals/1.0/ja/resource_link.md
英語版と同様のDataLoader説明と実装例を追加。MetaDataLoaderクラス例(シグネチャ記載)、バッチング振る舞い説明、キー推論と複数キー処理の具体例を追加。
重複ブロック
manuals/1.0/en/resource_link.md, manuals/1.0/ja/resource_link.md
同一またはほぼ同一のDataLoader説明・実装例ブロックが文書内で重複して追加されている(並列デモンストレーション)。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 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 プルリクエストのタイトルはリソースリンクドキュメントへのDataLoaderセクション追加という変更内容と完全に一致している。
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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @manuals/1.0/en/resource_link.md:
- Around line 215-220: The fenced code block containing the ASCII diagram (the
triple-backtick block wrapping "Author (1 query) └── Post × 3 ...") lacks a
language identifier; update the opening fence to include a language such as
"text" or "plaintext" (i.e., change the opening ``` to ```text) so the Markdown
linter warning is resolved while leaving the diagram content unchanged.
- Around line 223-227: The fenced code block in the snippet showing the ASCII
tree lacks a language identifier; update the block in
manuals/1.0/en/resource_link.md so the opening fence is ```text (or another
appropriate tag) instead of just ```, ensuring the closing fence remains ```, to
satisfy the Markdown linter.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7f2f71 and 84d0a92.

📒 Files selected for processing (1)
  • manuals/1.0/en/resource_link.md
🧰 Additional context used
📓 Path-based instructions (1)
manuals/1.0/{en,ja}/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

All documentation markdown files should be placed in 'manuals/1.0/{en,ja}/' directories.

Files:

  • manuals/1.0/en/resource_link.md
🪛 markdownlint-cli2 (0.18.1)
manuals/1.0/en/resource_link.md

215-215: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


223-223: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (1)
manuals/1.0/en/resource_link.md (1)

207-305: DataLoaderセクションは包括的で構造が良好です。

新しいセクションは、N+1問題の説明から実装例、キー推論まで、分かりやすく段階的に説明されています。PHP実装例(行233-265と行295-305)は正しく言語識別子が指定されており、コード品質も高いです。

Comment on lines +215 to +220
```
Author (1 query)
└── Post × 3 (1 query, returns 3)
└── Meta (3 queries) ← N+1 problem!
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

フェンスコードブロックに言語識別子を指定してください。

マークダウンリンタの警告に従い、コードブロックに言語を指定する必要があります。このテキスト図には text または plaintext を使用してください。

修正案
-```
+```text
 Author (1 query)
 └── Post × 3 (1 query, returns 3)
     └── Meta (3 queries) ← N+1 problem!
-```
+```
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

215-215: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In @manuals/1.0/en/resource_link.md around lines 215 - 220, The fenced code
block containing the ASCII diagram (the triple-backtick block wrapping "Author
(1 query) └── Post × 3 ...") lacks a language identifier; update the opening
fence to include a language such as "text" or "plaintext" (i.e., change the
opening ``` to ```text) so the Markdown linter warning is resolved while leaving
the diagram content unchanged.

Comment on lines +223 to +227
```
Author (1 query)
└── Post × 3 (1 query)
└── Meta (1 batched query) ← Solved!
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

フェンスコードブロックに言語識別子を指定してください。

マークダウンリンタの警告に従い、このテキスト図にも言語識別子を追加してください。

修正案
-```
+```text
 Author (1 query)
 └── Post × 3 (1 query)
     └── Meta (1 batched query) ← Solved!
-```
+```
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

223-223: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In @manuals/1.0/en/resource_link.md around lines 223 - 227, The fenced code
block in the snippet showing the ASCII tree lacks a language identifier; update
the block in manuals/1.0/en/resource_link.md so the opening fence is ```text (or
another appropriate tag) instead of just ```, ensuring the closing fence remains
```, to satisfy the Markdown linter.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @manuals/1.0/ja/resource_link.md:
- Around line 206-210: Add a language specifier "text" to the fenced code blocks
that contain the ASCII-art diagrams so they comply with Markdownlint; locate the
blocks that start with the diagram lines "Author (1クエリ)" and change the opening
fence from ``` to ```text for both occurrences (the block around the diagram
showing "Meta (3クエリ) ← N+1問題!" and the block showing "Meta (1バッチクエリ) ← 解決!"),
leaving the closing fences as ``` unchanged.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 84d0a92 and a79ba05.

📒 Files selected for processing (1)
  • manuals/1.0/ja/resource_link.md
🧰 Additional context used
📓 Path-based instructions (1)
manuals/1.0/{en,ja}/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

All documentation markdown files should be placed in 'manuals/1.0/{en,ja}/' directories.

Files:

  • manuals/1.0/ja/resource_link.md
🪛 markdownlint-cli2 (0.18.1)
manuals/1.0/ja/resource_link.md

206-206: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


214-214: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (1)
manuals/1.0/ja/resource_link.md (1)

197-296: DataLoaderドキュメンテーションは包括的で構成が適切です。

DataLoaderセクション全体を確認しました。以下の点が優れています:

  • N+1問題の明確な説明とビジュアル化
  • 実装例が実用的で、Aura.SqlとRay.MediaQueryの両方のパターンを提示
  • URIテンプレートからのキー推論の明確な表説明
  • 複数キーの処理例が具体的

構成と内容は指針に準拠しており、読者にとって実装が容易です。

Comment on lines +206 to +210
```
Author (1クエリ)
└── Post × 3 (1クエリ、3件返却)
└── Meta (3クエリ) ← N+1問題!
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

コードブロックの言語指定を追加してください。

Markdownlintの規則に従い、フェンスされたコードブロックには言語指定が必要です。ASCIIアートダイアグラムの場合はtextを指定してください。

📝 推奨される修正
-```
+```text
 Author (1クエリ)
 └── Post × 3 (1クエリ、3件返却)
     └── Meta (3クエリ) ← N+1問題!
-```
+```

同様に214行目も修正してください:

-```
+```text
 Author (1クエリ)
 └── Post × 3 (1クエリ)
     └── Meta (1バッチクエリ) ← 解決!
-```
+```

Also applies to: 214-218

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

206-206: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In @manuals/1.0/ja/resource_link.md around lines 206 - 210, Add a language
specifier "text" to the fenced code blocks that contain the ASCII-art diagrams
so they comply with Markdownlint; locate the blocks that start with the diagram
lines "Author (1クエリ)" and change the opening fence from ``` to ```text for both
occurrences (the block around the diagram showing "Meta (3クエリ) ← N+1問題!" and the
block showing "Meta (1バッチクエリ) ← 解決!"), leaving the closing fences as ```
unchanged.

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.

2 participants