Skip to content

Conversation

@ildyria
Copy link
Member

@ildyria ildyria commented Aug 28, 2025

Summary by CodeRabbit

  • Chores

    • Upgraded core framework and several dependencies to stay current.
  • Tests

    • Updated PHPUnit configuration to v11 and reorganized some test classes/namespaces.
  • Bug Fixes

    • File-type detection now surfaces warnings when it cannot determine a file, improving visibility of permission issues.
  • Notes

    • No user-facing feature changes expected; mostly maintenance and internal adjustments.

@ildyria ildyria requested a review from a team as a code owner August 28, 2025 10:13
@coderabbitai
Copy link

coderabbitai bot commented Aug 28, 2025

Warning

Rate limit exceeded

@ildyria has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 50 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbit review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 88db641 and 3367be8.

📒 Files selected for processing (2)
  • app/Actions/Import/Pipes/BuildTree.php (2 hunks)
  • tests/LoadedSubscriber.php (2 hunks)
📝 Walkthrough

Walkthrough

Multiple dependency bumps (Laravel, Safe, lycheeverify, PHPUnit) plus small code updates: Safe imports used, a SizeVariant method renamed, resource call sites updated, PHPUnit schema versions bumped, and several test classes/namespaces adjusted. No functional behavior changes beyond Safe wrapper and method rename.

Changes

Cohort / File(s) Summary of changes
Composer / deps
composer.json
Bumped requirements: laravel/framework ^11.0 → ^12.0, lychee-org/lycheeverify ^1.0.2 → ^1.0.3, thecodingmachine/safe ^2.4 → ^3.3; dev: phpunit/phpunit ^10.0 → ^11.0.
PHPUnit schema files
phpunit.xml, phpunit.ci.xml, phpunit.pgsql.xml
Updated root <phpunit> xsi:noNamespaceSchemaLocation from PHPUnit 10.1 XSD to 11.0 XSD.
Safe imports / filesystem & regex usage
app/Actions/Import/Pipes/BuildTree.php, app/Console/Commands/FixPermissions.php
Added Safe\ imports (preg_replace_callback, filetype); replaced preg callback with an inline arrow function; filetype() now resolves to Safe wrapper (exceptions flow into existing catch).
SizeVariant API and consumers
app/Models/SizeVariant.php, app/Http/Resources/Models/SizeVariantsResouce.php
Renamed SizeVariant::toResource(bool $no_url = false)toDataResource(bool $no_url = false) and updated all call sites in the size-variants resource to use toDataResource.
Test renames / namespace adjustments
tests/Feature_v2/Commands/GenerateThumbsTest.php, tests/Feature_v2/Image/WatermarkerTest.php, tests/Feature_v2/SmartAlbums/OverridePermissionsTest.php
Renamed test class CommandGenerateThumbsTestGenerateThumbsTest; changed namespace for WatermarkerTest and made it extend Tests\Feature_v2\Image\Handlers\BaseImageHandler; adjusted OverridePermissionsTest namespace to Tests\Feature_v2\SmartAlbums. No test logic changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I twitch my whiskers, tap my paw,
Safe imports snug, dependencies soar,
A method renamed, tests hop in line,
I nibble diffs and stamp "All fine!" 🥕🐇

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch laravel-12

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 585606f and f2df787.

⛔ Files ignored due to path filters (1)
  • composer.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • composer.json (3 hunks)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: 3️⃣ PHP dist / 8.4 - postgresql
  • GitHub Check: 3️⃣ PHP dist / 8.3 - mariadb
  • GitHub Check: 3️⃣ PHP dist / 8.4 - mariadb
  • GitHub Check: 3️⃣ PHP dist / 8.3 - postgresql
  • GitHub Check: 3️⃣ PHP dist / 8.3 - sqlite
  • GitHub Check: 3️⃣ PHP dist / 8.4 - sqlite
🔇 Additional comments (3)
composer.json (3)

65-65: Verify lycheeverify upgrade to ^1.0.3
Confirm no new PHP/Laravel version constraints and that our override for lychee-org/lycheeverify still resolves correctly.


61-61: Run composer install and verify Laravel 12 compatibility
Before merging, install dependencies and rerun the dry-run and why-not checks, then confirm each ecosystem package supports Laravel 12 and PHP 8.3 (e.g., barryvdh/laravel-debugbar, graham-campbell/markdown, larastan, opcodesio/log-viewer, socialiteproviders/, spatie/laravel-, laragear/webauthn, laravel/socialite).

Suggested commands:

composer install
composer update laravel/framework --with-all-dependencies --dry-run || true
composer why-not laravel/framework ^12.0 || true
composer outdated --direct || true
rg -nP 'opcodesio/log-viewer|graham-campbell/markdown|larastan|debugbar|spatie/laravel-|laragear/webauthn|laravel/socialite|socialiteproviders' composer.json

92-92: Safe namespace imports are correct

All Safe function calls use the fully qualified \Safe\… namespace and are covered by Composer’s autoload. No missing use function Safe\… statements detected.

Copy link

@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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/Actions/Import/Pipes/BuildTree.php (1)

251-254: Ignore-list filtering logic inverted

Doc says “ignore lines that are empty or start with #”, but the predicate keeps empty lines. Fix to keep only non-empty, non-comment entries.

-			$result = array_filter($result, fn ($v) => $v === '' || !str_starts_with($v, '#'));
+			$result = array_filter($result, fn (string $v): bool => $v !== '' && !str_starts_with($v, '#'));
🧹 Nitpick comments (8)
tests/Feature_v2/Image/WatermarkerTest.php (3)

111-116: Remove duplicate config set call.

Configs::set('watermark_photo_id', $photoId); is called twice; drop the duplicate.

Apply this diff:

-		Configs::set('watermark_photo_id', $photoId);
		Configs::set('watermark_photo_id', $photoId);

176-181: Remove duplicate config set call.

Same duplication here; keep a single assignment.

-		Configs::set('watermark_photo_id', $photoId);
		Configs::set('watermark_photo_id', $photoId);

62-71: Prefer assertTrue/assertFalse over assertEquals for booleans.

Improves intent and strictness.

-		self::assertEquals(false, $watermarker->can_watermark);
+		self::assertFalse($watermarker->can_watermark);

(Apply similarly on Lines 70, 79, 88, 118, 185.)

app/Console/Commands/FixPermissions.php (2)

141-143: Add parentheses to clarify precedence in recursion condition

Without parentheses, the intention is easy to misread. No behavior change, just readability.

