Repository navigation
fix: load pubky avatars up to 5 mb - #1586
Conversation
Pubky App accepts avatar uploads up to 5 MiB, but the image view 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: xcodebuild test -only-testing:BitkitTests/PubkyImageCacheTests
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Confidence Score: 5/5
[Medium impact] This PR appears safe to merge. SummaryRaises the Pubky avatar download limit from 1 MiB to 5 MiB.
Reviews (1) · Last reviewed commit: "fix: load pubky avatars up to 5 mb" · Reviewed by Greptile |
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Raises the Pubky image fetch and decode cap from 1 MiB to 5 MiB and makes the avatar move to pubky.app read the same constant. Reviewed c1a29dc, light tier, static.
What I checked, and 4 candidates I ruled out
Read in full: Bitkit/Components/PubkyImage.swift (loader, decoder, PubkyImageCache), PubkyAppProfileStore.moveAvatar, PubkyService.fetchFile and PaykitSdkService.fetchFile
Call sites traced: every reader of PubkyImagePolicy.maxDownloadBytes: the descriptor fetch and the blob fetch in loadImageOffMain/resolveImageData, the PubkyImageDecoder size gate, the cache's default maxFileBytes, and now avatarMaxBytes. All four move together, so the fetch, decode and cache gates cannot disagree.
Build: not built here; this repo is reviewed from the code and from CI only, and iOS does not build on Linux.
CI: SwiftFormat, validate and Greptile green; Run Tests and Run Integration Tests still pending at review time.
Ruled out
- The bounded fetch refusing 5 MiB:
moveAvataralready called the samefetchPubkyFileBoundedwith 5 MiB before this PR, so the FFI path accepts that bound. - Old 1 MiB failures stuck as permanent:
failureslives in memory only, so a rejection remembered by an older build does not survive the update. - Disk cache holding fewer avatars:
diskCacheBytesstays 32 MiB, so a run of 5 MiB avatars fits about six before LRU trimming; that only costs refetches, and small avatars (the common case) are unaffected. - Decode memory for a 5 MiB PNG:
CGImageSourceCreateThumbnailAtIndexwithmaxPixelSize: 512keeps the retained image small; the transient decode is bounded by the dimensions pubky.app itself accepts, and no failure path in this diff depends on it.
Merge confidence: 4/5, testImageOverOneMebibyteLoads covers the change but the unit test run had not finished when I reviewed.
Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (the runtime does not report it)
coreyphillips
left a comment
There was a problem hiding this comment.
Two independent reviews, nothing blocking a merge.
worth doing, does not block
- Disk cache now keeps only about six full-size avatars (Bitkit/Components/PubkyImage.swift:131-134)
The disk cache keeps the downloaded file, so at the 5 MiB limit the 32 MiB budget held only about six avatars and evicted the rest on the next launch. Raise it to 160 MiB. Verified: none (one constant; CI builds and runs PubkyImageCacheTests)
coreyphillips
left a comment
There was a problem hiding this comment.
Rechecked after 1 new commit (992378b). Nothing blocking remains.
addressed
- Disk cache now keeps only about six full-size avatars (Bitkit/Components/PubkyImage.swift:131-134). Fixed:
PubkyImage.swift:135now setsdiskCacheBytesto 160 MiB, which is 32 × the 5 MiBmaxFileBytescap thatstoreenforces at :279.trimDiskCache(:409) evicts only while the total is overmaxDiskBytes, so 32 files at the full limit fit without eviction. No test depends on the old 32 MiB default.
|
Merged: approved by @coreyphillips on this head, required checks green (unit tests passed on a rerun after unrelated flaky failures), no open threads. |
Twin: synonymdev/bitkit-android#2252
Source: qa, synonymdev/bitkit-android#2248
Description
response exceeds the 1048576-byte limit)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
Automated Checks
PubkyImageCacheTests.swift— a 1,259,708-byte image loadsPubkyImageCacheTests.swiftEvidence
response exceeds the 1048576-byte limit(fix: load pubky avatars up to 5 mb bitkit-android#2252); iOS uses the same Paykit fetch with the same 1 MiB limit, andPubkyImageDecoderrejected anything over it.Gaps
Models used
Claude Opus 5.5(reasoning:medium)Claude Opus 5.5(reasoning:medium)Gemini 4 Neon(reasoning:high)