Skip to content

regression: preserve gif animation and correct thumbnail after sharp bump - #41628

Merged
dionisio-bot[bot] merged 6 commits into
release-8.7.0from
gif-thumbnail-animation-sharp-0.35
Jul 31, 2026
Merged

regression: preserve gif animation and correct thumbnail after sharp bump#41628
dionisio-bot[bot] merged 6 commits into
release-8.7.0from
gif-thumbnail-animation-sharp-0.35

Conversation

@yasnagat

@yasnagat yasnagat commented Jul 29, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

After the sharp update from 0.33 to 0.35.3 (#41537), thumbnail generation in FileUpload.createImageThumbnail needed two adjustments:

  • sharp's animated option defaults to false, so thumbnails were only keeping the first frame of GIFs. Passing { animated: file.type === 'image/gif' } to the constructor preserves all frames (and their delay/loop metadata) for GIFs while leaving other formats unaffected.
  • The resize output height was using the full stacked "toilet roll" height for multi-frame images rather than the per-frame height, which affected the dimensions stored on the thumbnail attachment. Using pageHeight ?? height reports the correct per-frame size.

Issue(s)

https://rocketchat.atlassian.net/browse/CORE-2494

Steps to test or reproduce

Further comments

Summary by CodeRabbit

Summary

  • Bug Fixes
    • Improved animated GIF thumbnail generation by streaming media data reliably and handling read errors.
    • Limited GIF thumbnail processing to a safe number of frames, improving performance for highly animated files.
    • Stored GIF page counts during upload to support more consistent thumbnail generation.

@dionisio-bot

dionisio-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1b4afed

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Animated GIF thumbnail generation now caps decoded pages using stored identify.pages and MAX_ANIMATED_THUMBNAIL_PAGES. Upload validation persists GIF page counts. Sharp processes images through streaming instead of full-buffer reads. The getBuffer method rejects when stream errors occur.

Changes

GIF thumbnail generation with page bounds

Layer / File(s) Summary
Metadata contract and bounds
packages/core-typings/src/IUpload.ts, apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
IUpload.identify now includes optional pages?: number. MAX_ANIMATED_THUMBNAIL_PAGES constant defines the 100-page limit for decoded GIF frames.
Page count capture during validation
apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
Upload validation persists the GIF page count from image metadata into identify.pages.
Bounded thumbnail generation with error handling
apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
createImageThumbnail configures Sharp with a page count capped at the stored metadata value. Image streams are processed without full-buffer reads. getBuffer rejects the buffer promise when the stream emits an error.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: type: bug

Suggested reviewers: julio-rocketchat

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the GIF animation and thumbnail regression fix after the Sharp upgrade.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2494: Request failed with status code 401

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.

@yasnagat yasnagat added this to the 8.7.0 milestone Jul 29, 2026
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.45%. Comparing base (a4f5098) to head (1b4afed).
⚠️ Report is 7 commits behind head on release-8.7.0.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                @@
##           release-8.7.0   #41628      +/-   ##
=================================================
+ Coverage          68.38%   68.45%   +0.07%     
=================================================
  Files               4139     4142       +3     
  Lines             158311   158390      +79     
  Branches           28252    28285      +33     
=================================================
+ Hits              108263   108431     +168     
+ Misses             44916    44818      -98     
- Partials            5132     5141       +9     
Flag Coverage Δ
e2e 58.95% <ø> (+0.06%) ⬆️
e2e-api 45.35% <57.14%> (-0.02%) ⬇️
unit 70.40% <14.28%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 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.

@yasnagat
yasnagat marked this pull request as ready for review July 29, 2026 19:32
@yasnagat
yasnagat requested a review from a team as a code owner July 29, 2026 19:32
@KevLehman KevLehman changed the title fix: preserve gif animation and correct thumbnail after sharp bump regression: preserve gif animation and correct thumbnail after sharp bump Jul 29, 2026
KevLehman
KevLehman previously approved these changes Jul 29, 2026

@KevLehman KevLehman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

pls add jira task before merging

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@hacktron-app hacktron-app Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 1 file

Severity Count
HIGH 1

View full scan results

Comment thread apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts (1)

44-44: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the implementation comment.

Keep the descriptive constant name, but move this rationale to external documentation if it is needed. As per coding guidelines, TypeScript/JavaScript should avoid code comments in the implementation.

🤖 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 `@apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts` at line 44,
Remove the implementation comment describing the per-frame GIF decode-cost
bound, while preserving the descriptive constant name and its behavior
unchanged.

Source: Coding guidelines

🤖 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 `@apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts`:
- Around line 337-338: Update the animated-thumbnail handling around the
transformer setup to explicitly define the behavior when totalPages exceeds
MAX_ANIMATED_THUMBNAIL_PAGES: either implement a clear oversized-animation
policy that avoids silent truncation, or document the truncation behavior and
add coverage confirming it. Keep normal animations within the existing page
limit behavior.
- Around line 335-336: Update FileUpload.getBuffer, used by the buffered GIF
path before sharp(buffer).metadata(), to reject when the storage stream emits an
error, the copy operation fails, or store.copy is unavailable; ensure all
failure paths settle the promise so createImageThumbnail reaches its existing
error handler instead of remaining pending.

---

Nitpick comments:
In `@apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts`:
- Line 44: Remove the implementation comment describing the per-frame GIF
decode-cost bound, while preserving the descriptive constant name and its
behavior unchanged.
🪄 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 Plus

Run ID: bb887375-dd13-4e76-9875-9af135e147a3

📥 Commits

Reviewing files that changed from the base of the PR and between 07ba408 and 1a3b7a2.

📒 Files selected for processing (1)
  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
⚠️ CI failures not shown inline (5)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
🧠 Learnings (3)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
🔇 Additional comments (2)
apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts (2)

24-24: LGTM!


333-334: LGTM!

Also applies to: 339-343, 348-355

Comment thread apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts Outdated
Comment thread apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts Outdated
Comment thread apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts Outdated
Comment thread apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts Outdated

@hacktron-app hacktron-app Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 1 file

Severity Count
MEDIUM 1

View full scan results

Comment thread apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts (1)

47-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the implementation comments.

Based on coding guidelines, “Avoid code comments in the implementation.” Keep the helper self-explanatory or move this rationale to documentation/tests.

🤖 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 `@apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts` around lines 47 -
48, Remove the implementation comments describing FileUpload.getBuffer’s
unsettled error behavior, leaving the surrounding helper implementation
unchanged.

Source: Coding guidelines

🤖 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 `@apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts`:
- Around line 54-59: Update getBufferWithTimeout and the underlying
FileUpload.getBuffer copy pipelines so a timeout rejection also aborts or
destroys the active storage read. Propagate the cancellation signal or
equivalent cleanup through each store.copy implementation, including
AmazonS3/GCS, GridFS/FileSystem, and WebDAV paths, while preserving successful
reads and existing timeout behavior.

---

Nitpick comments:
In `@apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts`:
- Around line 47-48: Remove the implementation comments describing
FileUpload.getBuffer’s unsettled error behavior, leaving the surrounding helper
implementation unchanged.
🪄 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 Plus

Run ID: 96d8693e-83a0-4a72-882f-61a1c94d3024

📥 Commits

Reviewing files that changed from the base of the PR and between 1a3b7a2 and 0f1d137.

📒 Files selected for processing (1)
  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
⚠️ CI failures not shown inline (3)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
🧠 Learnings (3)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
🔇 Additional comments (3)
apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts (3)

45-45: Make the oversized-GIF policy explicit.

The cap still silently truncates GIFs with more than 100 frames: Sharp’s pages option controls how many frames are extracted, so only the first 100 are emitted. (sharp.pixelplumbing.com) Reject/fallback oversized animations, or document and test intentional truncation.

Also applies to: 356-357


24-24: LGTM!


367-374: LGTM!

Comment thread apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts Outdated
@julio-rocketchat
julio-rocketchat requested a review from a team as a code owner July 30, 2026 20:59

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (1)
apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts (1)

333-352: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Propagate read-stream failures to Sharp.

image.pipe(transformer) does not close the destination when the storage Readable errors without a destination error listener, which can keep toBuffer() pending instead of rejecting the thumbnail operation. Forward the error to transformer.destroy(error) before piping, or use stream.pipeline.

Proposed fix
+		image.once('error', (error) => transformer.destroy(error));
 		image.pipe(transformer);
🤖 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 `@apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts` around lines 333
- 352, Update the stream handling in the thumbnail transformation around image
and transformer so read-stream errors are propagated to Sharp, either by
forwarding image errors to transformer.destroy(error) before piping or by using
stream.pipeline. Ensure toBuffer() rejects promptly when storage reading fails
while preserving the existing transformation and result mapping.
🧹 Nitpick comments (1)
apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts (1)

44-44: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the added implementation comments. The surrounding code and identifiers can express these details without comments.

  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts#L44-L44: remove the frame-cap rationale comment.
  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts#L335-L335: remove the Sharp construction comment.
  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts#L343-L343: remove the output-height comment.
  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts#L402-L402: remove the persisted-page-count comment.
  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts#L640-L640: remove the buffer-error comment.

As per coding guidelines, “Avoid code comments in the implementation.”

🤖 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 `@apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts` at line 44,
Remove the implementation comments in FileUpload.ts at lines 44, 335, 343, 402,
and 640, including the frame-cap rationale, Sharp construction, output-height,
persisted-page-count, and buffer-error comments; leave the surrounding code
unchanged.

Source: Coding guidelines

🤖 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.

Outside diff comments:
In `@apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts`:
- Around line 333-352: Update the stream handling in the thumbnail
transformation around image and transformer so read-stream errors are propagated
to Sharp, either by forwarding image errors to transformer.destroy(error) before
piping or by using stream.pipeline. Ensure toBuffer() rejects promptly when
storage reading fails while preserving the existing transformation and result
mapping.

---

Nitpick comments:
In `@apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts`:
- Line 44: Remove the implementation comments in FileUpload.ts at lines 44, 335,
343, 402, and 640, including the frame-cap rationale, Sharp construction,
output-height, persisted-page-count, and buffer-error comments; leave the
surrounding code unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4efc13aa-8305-46a2-9c20-283b05438aa6

📥 Commits

Reviewing files that changed from the base of the PR and between 0f1d137 and 626e9e4.

📒 Files selected for processing (2)
  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
  • packages/core-typings/src/IUpload.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
⚠️ CI failures not shown inline (4)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • packages/core-typings/src/IUpload.ts
  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
🧠 Learnings (3)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • packages/core-typings/src/IUpload.ts
  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • packages/core-typings/src/IUpload.ts
  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • packages/core-typings/src/IUpload.ts
  • apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
🔇 Additional comments (2)
packages/core-typings/src/IUpload.ts (1)

20-27: LGTM!

apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts (1)

24-24: LGTM!

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts
Comment thread apps/meteor/server/lib/media/file-upload/lib/FileUpload.ts Outdated
Comment thread packages/core-typings/src/IUpload.ts
Co-authored-by: Kevin Aleman <kaleman960@gmail.com>
@yasnagat yasnagat added the stat: QA assured Means it has been tested and approved by a company insider label Jul 31, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 31, 2026
@dionisio-bot
dionisio-bot Bot merged commit bd1a5dc into release-8.7.0 Jul 31, 2026
56 checks passed
@dionisio-bot
dionisio-bot Bot deleted the gif-thumbnail-animation-sharp-0.35 branch July 31, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants