test(images): measure the thumbnail decode without imageBuilder - #21
Merged
Conversation
Given an `imageBuilder`, `CachedNetworkImage` discards the widget `OctoImage` built and hands the callback its raw provider, so the `ResizeImage` that implements `memCacheWidth` was lost and the test decoded a second, full-resolution copy. The assertion read the image cache total, which then held both the 216x270 thumbnail and the full 1080x1350 bitmap, and passed or failed on whichever decode landed first: it passed on the 1.6.0 pull request and failed on the push to main, leaving v1.6.0 unreleased. The app never passes `imageBuilder`, so the measurement now loads the image the way production does and the total describes one decode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unblocks the v1.6.0 release: the push of
chore(release): 1.6.0to main failedits Android integration job (run 33761887174),
so
release-candidateandpublish-releasewere skipped and no tag was cut.What actually broke
The failure was in the test, not the app.
CachedNetworkImageimplementsmemCacheWidthby handing it toOctoImage,which wraps the provider in
ResizeImage.resizeIfNeeded(
octo_image/lib/src/image/image.dart:205). But when animageBuilderisgiven,
_octoImageBuilderthrows away the widgetOctoImagebuilt and callsimageBuilder(context, _image)with the rawCachedNetworkImageProvider(
cached_network_image-3.4.1/lib/src/cached_image_widget.dart:299).The test used
imageBuilderpurely to detect that loading had finished, thenpainted
Image(image: provider)— decoding a second, full-resolution copy. Itsassertion read
imageCache.currentSizeBytes, a global total, which then heldboth bitmaps:
Whether it passed came down to which decode reached the cache first — it passed
on the PR run for the very same commit and failed on the push to main.
The fix
The app never passes
imageBuilder— all sixmemCacheWidthcall sites use aplain
CachedNetworkImage— so the measurement now loads the image the wayproduction does and completion is detected from the cache itself. One decode,
one number:
Verification
Run on a local
Aegis_API_34emulator againsttool/fixture_server.js, thesame pair CI runs — twice, including once on the exact post-
dart formatfile:integration_test/android_storage_test.dart+integration_test/slideshow_render_test.dart— 20/20 passed, both runs, identical byte countsflutter test— 261 passed, 8 skippedflutter analyze— no issuesdart format --set-exit-if-changed lib test integration_test— cleanNo production code is touched.
Once this lands on main,
release-candidatetakes its "Version is unchanged;checking for an interrupted release" path (
.github/workflows/ci.yml:186):pubspec.yamlis still 1.6.0,CHANGELOG.mdhas valid[1.6.0]notes, andv1.6.0does not exist yet — so the release publishes without another bump.