Skip to content

Put mine back and Send mine for held conflicts, through the store's Keep mine - #1021

Merged
SunkenInTime merged 14 commits into
mainfrom
t3/store-conflict-keep2
Nov 30, 2026
Merged

SunkenInTime merged 14 commits into
mainfrom
t3/store-conflict-keep2

Conversation

@SunkenInTime

@SunkenInTime SunkenInTime commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

In own mode, a held change can now be won as well as dropped. Put mine back sends the player's change over the teammate's. Send mine sends a change that was held before it went out, or one on a page that was deleted and came back. Follows #1020 (merged), which added Discard mine, Don't send and the one-write Restore.

A teammate moved the same agent first: Put mine back or Discard mine keep
The player moved it again after the held move: no Put mine back, and the popover says why follow
A page that came back with the player's change on it: Send mine page back send

Part of #615, on the store's Keep mine (#1015).

What changes

Put mine back and Send mine go through the store's Keep mine:

  • the call is UserKeptMine(opId, replacement, authored: AuthoredNoRow(), shownVersion:);
  • the replacement is the held op under a new opId (renamed, now exported by the package) and nothing else: the store drops the merge base and rebases to the row it holds;
  • shownVersion is the server version of the row in the drawing the popover opened with (serverVersionAsDrawn over storeReadOf of the latest drawn snapshot).

The popover is a picture of the rows at open. It closes as soon as the rows as drawn change: a page switch, a later edit of the item, a teammate's change arriving, a page restored, or the read after "not yet". The chip stays on attention, and opening it again gives a new picture with new versions. A press checks the same thing and does nothing if the rows are no longer the ones it opened with.

One offer decides what the popover shows (keepOfferOf, next to the rows): which held changes can be kept, the button, whether it waits, where Go to that page goes, and which sentences show. The widget only draws it.

When Put mine back is offered. Only for a change on the page on screen, and only when nothing of the player's is drawn over that item. If they changed the same item again after the held change, the popover says "You changed it again after this. Discard mine gives up both; then make your change again." and offers Discard mine only. Putting the first change back would replace a version the player never saw. Nothing is sent after a put-back by itself.

A page that came back. A change the server refused because its page was deleted is held under "this page came back; your change waits to be sent" (from #1020). Here it also gets Send mine. The press writes nothing until the store has read the page since the refusal; until then it answers "not yet", like any other keep.

Every store answer has its words (KeepOutcome):

  • Kept.
  • Not read yet: the button waits, and the popover says it is waiting for the page's latest version, or for the connection. When the read arrives the rows change and the popover closes; reopened, it offers the version that read drew. Offline it stays, with the offline words.
  • Changed again: nothing is written. The popover says it changed again; when the newer version is drawn, the popover closes, and a keep from the reopened popover goes through with that version.
  • Gone: decided per held change. A change whose item is gone offers only the discard; other held changes keep Put mine back. A mixed set says "Some of these can be put back and some can't. Discard mine gives up all of them, including the ones you could put back."
  • Not saved, in doubt, out of scope.

The words follow the buttons. For each reason, the body that offers to put a change back or send it ("Put yours back to replace theirs, or discard it.", "Send yours, or don't send it…", "…until you send them or discard them") shows only when a change of that kind is offered. Otherwise, for a change the player changed again or one on another page, and in the leave-the-editor guard, it keeps #1020's words ("…yours is kept here until you discard it.").

The label. Put mine back whenever a kept change replaces a teammate's version on the page; Send mine only when every kept change is unsent or on a page that came back.

After the store answers gone, only the discard is offered until the popover is reopened.

Only on the page on screen. Whenever a held change is on another page, the popover says so and offers Go to that page (the first such change in queue order), so the player chooses with both versions in front of them.

Ground truth

Linux driver builds on the storeruns preview, owner jules and teammate mika, --library-store store --cloud-store own. Every pair is CLEAN on both sides, each chip state checked against the server. All nine ran on main at 6a8a92b. On main at 881b72c, which brought #1026's restore drawing, the pairs that restore a page (restore, moved-first, moved-send) ran again, and so did keep and follow, which check the body above. On this head, where the popover became a picture of the rows at open, keep, follow and moved-send ran again, all CLEAN; the three pictures above are from those runs.

  • store-keep-*: the popover says "Put yours back to replace theirs, or discard it.", and Put mine back moves a1 back to the owner's position on both sides, synced.
  • store-keep-again-*: the teammate moves a1 again while the popover is open. Put mine back writes nothing, the sentence appears, the page shows the newer position, and Discard mine ends on it.
  • store-keep-follow-*: the owner moves the held a1 again. The popover says "You changed it again after this…" and "…kept here until you discard it.", never "Put yours back"; Put mine back is not offered, and Discard mine ends synced on the teammate's position.
  • store-unseen-send-*: the changed-unseen rename, ended with Send mine. The owner's name is on both sides.
  • store-rename-held-*: a page rename held behind the teammate's shows the teammate's name, then Put mine back sends the owner's.
  • store-map-keep-*: the map picked while the teammate picked Lotus is held, and the page shows Lotus. Put mine back gives Haven on both sides.
  • store-deleted-page-moved-send-*: after Restore, the teammate's held move on the page that came back offers Send mine, which sends it over the owner's later move; both sides end on the teammate's position.
  • Held conflicts say what happened and give the player a choice: Discard mine, Don't send, and the deleted-page dialog #1020's Restore and moved-first pairs run again here, because this PR changes what that popover offers: both CLEAN.

With #1025 the store itself answers "not yet" for a keep on a page not read since the refusal, without announcing a change; this PR's own check (nothing written until the store has read the page since the refusal) stays, as the app saying what it knows.

Tests (880 across the store, keep, offer, chip, guard and session files). The offer table covers each held kind, mixed kinds across pages, both labels and each last answer; a second table shows the popover closing when the rows change (page switch, later edit, a teammate's change or the read after not yet, a page restored). Widget tests: the button and its press; the popover closing on a page switch while open; a press after the rows changed keeping nothing. Store tests: a keep answered changed again, then kept from the reopened popover; the overwrite repro (Put mine back offered over a version the player never saw, which fails on the earlier rule at the item's position), "not yet" ends on the read and a press after it lands, gone and live in one set, and Send for a page-back change before the page is read writes nothing and answers not yet (fails on the earlier code with KeepChangedAgain and a store write).

Known limits

  • For a moment the popover can be ahead of the canvas. The version is the one the store had drawn when the popover opened; the canvas applies that drawing a moment later (a microtask and one local store read), so for that moment the popover can name a newer version than the canvas shows. Any later change to the rows closes the popover.

  • Gone is decided twice. The popover hides Put mine back / Send mine for a held change whose item the app's gone set marks gone (a deleted row, or a page in the trash), for every kind it can send. The store's Keep mine has its own rule. It can still answer gone where the app did not mark it: a merged patch whose row is simply absent. And the app can mark gone a row on a trashed page the store would still accept. A press is safe either way, because the store decides and writes nothing; after a gone answer only the discard is offered. The real fix, drawing the offer from the store's own answer, is #1028.

Not covered here

  • A lineup conflict: a lineup origin moves only in the lineup editor, which no driver step reaches, so there is no lineup pair. The lineup path through Keep mine is the same per-row call as an agent's.

Parked for Dara

Marked "Draft for Dara", with Japanese and Chinese drafts:

  • Buttons: Put mine back, Send mine, Go to that page.
  • The conflict body, when Put mine back is offered: "… yours is kept here. Put yours back to replace theirs, or discard it." (and the matching Send forms for the unsent conflict and the page that came back)
  • Changed again after: "You changed it again after this. Discard mine gives up both; then make your change again."
  • Some keepable: "Some of these can be put back and some can't. Discard mine gives up all of them, including the ones you could put back."
  • Waiting: "Waiting for the latest version of this page. You can put yours back once it arrives." The offline form: "Waiting for the connection to come back…"
  • Changed again: "It changed again while you were choosing. The page shows the newer version; choose again."
  • Another page: "It's on another page. Go to that page to choose with it in front of you."
  • Page back body: "… they stay on this computer until you send them or discard them. Discard them and the page shows the saved version."

ci: analyze test web library

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds store handling for keeping eligible held changes, sync-popover actions and status messages, and localized text for held-change choices. New drive scenarios cover conflict resolution, restored pages, unsent changes, and collaboration sync behavior.

Changes: Held change resolution

Layer / File(s) Summary
Conflict rows and keep outcomes
lib/strategy/store_choices.dart, lib/providers/collab/cloud_sync_status_provider.dart, test/library_store/store_keep_test.dart
The store derives conflict rows and filters out rows that are off-screen, covered by a later operation, or gone. putMineBack recreates eligible operations and returns outcomes for changed, waiting, gone, and failed cases. Tests cover eligibility, redraw waits, and store updates.
Sync popover choices
lib/widgets/cloud_sync_button.dart, lib/widgets/store_sync_words.dart, lib/l10n/app_*.arb
The sync button tracks conflict rows and keep-choice state, attempts eligible keeps, and displays status and navigation actions. Held-change explanations and localized messages cover keep and send choices.
Drive support and collaboration scenarios
lib/dev/drive/drive.dart, tool/drive/README.md, tool/drive/scripts/store-*.json
The drive tool supports matching text within a widget. Its scripts exercise conflict resolution, page restoration, unsent changes, and synchronization in owner and mate workflows.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant CloudSyncButton
  participant putMineBack
  participant LibraryStore
  User->>CloudSyncButton: Select "Put mine back"
  CloudSyncButton->>putMineBack: Attempt keep within the store turn
  putMineBack->>LibraryStore: Record eligible operations
  LibraryStore-->>putMineBack: Return store result
  putMineBack-->>CloudSyncButton: Return keep outcome
  CloudSyncButton-->>User: Update popover or show result
Loading

Possibly related issues

  • SunkenInTime/icarus#1001: The issue specifies actions for held conflicts and deleted pages. This change adds keep and send choices for held changes.
  • SunkenInTime/icarus#931: The issue concerns restoring a page the app no longer holds. This change includes restored-page handling and waits for a page read before a keep attempt.

Possibly related PRs

  • SunkenInTime/icarus#1008: This PR adds the held-work status and popover that this change extends with keep handling and the “Put mine back” path.
Merge Risk: Minimal · up to 36666

This PR adds Put mine back and Send mine for held changes. Put mine back is withheld when the player changed the item again, and Send mine writes nothing until the restored page has been read. No supported defect remains that would block merging. A rare timing case could leave the keep button disabled until the popover is reopened.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two new actions, Put mine back and Send mine, for held conflicts, and says they run through the store's Keep mine operation. The changeset adds putMineBack in lib/strategy/store_ch…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the two new actions, Put mine back and Send mine, for held conflicts, and says they run through the store's Keep mine operation. The changeset adds putMineBack in lib/strategy/store_choices.dart, the popover and button wiring in cloud_sync_button.dart, the Send mine and Put mine back strings in the ARB files, and drive scripts that exercise both actions. The title covers the main change. It does not mention the supporting outcome handling, the gone-set provider change, or the drive test tooling, which is expected for a short title.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

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: 6b5562cc-5c2b-42ea-bdf0-ac4d77284bf7
Commits

Reviewing files that changed from the base of the PR and between 881b72c and 366669e.

Files selected for processing: 23

  • lib/dev/drive/drive.dart
  • lib/l10n/app_en.arb
  • lib/l10n/app_ja.arb
  • lib/l10n/app_zh.arb
  • lib/providers/collab/cloud_sync_status_provider.dart
  • lib/strategy/store_choices.dart
  • lib/widgets/cloud_sync_button.dart
  • lib/widgets/store_sync_words.dart
  • test/library_store/store_keep_test.dart
  • tool/drive/README.md
  • tool/drive/scripts/store-deleted-page-moved-send-mate.json
  • tool/drive/scripts/store-keep-again-mate.json
  • tool/drive/scripts/store-keep-again-owner.json
  • tool/drive/scripts/store-keep-follow-mate.json
  • tool/drive/scripts/store-keep-follow-owner.json
  • tool/drive/scripts/store-keep-mate.json
  • tool/drive/scripts/store-keep-owner.json
  • tool/drive/scripts/store-map-keep-mate.json
  • tool/drive/scripts/store-map-keep-owner.json
  • tool/drive/scripts/store-rename-held-mate.json
  • tool/drive/scripts/store-rename-held-owner.json
  • tool/drive/scripts/store-unseen-send-mate.json
  • tool/drive/scripts/store-unseen-send-owner.json

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread lib/widgets/cloud_sync_button.dart Resolved
Comment thread lib/widgets/cloud_sync_button.dart Resolved
…ith the version as drawn; Go to that page otherwise; every store answer has its words
…he lineup pair drags the origin addLineup makes
…he item, per held change; the wait for a read ends on the read; Send mine for a change on a page that came back
…read instead of writing; the page-back reason says it can be sent; a moved-first pair that ends with Send mine
…the popover offers that button; elsewhere it keeps #1020's words
@SunkenInTime
SunkenInTime force-pushed the t3/store-conflict-keep2 branch from c31c3f0 to 366669e Compare November 30, 2026 15:07
… the popover draws one offer decided next to the rows; a held row has one kind and Keep's last answer is named as one; a keep that throws clears the busy state with the doubt words
…never a conflict is kept; after a gone answer only the discard, from the rows as drawn
…ng only the version first shown per change; gone covers every kind it can send; each reason's words follow its own kind; Go to that page whenever a held change is off screen
Comment thread lib/strategy/store_choices.dart Resolved
…nge; a press checks the same; the applied-snapshot provider is gone
@SunkenInTime
SunkenInTime merged commit 528d386 into main Nov 30, 2026
25 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