Skip to content

Keep mine waits for a read before saying an item is gone, and a record that changes nothing announces nothing - #1025

Merged
SunkenInTime merged 3 commits into
mainfrom
t3/store-keep-gone-not-yet
Nov 30, 2026
Merged

SunkenInTime merged 3 commits into
mainfrom
t3/store-keep-gone-not-yet

Conversation

@SunkenInTime

@SunkenInTime SunkenInTime commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Two faults in Keep mine, merged with #1015 and found while tracing a freeze.

What the player saw

1. "This item is gone" before the page had been read. A teammate deleted a page while my edit to an item on it was in flight, so the server refused my edit as page deleted. The teammate restored the page. If I pressed Keep mine before the app had read the restored page, the store answered that the item was gone. It wasn't gone; the store just hadn't looked yet. The "not yet" check in _keptOverBase only ran when the refusal named a server row. A page-deleted refusal names none, so it went straight to _keepRefusedOver. That saw a merge with no row to merge over and answered RowGone.

Now a keep with no row to merge over answers RowNotReadYet until the page has been read since the refusal (readSinceRefusal, the same check the gone answer already used). Once it is read, the real answer comes through. readSinceRefusal also counts a page list read this session that shows the page in the trash or purged. Without that, an item on a purged page would wait forever, because nothing reads a purged page again.

Every refusal kind that names no server row, and what Keep mine answers now:

Refusal Store holds a deleted-row marker Store holds no row, merge edit Store holds no row, whole write
PAGE_DELETED gone at once (unchanged) not yet until read, then gone or kept unchanged: sent, the server answers
not found, no server copy same same same
answer without a life, other server failures same same same
refused when it was committed (ConflictedAtCommit) same same same
never refused (window closed, written long ago, changed unseen) same same same

2. A refused keep announced a change, and the app froze. Every record call sent StrategyRefreshed after saving, even when nothing in it applied. The sender wakes on every StrategyRefreshed. Each refused keep announced a change, which woke the waiting listener, which asked again, which was refused and announced again: 166,000 turns.

Now record announces when its queue changed, when rows were decided, or when the summary differs from the one already listed. A record that changes none of these writes nothing and announces nothing.

The summary rule is there on purpose. The sync tally depends on the clock as well as the queue. The sender's timed look, record(account, id, []), can cross a deadline with the queue untouched: for example, an undo waiting for its row needs the player once its delete's resend window closes. The new summary is written, and the sync chip only learns of it from this announcement. A gate on the queue alone would hide that; one test guards it.

Who listens to StrategyRefreshed and the store's changes

Every listener in lib/ and the package (the package has none of its own):

  • lib/strategy/store_save_facts.dart, the sync chip: reads summary.sync from the event. A changed summary is always announced.
  • lib/providers/collab/cloud_sync_status_provider.dart, the account's work list: rebuilds from the library list's summaries on any change. Same reason.
  • lib/providers/collab/store_draw_source.dart: redraws the open strategy from the store. Anything that changes the drawing changes the queue (or decides rows), and that is always announced.
  • lib/library_store/store_pictures.dart: watches for any change during one scan. A record that changes nothing leaves the scan valid.
  • lib/library_store/cloud_sender.dart: maps the event to wake(). This is the listener that looped; a refused keep no longer wakes it.
  • lib/library_store/library_store_open.dart: uses only onDone.

Tests

New, in test/cloud_page_deleted_refusal_test.dart. On main 863ea63:

  • Page restored, Keep mine pressed before the page's read: fails on main with Expected: RowNotReadYet, got RowGone. After the read, the keep goes ahead.
  • The page in the trash, the page purged, the item purged (refused as not found): gone once read this session, not yet after a reopen, gone again after the next read. Each fails on main at the reopen with Expected: RowNotReadYet.
  • A list read that already showed the page in the trash before the refusal is no read since it: "a list that showed the page in the trash before the refusal is no read since it: the item is not yet read until a list or the page arrives after the refusal". The keep answers RowNotReadYet until a list arrives after the refusal, then gone. The list read is held to the same since-the-refusal measure as the page read (listCurrentFor). With that check removed, this test fails with Actual: RowGone, and it is the only test that does.
  • A refused keep pressed three times: no commits, no key writes, no announcement. Fails on main with Expected: empty for the announcements. Main already wrote nothing; the harm was the announcement alone.
  • A record with one refused keep and one page list that is taken: one commit, one StrategyRefreshed carrying the returned summary. Passes on main and here.
  • A look in which only the clock moved still announces the changedUnseen it counts. Passes on main and here, and fails with a queue-only gate.

Checks

  • Touched and related store tests (9 files, 319 tests) pass.
  • Default models pass: queue (200 seeds plus seed 7, with 73591 still failing as registered for #1018) and store (40 seeds at 120 steps).
  • Sweep, since _recordOn is what the store model calls. Queue 72000–74000 and 74201–76200 at 150 steps, both folding modes; store 1–740 at 120 steps.
    • Seeds that fail here: queue 72928, 72992, 73242, 73483, 73913, 75620, 75805, and store 711. Each fails the same way on main 863ea63, in both modes.
    • Queue 73591 (#1018) and store 245 (#992) fail as registered.
    • No seed passes on main and fails here.
  • dart analyze --fatal-infos in the package: no issues. node tool/comments.mjs check: nothing above the baseline. No app file changed.

ci: analyze test web library

Confidence Score: 5/5 · The PR appears safe to merge; the previous move-related wait is fixed and no new actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the previous move-related wait is fixed and no new actionable issues were found.

Summary

Keep mine now waits for fresh reads of both pages when an item was being moved between pages.

  • Keep mine waits for a read before calling a missing item gone.
  • Cloud records announce refreshes only when their saved state changes.

Reviews (2) · Last reviewed commit: "A refused move to another page reads as ..." · Reviewed by Greptile

… naming no row (page deleted, not found, no life) with no row held answers not yet until its page, or a list showing the page gone, is read since the refusal; a record announces StrategyRefreshed only when its queue, its decided rows or its summary changed, so a refused keep no longer wakes a listener that asks again
@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 34 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: 163aba51-11f8-4f06-8b2f-48894c27026e
Commits

Reviewing files that changed from the base of the PR and between ab5637d and 757700e.

Files selected for processing: 4

  • packages/icarus_library/README.md
  • packages/icarus_library/lib/src/cloud/queue.dart
  • packages/icarus_library/lib/src/store/cloud_store.dart
  • packages/icarus_library/test/cloud_page_deleted_refusal_test.dart
  • 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

…o read since it: Keep mine stays not yet until a read arrives after the refusal
…oth pages it names are: Keep mine on it no longer waits with no read to end the wait
@SunkenInTime
SunkenInTime merged commit 45c921c into main Nov 30, 2026
25 checks passed
SunkenInTime added a commit that referenced this pull request Nov 30, 2026
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