Skip to content

Support live photos conversion#507

Merged
rob93c merged 2 commits into
mainfrom
support-live-photos-conversion
Jun 2, 2026
Merged

Support live photos conversion#507
rob93c merged 2 commits into
mainfrom
support-live-photos-conversion

Conversation

@rob93c
Copy link
Copy Markdown
Member

@rob93c rob93c commented Jun 1, 2026

Summary by CodeRabbit

  • New Features

    • Added Live Photo support for conversion and handling in media workflows.
  • Improvements

    • More reliable file-size handling and stricter download eligibility for large files.
  • Tests

    • Added tests validating Live Photo conversion and bot handling.
    • Expanded test fixtures to cover additional media formats.

@rob93c rob93c self-assigned this Jun 1, 2026
@rob93c rob93c added the enhancement New feature or request label Jun 1, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7328f8cb-d815-45e8-9a8c-4b119da4f322

📥 Commits

Reviewing files that changed from the base of the PR and between d9655df and ceb0e0d.

📒 Files selected for processing (2)
  • src/main/java/com/github/stickerifier/stickerify/telegram/model/TelegramFile.java
  • src/main/java/com/github/stickerifier/stickerify/telegram/model/TelegramRequest.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/github/stickerifier/stickerify/telegram/model/TelegramFile.java

📝 Walkthrough

Walkthrough

The PR adds Live Photo media support by making TelegramFile.size nullable with a sizeValue() accessor, extending TelegramRequest.getFile() to extract LivePhoto and inline Video handling, updating photo selection to use sizeValue, and adding mocks and tests for Live Photo conversion and bot integration.

Changes

Live Photo Media Support

Layer / File(s) Summary
TelegramFile nullability refactor
src/main/java/com/github/stickerifier/stickerify/telegram/model/TelegramFile.java
TelegramFile record signature changed from long size to @Nullable Long size. Constants NOT_SUPPORTED and TOO_LARGE updated. canBeDownloaded() now requires non-null positive size within limits. New sizeValue() accessor returns -1L for null sizes.
LivePhoto media extraction and selection
src/main/java/com/github/stickerifier/stickerify/telegram/model/TelegramRequest.java
TelegramRequest.getFile() now imports and handles LivePhoto, includes message.livePhoto() in candidates, maps LivePhoto/video fileId/fileSize to TelegramFile, and selects best photo using TelegramFile::sizeValue.
Test mock responses
src/test/java/com/github/stickerifier/stickerify/bot/MockResponses.java
GIF_FILE mock payload key changed from sticker to document. New LIVE_PHOTO_FILE mock added containing Telegram-style photo array and nested live_photo object with file_id, file_size, and frame references.
Bot integration test for Live Photo
src/test/java/com/github/stickerifier/stickerify/bot/StickerifyTest.java
New convertedLivePhoto() test verifies end-to-end bot handling: enqueues Live Photo, mocks getFile and download, asserts sendDocument contains FILE_READY.
Media conversion test for Live Photo
src/test/java/com/github/stickerifier/stickerify/media/MediaHelperTest.java
New convertLivePhoto() test (Tags.VIDEO) validates MediaHelper.convert output for valid_live_photo fixture: 384×512, 30F frame rate, 2.966F duration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

unit test

Suggested reviewers

  • MartelliEnrico

Poem

🐰 A photo wakes in frames so bright,
Null sizes hop into the light,
LivePhoto folds its nested cheer,
Stickerify converts — send the file, my dear!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Support live photos conversion' directly and clearly summarises the main objective of the changeset, which adds live photo handling across the codebase including model updates, request processing, and comprehensive test coverage.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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
Copy Markdown
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

🤖 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
`@src/main/java/com/github/stickerifier/stickerify/telegram/model/TelegramFile.java`:
- Around line 12-13: The canBeDownloaded() method in TelegramFile treats
negative sizes as downloadable; update TelegramFile.canBeDownloaded() to require
size to be non-null, non-negative, and <= MAX_DOWNLOADABLE_FILE_SIZE_IN_BYTES
(i.e., change the condition to include size >= 0). Ensure the check references
the existing size field and MAX_DOWNLOADABLE_FILE_SIZE_IN_BYTES constant so
negative values are rejected.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b3b9d0a2-874d-4ba0-8a65-45562008f430

📥 Commits

Reviewing files that changed from the base of the PR and between c9ed3d7 and d9655df.

📒 Files selected for processing (6)
  • src/main/java/com/github/stickerifier/stickerify/telegram/model/TelegramFile.java
  • src/main/java/com/github/stickerifier/stickerify/telegram/model/TelegramRequest.java
  • src/test/java/com/github/stickerifier/stickerify/bot/MockResponses.java
  • src/test/java/com/github/stickerifier/stickerify/bot/StickerifyTest.java
  • src/test/java/com/github/stickerifier/stickerify/media/MediaHelperTest.java
  • src/test/resources/valid_live_photo

Comment thread src/main/java/com/github/stickerifier/stickerify/telegram/model/TelegramFile.java Outdated
@rob93c rob93c force-pushed the support-live-photos-conversion branch from d9655df to ceb0e0d Compare June 1, 2026 17:22
@rob93c rob93c requested a review from MartelliEnrico June 1, 2026 17:28
Copy link
Copy Markdown
Contributor

@MartelliEnrico MartelliEnrico left a comment

Choose a reason for hiding this comment

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

LGTM

@rob93c rob93c merged commit 8e1945e into main Jun 2, 2026
8 checks passed
@rob93c rob93c deleted the support-live-photos-conversion branch June 2, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants