production: bin/compile.php must load .compile.php explicitly - #386
production: bin/compile.php must load .compile.php explicitly#386koriym wants to merge 1 commit into
Conversation
Walkthrough英語版・日本語版の本番コンパイル手順を更新し、 Changesコンパイル手順
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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: 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 `@manuals/1.0/ja/production.md`:
- Line 233:
「記述することによってコンパイルをすることができます」という冗長な表現を、「記述することでコンパイルできます」など、簡潔で自然な表現に修正してください。
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7c9ca1b3-e358-48b3-b122-f5fa9e59b045
📒 Files selected for processing (2)
manuals/1.0/en/production.mdmanuals/1.0/ja/production.md
| ### .compile.php | ||
| ### .compile.php {: #compile-php } | ||
|
|
||
| 実環境ではないと生成ができないクラス(例えば認証が成功しないとインジェクトが完了しないResourceObject)がある場合には、コンパイル時にのみ読み込まれるダミークラス読み込みをルートの`.compile.php`に記述することによってコンパイルをすることができます。 |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
冗長な表現を簡潔にしてください。
「記述することによってコンパイルをすることができます」は、「記述することでコンパイルできます」などにすると自然です。
🧰 Tools
🪛 LanguageTool
[uncategorized] ~233-~233: 「ことができる」という表現は冗長な可能性があります。
Context: ...込みをルートの.compile.phpに記述することによってコンパイルをすることができます。 注意(BEAR.Package 1.21+): `Compil...
(DOUSI_KOTOGADEKIRU)
🤖 Prompt for 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.
In `@manuals/1.0/ja/production.md` at line 233,
「記述することによってコンパイルをすることができます」という冗長な表現を、「記述することでコンパイルできます」など、簡潔で自然な表現に修正してください。
Source: Linters/SAST tools
8692299 to
a6efbe7
Compare
Compiler::fromInjector() (BEAR.Package 1.21+) does not auto-load the root .compile.php the way the deprecated bear.compile did, so the app-owned bin/compile.php has to require it. Update the compile example and the .compile.php section (ja/en), add a stable #compile-php anchor, fix the broken $_SERVER[__REQUIRED_KEY__] example, and add a caution that fake values get baked into the compiled scripts. Refs bearsunday/BEAR.Package#482 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
a6efbe7 to
c19f36f
Compare
|
ありがとうございます。どちらの点も納得できます。 2番について: これを独自のオプションステップ(例: |
Summary
The compile docs described the
bear.compileera and never said when ahead-of-time compilation is actually needed, nor thatCompiler::fromInjector()/bin/compile.php(BEAR.Package 1.21+, bearsunday/BEAR.Package#482) does not auto-load the root.compile.phpthe waybear.compiledid. A reader who followed the migration and wrote a.compile.phpwould find it silently ignored, and nothing framed the fake-env baking pitfall.Changes (ja / en)
/tmp— combine writable-path override, AOT reuse, and.compile.php, and resolve runtime-variable values at runtime instead of baking them)..compile.phpis orthogonal — it addresses compile-time constructability (e.g. authentication, which is absent during compile) and can be needed even on the deploy target.bin/compile.phpexample now loads.compile.php(guardedrequire), matching the skeleton..compile.phpsection: a Note thatfromInjector()does not auto-load it, and sharpened guidance that its contents should be null objects (compile-time constructability, including auth-dependent resources) — not fakes of values that must be real at runtime, which get baked into the compiled scripts.#compilationanchor on the Compilation heading (linked from the skeleton'sbin/compile.phpdocblock@see).$_SERVER[__REQUIRED_KEY__](undefined constant, fatal on PHP 8) →$_SERVER['YOUR_REQUIRED_ENV'].opcache.preloadis per-process, so each context's evacuatedpreload.phpis wired to its own PHP process (explains themvstep and the example's asymmetry); linkopcache.preloadto the PHP preloading page.autoload.phpis a no-preload optimization / fallback (redundant when preloading — use composer'svendor/autoload.php); fix two typos (dumpa-autoload,autload.php).Companion skeleton change in bearsunday/BEAR.Skeleton (loads
.compile.phpinbin/compile.php).Refs bearsunday/BEAR.Package#482
🤖 Generated with Claude Code