-					if ($dir_entry->isDir() && !$dir_entry->isDot() || $dir_entry->isFile()) {
+					if (($dir_entry->isDir() && !$dir_entry->isDot()) || $dir_entry->isFile()) {

146-147: Avoid manual newline in console warning

Symfony’s console methods handle newlines; the explicit PHP_EOL creates an extra blank line.

-		} catch (FilesystemException) {
-			$this->warn(sprintf('Unable to determine permissions for %s' . PHP_EOL, $path));
+		} catch (FilesystemException) {
+			$this->warn(sprintf('Unable to determine permissions for %s', $path));
app/Actions/Import/Pipes/BuildTree.php (1)

216-219: Strengthen regex for UTF‑8 and type the callback

Use the Unicode modifier and a typed arrow function to avoid splitting multibyte chars and aid static analysis.

-		$pattern = preg_replace_callback('/([^*])/', fn($a) => self::preg_quote_callback_fct($a), $pattern);
+		$pattern = preg_replace_callback('/([^*])/u', fn (array $m): string => self::preg_quote_callback_fct($m), $pattern);
 		$pattern = str_replace('*', '.*', $pattern);
-
-		return preg_match('/^' . $pattern . '$/i', $filename) === 1;
+		return preg_match('/^' . $pattern . '$/iu', $filename) === 1;

Alternative (simpler and faster):

$pattern = preg_quote($pattern, '/');
$pattern = str_replace('\*', '.*', $pattern);
return preg_match('/^' . $pattern . '$/iu', $filename) === 1;
app/Http/Resources/Models/SizeVariantsResouce.php (1)

20-20: Typo in class name “SizeVariantsResouce”

PSR-4 and readability: consider renaming to “SizeVariantsResource” (file and class). If you defer, at least add a @deprecated alias.

app/Models/SizeVariant.php (1)

202-205: Public API rename — consider BC alias

Add a deprecated toResource() wrapper to reduce downstream breakage during the Laravel 12 upgrade.

 	public function toDataResource(bool $no_url = false): SizeVariantResource
 	{
 		return new SizeVariantResource($this, no_url: $no_url);
 	}
+
+	/**
+	 * @deprecated Use toDataResource() instead. Will be removed in a future release.
+	 */
+	public function toResource(bool $no_url = false): SizeVariantResource
+	{
+		return $this->toDataResource($no_url);
+	}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f2df787 and 88db641.

📒 Files selected for processing (10)
  • app/Actions/Import/Pipes/BuildTree.php (2 hunks)
  • app/Console/Commands/FixPermissions.php (1 hunks)
  • app/Http/Resources/Models/SizeVariantsResouce.php (1 hunks)
  • app/Models/SizeVariant.php (1 hunks)
  • phpunit.ci.xml (1 hunks)
  • phpunit.pgsql.xml (1 hunks)
  • phpunit.xml (1 hunks)
  • tests/Feature_v2/Commands/GenerateThumbsTest.php (1 hunks)
  • tests/Feature_v2/Image/WatermarkerTest.php (1 hunks)
  • tests/Feature_v2/SmartAlbums/OverridePermissionsTest.php (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.php

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.php: Any new PHP file must include the license header and have a single blank line after the opening <?php tag
Use snake_case for PHP variable names
Apply PSR-4 coding standard
Always call in_array with strict mode: in_array($needle, $haystack, true)
Use only booleans in if conditions; avoid integers or strings
Use strict comparison (===, !==) instead of loose comparison (==, !=)
Avoid duplicating code in both if and else branches
Do not use empty(); prefer explicit checks

Files:

  • app/Http/Resources/Models/SizeVariantsResouce.php
  • app/Models/SizeVariant.php
  • tests/Feature_v2/Commands/GenerateThumbsTest.php
  • tests/Feature_v2/SmartAlbums/OverridePermissionsTest.php
  • app/Console/Commands/FixPermissions.php
  • tests/Feature_v2/Image/WatermarkerTest.php
  • app/Actions/Import/Pipes/BuildTree.php
app/{Http/Resources,Data}/**/*.php

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Resource classes should extend Spatie Data instead of JsonResource

Files:

  • app/Http/Resources/Models/SizeVariantsResouce.php
tests/Feature_v2/**/*.php

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Feature_v2 tests should extend BaseApiWithDataTest

Files:

  • tests/Feature_v2/Commands/GenerateThumbsTest.php
  • tests/Feature_v2/SmartAlbums/OverridePermissionsTest.php
  • tests/Feature_v2/Image/WatermarkerTest.php
tests/**/*.php

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Do not mock the database in tests; use the in-memory SQLite database

Files:

  • tests/Feature_v2/Commands/GenerateThumbsTest.php
  • tests/Feature_v2/SmartAlbums/OverridePermissionsTest.php
  • tests/Feature_v2/Image/WatermarkerTest.php
🧠 Learnings (1)
📚 Learning: 2025-08-24T07:15:25.203Z
Learnt from: CR
PR: LycheeOrg/Lychee#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-24T07:15:25.203Z
Learning: Applies to tests/Feature_v2/**/*.php : Feature_v2 tests should extend BaseApiWithDataTest

Applied to files:

  • tests/Feature_v2/Commands/GenerateThumbsTest.php
  • tests/Feature_v2/SmartAlbums/OverridePermissionsTest.php
  • tests/Feature_v2/Image/WatermarkerTest.php
🧬 Code graph analysis (4)
app/Http/Resources/Models/SizeVariantsResouce.php (1)
app/Models/SizeVariant.php (1)
  • toDataResource (202-205)
app/Models/SizeVariant.php (1)
resources/js/lychee.d.ts (1)
  • SizeVariantResource (557-565)
tests/Feature_v2/Commands/GenerateThumbsTest.php (1)
tests/Feature_v2/Base/BaseApiWithDataTest.php (1)
  • BaseApiWithDataTest (91-249)
tests/Feature_v2/Image/WatermarkerTest.php (1)
tests/Feature_v2/Image/Handlers/BaseImageHandler.php (1)
  • BaseImageHandler (40-604)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: 2️⃣ PHP tests / 8.4 - mariadb -- Unit,Feature_v2
  • GitHub Check: 2️⃣ PHP tests / 8.4 - postgresql -- Unit,Feature_v2
  • GitHub Check: 2️⃣ PHP tests / 8.4 - sqlite -- Unit,Feature_v2
  • GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- Unit,Feature_v2
  • GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- Unit,Feature_v2
  • GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- Unit,Feature_v2
🔇 Additional comments (11)
phpunit.xml (1)

2-2: Schema bump to PHPUnit 11 is correct; existing elements remain valid.

<coverage><report><text showUncoveredFiles="false"/> and <extensions><bootstrap .../> are supported in PHPUnit 11, so no further config changes are required. LGTM. (docs.phpunit.de)

phpunit.ci.xml (1)

2-2: Consistent schema update to 11.0; config is compatible.

The <extensions> registration pattern and coverage config continue to be valid in PHPUnit 11. LGTM. (docs.phpunit.de)

phpunit.pgsql.xml (1)

2-2: PHPUnit 11 schema bump looks good.

No incompatible elements detected; <coverage> and <report> usage match PHPUnit 11 docs. LGTM. (docs.phpunit.de)

tests/Feature_v2/Image/WatermarkerTest.php (2)

19-19: Namespace realignment is fine.

Moving the test under Tests\Feature_v2\Image keeps PSR-4 and PHPUnit discovery intact. LGTM.


26-26: Extending the correct base for Feature_v2 tests.

Importing Handlers\BaseImageHandler ensures inheritance from BaseApiWithDataTest via the chain. LGTM.

tests/Feature_v2/Commands/GenerateThumbsTest.php (1)

28-28: Class rename matches filename and PSR-4.

Test base remains BaseApiWithDataTest. LGTM.

app/Console/Commands/FixPermissions.php (1)

18-18: Safe wrapper adoption for filetype — good change

Ensures exceptions are thrown and caught consistently with other Safe FS calls.

app/Actions/Import/Pipes/BuildTree.php (1)

25-25: Safe\preg_replace_callback import — good

Aligns with Safe usage elsewhere; consistent error handling.

tests/Feature_v2/SmartAlbums/OverridePermissionsTest.php (2)

19-19: Namespace aligns with path

Matches folder structure and autoloading.


24-24: Extends BaseApiWithDataTest as required

Conforms to Feature_v2 testing guideline.

app/Http/Resources/Models/SizeVariantsResouce.php (1)

47-54: Confirm no toResource() usages remain
Search for toResource( across PHP files returned no results; please manually verify there are no remaining calls in strings, comments, or other code paths.

@codecov
Copy link

codecov bot commented Aug 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.18%. Comparing base (585606f) to head (3367be8).
⚠️ Report is 1 commits behind head on master.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria ildyria merged commit 5c3bd3f into master Aug 31, 2025
36 checks passed
@ildyria ildyria deleted the laravel-12 branch August 31, 2025 08:34
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