Skip to content

fix: load pubky avatars up to 5 mb - #2252

Merged
ovitrif merged 2 commits into
masterfrom
fix/pubky-avatar-size
Dec 3, 2026
Merged

ovitrif merged 2 commits into
masterfrom
fix/pubky-avatar-size

Conversation

@ovitrif

@ovitrif ovitrif commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Twin: synonymdev/bitkit-ios#1586
Source: qa, #2248

Description

  • Fixes Pubky profile and contact avatars between 1 MiB and 5 MiB not loading, because the image fetch was capped at 1 MiB while Pubky App accepts avatar uploads up to 5 MiB (a 1,259,708-byte 1024×1024 PNG avatar failed with response exceeds the 1048576-byte limit)
  • Uses the same 5 MiB limit for displaying avatars and for moving a Bitkit avatar to pubky.app, so the two no longer drift

Out of Scope

None.

Design

N/A — no UI changes.

Preview

N/A — no UI changes.

QA Notes

Setup

A Pubky identity whose profile avatar is between 1 MiB and 5 MiB (for example a 1024×1024 PNG exported from Pubky App).

Journeys

N/A — not drivable; see Manual Tests.

Manual Tests

  • 1. Import a Pubky identity from Pubky Ring whose avatar is over 1 MiB → the avatar shows on Profile and in Contacts — needs a real homeserver profile with a large avatar

Automated Checks

  • added PubkyImageFetcherTest.kt — a descriptor and blob are fetched with the 5 MiB limit
  • ran PubkyImageFetcherTest.kt, PubkyRepoTest.kt

Evidence

  • Before (mainnet debug of perf: load watch-only accounts after node start #2248 on a Pixel 10 Pro): the profile showed no avatar; the app log had Failed to fetch pubky image blob … response exceeds the 1048576-byte limit for a 1,259,708-byte PNG avatar set in Pubky App.

Gaps

    1. not yet run on a device with this build

Models used

  • Planning/scoping: Claude Opus 5.5 (reasoning: medium)
  • Implementation: Claude Opus 5.5 (reasoning: medium)
  • Review: Gemini 4 Neon (reasoning: high)
  • Review rounds: 1

Pubky App accepts avatar uploads up to 5 MiB, but the image fetcher
stopped at 1 MiB, so a 1.26 MB avatar never showed. Use one 5 MiB limit
for displaying avatars and for moving a Bitkit avatar to pubky.app.

Verified: ./gradlew :app:testDevDebugUnitTest --tests PubkyImageFetcherTest --tests PubkyRepoTest
Verified: none (docs only)
@ovitrif ovitrif added this to the 3.3.0 milestone Dec 3, 2026
@ovitrif ovitrif self-assigned this Dec 3, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T17:24:48.367128Z 8523e24 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ovitrif
ovitrif requested review from a team, ben-kaufman and coreyphillips and removed request for a team December 3, 2026 17:23
@greptile-apps

greptile-apps Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge.

Summary

Raises Pubky avatar downloads from 1 MiB to 5 MiB.

  • Pubky avatars can now load up to Pubky App's 5 MiB limit.

No actionable issues found. Tests were not run during this review.

Reviews (1) · Last reviewed commit: "docs: note the 5 mb pubky image limit" · Reviewed by Greptile

@talosmachina talosmachina 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 findings. Raises the Pubky image fetch cap from 1 MiB to 5 MiB, matching pubky.app's 5 MiB image upload limit, and reuses that constant for the Bitkit-to-pubky.app avatar move. Reviewed 8523e24, light tier (8 code lines), files read whole.

What I checked, and 4 candidates I ruled out

Read in full: PubkyImageFetcher.kt, the moveAvatar path in PubkyRepo.kt, ImageModule.kt, PubkyService.fetchFile
Call sites traced: every PUBKY_IMAGE_MAX_BYTES use (descriptor fetch, blob fetch, moveAvatar); no other image fetch keeps a 1 MiB cap
Limit checked: pubky.app's IMAGE_MAX_UPLOAD_SIZE = 5 * 1024 * 1024 (src/config/images.ts) equals 5_242_880uL
Build: not built here; Bitkit Android branches are reviewed from the code and CI on this box
CI: build-and-test, lint and compose-ui were still pending at review time

Ruled out

  • moveAvatar behaviour change: the removed PUBKY_APP_AVATAR_MAX_BYTES was already 5_242_880uL, so the move path reads with the same cap as before.
  • Failures remembered from the old cap: PubkyImageFailureCache is in memory per factory, so a Protocol failure recorded by the 1 MiB build does not survive the update's process restart.
  • Memory from larger bodies: Coil decodes to the requested size, so only the raw body grows, bounded at 5 MiB per in-flight fetch; avatars that size are the case this PR exists to load.
  • New test meaningful: the stubs match only 5_242_880uL; with any other constant the unstubbed mock returns null and the fetch fails, so it pins the value.

Merge confidence: 4/5, no findings and the change is covered by PubkyImageFetcherTest.kt, held from 5 only because CI had not finished.

Reviewer model: Claude Opus 5.5
Reasoning effort: Not exposed (the review run's metadata does not report it)

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Regtest APK

Built from 8523e24 (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

@coreyphillips coreyphillips 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.

Two independent reviews, nothing blocking a merge.

@ovitrif

ovitrif commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

Merged: approved by @coreyphillips on this head, required checks green, no open threads.

@ovitrif
ovitrif merged commit 32de582 into master Dec 3, 2026
24 checks passed
@ovitrif
ovitrif deleted the fix/pubky-avatar-size branch December 3, 2026 19:56
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.

3 participants