Skip to content

fix(submissions): decode iPhone HEIC photos instead of failing the response - #145

Merged
patriksimms merged 3 commits into
mainfrom
posthog-self-driving/fixshared-page-repeated-rage-clicks-on-ad698c
Oct 15, 2026
Merged

patriksimms merged 3 commits into
mainfrom
posthog-self-driving/fixshared-page-repeated-rage-clicks-on-ad698c

Conversation

@posthog-eu

@posthog-eu posthog-eu Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Contributors could not submit iPhone HEIC photos because Sharp's prebuilt binaries lack an HEVC decoder. The resulting 422 also hid the cause from logs and error tracking.

Origin

  • Scout: signals-scout-general
  • First signal: 2026-10-08
  • Inbox report: open
  • Task started by: auto-start, after the report was rated P2 and ready to fix

Changes

HEVC-coded HEIC photos now decode through a lazily loaded WebAssembly codec before entering the existing Sharp pipeline. Multi-image files use their designated primary photo, with its dimensions and ICC profile. Transparent photos keep their alpha channel in PNG masters, and HEIF rotation is applied before producing the master and sRGB WebP preview. Image-processing failures are logged and reported.

The 200 MP guard remains in place before pixel decoding. README documents codec installation and limitations. No deployment configuration changes are required. Decoding runs on the main thread and produces 8-bit pixels; large batches can still reach the existing submission timeout.

Validation

  • Real HEVC fixtures cover primary-photo selection, transparency, rotation, ICC preservation, metadata removal, and decodable masters/previews. The primary-photo regression failed against the original implementation.
  • The existing production-image journey uploads HEIC through the shared form and verifies the stored master and preview after recreating the Bun container.
  • bun run verify passes locally: formatting, lint, typecheck, 468 unit tests, 48 integration tests, 46 browser tests with 2 intentional skips, build, and deployment checks.
  • bun run smoke:production passes locally using the shipped Bun 1.3.9 image. The initial attempt inherited development Clerk keys and failed before upload; the rerun used the smoke fixture defaults.
  • Exact-head GitHub CI passes for 11e4ce2: both push and pull-request runs of verify and production-image are green.

Review status

Independent full review of 92e3b61...11e4ce2 found no blocking or non-blocking findings. No unresolved review threads remain.

The PR remains draft because both configured review bots are unavailable for this commit:

  • Macroscope skipped review for insufficient credits.
  • CodeRabbit skipped review because the bot author has no assigned review seat, including after its supported manual review command.

No deployment configuration changes are required. Completing the configured bot gate needs the account owners to restore Macroscope credits and assign a CodeRabbit seat, then rerun the reviews.

Refs #118.


Original implementation by Claude Code. Review improvements delivered by GPT-6.1-Sol through the Codex harness in T3 Code.

…sponse

The contributor form accepts HEIC, but the prebuilt sharp binaries cannot decode HEVC-coded pixels. Every iPhone photo therefore failed the submission with a generic image error. Contributors then retried, reloaded and clicked the error again and again.

The image pipeline now decodes HEVC HEIC with libheif's WebAssembly build (heic-decode). It hands the pixels on as a lossless PNG that keeps the photo's own ICC profile, so the master keeps its colour space. AVIF and other formats still go straight to sharp.

Image failures that end in the generic 422 are now logged and sent to error tracking, so they are no longer invisible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: 0e71ffef-e903-4230-b773-d9dc0123d940
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Important

Review skipped

This PR was authored by a bot without an assigned CodeRabbit review seat. Ask an organization administrator to assign a seat to the bot. See the seat-assignment guide. After the seat is assigned, request a review again.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b2fe56d4-02cf-4357-9bc6-78f655c93198

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

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

posthog-eu Bot and others added 2 commits October 8, 2026 05:57
…hunk

The libheif WebAssembly bundle now loads only when a HEIC photo arrives. The checksum uses crc32 with a starting value instead of a joined copy. The PNG header offset now has a name, and the comment states only why the code exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: 0e71ffef-e903-4230-b773-d9dc0123d940
Select the designated primary image before decoding multi-image HEIC
uploads, keeping its dimensions and ICC metadata aligned with the pixels.
Preserve alpha for transparent photos and release decoder handles on both
success and failure.

Add focused primary-photo, transparency, and HEIF rotation fixtures. Use a
HEIC upload in the production-image journey and document codec limitations.

Validation: bun run verify passes, including 468 unit tests, 48 integration
tests, 46 browser tests and the production build. The primary-photo test
failed against the original PR implementation.

Refs #118, #145.

AI-Assisted: true
AI-Agent: codex
AI-Model: openai/gpt-6.1-sol
@patriksimms

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review skipped.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@patriksimms
patriksimms marked this pull request as ready for review October 15, 2026 12:46
@patriksimms

Copy link
Copy Markdown
Owner

@CodeRabbit help

@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

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 @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai 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:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai review --preview-config to test the unmerged CodeRabbit configuration on a draft PR. The requester must have repository write access; preview results are non-authoritative.
  • @coderabbitai rate limit to show your current review rate limit status.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai track in a human-authored review thread to track the original finding until CodeRabbit verifies it is fixed.
  • @coderabbitai fixed in a tracked review thread to verify the current code against the original finding.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
  • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
  • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai emit path instructions to emit generated path-specific review instructions for this repository.
  • @coderabbitai generate project vocabulary to list vocabulary that is specific to this repository.
  • @coderabbitai resolve merge conflict to automatically resolve merge conflicts.
  • @coderabbitai fix comments to automatically fix issues in the current review thread, or all unresolved review comments when used in the PR conversation.
  • @coderabbitai autopilot to enable Autofix to fix CodeRabbit findings and required CI, and resolve merge conflicts.
  • @coderabbitai autopilot resume to resume Autofix for this PR.
  • @coderabbitai autopilot stop to stop Autofix for this PR.
  • @coderabbitai fix-ci to automatically fix failing CI checks in a stacked pull request.
  • @coderabbitai fix-ci commit to automatically fix failing CI checks by committing fixes to the current branch.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @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.
  • You can also validate your configuration using the online YAML validator.
  • 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, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@patriksimms

Copy link
Copy Markdown
Owner

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review skipped.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@patriksimms
patriksimms merged commit e89a6a1 into main Oct 15, 2026
6 checks passed
@patriksimms
patriksimms deleted the posthog-self-driving/fixshared-page-repeated-rage-clicks-on-ad698c branch October 15, 2026 12:50
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