Fix importer scalar option path resolution#59
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe PR adds a ChangesPath Resolution Control for Importer Options
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
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.
Pull request overview
This PR refines how yii import resolves importer option values by making filesystem path resolution an explicit opt-in, preventing scalar options (like Telegram’s ignore_message_ids) from being incorrectly treated as paths.
Changes:
- Added
ImporterOption::$resolvePathto explicitly mark which importer options should be resolved relative to the project root. - Updated
ImportCommandto resolve paths only for options withresolvePath: true, and set this for Telegram’s--directory. - Added a regression test and documentation updates describing the intended behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/Console/ImportCommandTest.php | Adds a test ensuring scalar importer options aren’t path-resolved. |
| src/Import/Telegram/TelegramContentImporter.php | Marks directory option as resolvePath: true while keeping scalar options literal. |
| src/Import/ImporterOption.php | Introduces the new resolvePath flag on importer options. |
| src/Console/ImportCommand.php | Applies path resolution conditionally based on ImporterOption::$resolvePath. |
| docs/importing-content.md | Documents how importer authors should use resolvePath. |
| docs/commands.md | Documents Telegram importer behavior for scalar options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ``` | ||
|
|
||
| - **`name`** — option name, used as `--name` on the CLI and as key in the `$options` array. | ||
| - **`description`** — help text shown in `yii import --help`. |
| - `--directory` — path to the Telegram export directory containing `result.json` (required). Absolute or relative to project root. | ||
| - `--ignore_message_ids` — comma-separated message IDs to skip. This is treated as a literal scalar value, not a path. |
| * Each importer returns a list of these from {@see ContentImporterInterface::options()}. | ||
| * The `yii import` command registers them as CLI options and passes resolved values to the importer. | ||
| * Set `$resolvePath` to true only for options that represent filesystem paths. |
Summary
Tests
Summary by CodeRabbit
New Features
--ignore_message_idsoption for Telegram imports to selectively skip specific message IDs from being imported.Bug Fixes
Documentation
Tests