Skip to content

A duplicated page shows its original's pictures, so a served picture isn't uploaded again - #1027

Merged
SunkenInTime merged 2 commits into
mainfrom
t3/store-copy-pictures
Nov 30, 2026
Merged

SunkenInTime merged 2 commits into
mainfrom
t3/store-copy-pictures

Conversation

@SunkenInTime

@SunkenInTime SunkenInTime commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

On a store-owned strategy, duplicating a page that holds a picture the server already serves no longer uploads that picture again. Offline, "Uploading image..." used to stay on screen; now no toast appears and the copy draws the picture.

main, offline duplicate (from the #1009 run) this branch, offline duplicate
main branch

Cause

_contentOf in cloud_store.dart answered ContentShown() with no pictures for a page known only from its PageAddOp, meaning a page made here that hasn't been read yet. storePageOf turned that into an empty assetsById next to elements that place the picture. reconcilePageMedia then queued an upload for each placed picture that had no active asset and whose bytes were on the device. Offline, that job stayed in the queue and the toast stayed up. Online, the bytes went up again.

Fix

In _contentOf's second arm, a page made here and not yet read now shows every picture the store holds for this strategy's pages (loaded.disk.pictures). The shipped path's _pageMadeHere already does this ("a copy shows its original's"). Once the page is read, its own stored pictures are the answer, as before. The first arm, the reconcile and the toast are unchanged. The package README says so.

If two pages hold the same picture id with different facts, the shipped path lets the page on screen win. The store doesn't know which page is on screen, so it merges in sorted page-digest order: the page under the greater digest wins. The choice depends only on the stored rows, so the same stored state draws the same facts before and after a reopen. Nothing says the page with the greater digest has the newer facts. The facts only differ if the server changed that picture between two page reads.

Tests

  • test/library_store/store_canvas_commit_test.dart: "duplicating a served picture offline leaves the upload queue empty" (Astra's). On main: Expected: empty / Actual: ['already-served'].
  • packages/icarus_library/test/cloud_store_pictures_role_test.dart:
    • "a page added as a copy shows the pictures stored for the strategy's pages until its first read, then its own". On main: Expected: {'p1': ...} / Actual: {}.
    • "a copy of a copy made offline shows the original pictures". On main: Expected: {'p1': ...} / Actual: {}.
    • "a page made here shows the same facts for a picture two pages hold differently before and after a reopen, the pages read in the order [page-a, page-b]" and the same with "[page-b, page-a]". On fd6cac4 (the merge in read order), the [page-b, page-a] order fails: Expected: {'p1': Instance of 'PictureAsset'} / Actual: {'p1': Instance of 'PictureAsset'} / Which: at location ['p1'] is <Instance of 'PictureAsset'> instead of <Instance of 'PictureAsset'>.
    • "a blank page added to a strategy with no pictures shows none". Passes on main too; it guards the empty answer.

The store model (cloud_store_model_test.dart) does not read content.pictures. It reads elements, lineup groups and tallies only, so no sweep was run.

Driver

store-pages-offline.json with store-pages-offline-mate.json through linux-cut-network.sh, --library-store store --cloud-store own, mika and jules, on the storeruns preview, driver build of this head. Both sides came back clean: 136 and 33 steps. The script now also requires:

  • no "Uploading image..." on the offline duplicate, on its copy (which also has to draw the picture), and after the later offline duplicates;
  • waitSettled at the end, so the media upload queue and op queue are empty and the chip reads synced.

The picture draws on the offline copy (above). After reconnect, Dup A is served and drawn (expectPicturesServed, drawn).

ci: analyze test web library desktop

Confidence Score: 5/5 · The PR appears safe to merge; no new actionable issue was found.RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issue was found.

Summary

Unread pages made on this device now receive the pictures stored for the strategy’s pages. This lets offline copies recognize pictures the server already serves instead of uploading them again.

  • A new page copy reuses picture facts already stored for its strategy.

Reviews (4) · Last reviewed commit: "A page made here takes picture facts in ..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f832c16b-1056-4a78-80c2-a32b8815d94c
Commits

Reviewing files that changed from the base of the PR and between 6a8a92b and fcaa834.

Files selected for processing: 5

  • packages/icarus_library/README.md
  • packages/icarus_library/lib/src/store/cloud_store.dart
  • packages/icarus_library/test/cloud_store_pictures_role_test.dart
  • test/library_store/store_canvas_commit_test.dart
  • tool/drive/scripts/store-pages-offline.json
  • 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

…for the strategy's pages, as the app's page made here does, so duplicating a page with a served picture queues no upload; the offline pages run checks no upload toast and settles at the end
…the same stored rows draw the same facts before and after a reopen
@SunkenInTime
SunkenInTime force-pushed the t3/store-copy-pictures branch from fd6cac4 to fcaa834 Compare November 30, 2026 14:38
@SunkenInTime
SunkenInTime merged commit 63f24cd into main Nov 30, 2026
28 checks passed
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