Skip to content

Phase 10 review fixes: source guards, shared quality trait, dompdf Blade corrections#142

Merged
menvil merged 1 commit into
developfrom
fix/phase10-review-fixes
Jun 1, 2026
Merged

Phase 10 review fixes: source guards, shared quality trait, dompdf Blade corrections#142
menvil merged 1 commit into
developfrom
fix/phase10-review-fixes

Conversation

@menvil

@menvil menvil commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

All 8 review findings were valid. Changes kept minimal.

Fixes applied

Source file existence guards (inline comment)

  • RendersSingleImagePdf: check Storage::disk('local')->exists($storedPath) before get(), throw RuntimeException with path context if missing
  • All 4 image drivers (PngToJpg, JpgToPng, PngToWebp, JpgToWebp): same guard before decodePath() — applied consistently, not just to JpgToWebpDriver

GD procedural code removed (nitpick)

  • RendersSingleImagePdf::resolveOrientation: replaced imagecreatefromstring() / imagesx() / imagesy() with ImageManager::decodeBinary() + ->width() / ->height(); decode failure now throws instead of silently returning 'portrait'

Shared quality trait (nitpick)

  • New Concerns/ResolvesImageQuality trait; PngToJpgDriver, PngToWebpDriver, JpgToWebpDriver now use ResolvesImageQuality — local resolveQuality() methods removed

Unused parameter removed (nitpick)

  • ConversionContextFactory::forSourcePath(): $outputExtension parameter dropped; all 6 driver test files updated to remove the argument

dompdf Blade template (code violations)

  • Replaced display:flex / object-fit (unsupported by dompdf) with table-based centering for contain mode
  • Renamed fill branch to cover (aligns with Phase 4 fit_mode: contain/cover/original)
  • resolvePageSize() added in RendersSingleImagePdf: maps 'auto''a4' before passing to setPaper()

Test plan

  • composer test passes — 268/268 tests
  • composer lint passes

🤖 Generated with Claude Code


Summary by cubic

Improves image conversion reliability and PDF rendering by adding source file guards, fixing orientation detection, and updating the dompdf Blade to supported CSS. Also deduplicates quality handling and removes an unused factory parameter.

  • Bug Fixes

    • Guard source existence before reads in RendersSingleImagePdf and all image drivers; throw RuntimeException with path context.
    • Use intervention/image to decode binaries for orientation; fail fast on decode errors (no silent portrait fallback).
    • dompdf Blade: replace flex/object-fit with table centering for contain, rename fillcover, and map page_size: auto to a4 before setPaper().
  • Refactors

    • Add ResolvesImageQuality trait; remove duplicate resolveQuality() from JPG/PNG/WebP drivers.
    • Drop $outputExtension from ConversionContextFactory::forSourcePath(); update tests accordingly.

Written for commit 74b5856. Summary will update on new commits.

Review in cubic

…de corrections

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • release

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b8009511-a196-4788-8d4d-ce0ba2410ad0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/phase10-review-fixes

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.

@menvil menvil merged commit c217f16 into develop Jun 1, 2026
4 checks passed
@menvil menvil deleted the fix/phase10-review-fixes branch June 1, 2026 18:39
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