Skip to content

C2: strategy rename and the all-pages controls through the store - #1023

Merged
SunkenInTime merged 4 commits into
mainfrom
t3/store-c2-rename-pages
Nov 30, 2026
Merged

SunkenInTime merged 4 commits into
mainfrom
t3/store-c2-rename-pages

Conversation

@SunkenInTime

@SunkenInTime SunkenInTime commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

On a store-owned cloud strategy, the strategy's name, the shortcut that switches the side of every page, and the neutral team colours toggle work again. Each one saves on this computer at once, and the store sends it to the server. Before this PR, all three were switched off for a store-owned strategy.

Part of #615. This is the last part of C2, after #1009 (pages) and #1012 (map and theme). The scope is #1002 and the lead's ruling of 2026-11-30.

Seen in the app

Two accounts on the storeruns preview, --library-store store --cloud-store own, Linux driver build of eb7504d (this head's code; the second commit changes only the scripts). Pair run 3: owner 90 steps, teammate 52, both clean. Offline run 2: owner 89 steps, teammate 40, both clean.

Rename, each way. The owner renames the strategy from the title, and the teammate's title follows. Then the teammate renames it, and the owner's title follows. Each step checks the store, a fresh server read and the title.

Owner renames Teammate sees it Teammate renames, owner sees it
o1 m1 o2

Every page's side, and neutral colours. The owner presses F (side of every page), then turns on neutral team colours in Settings. storeExpectEveryPage checks all three pages in the store and on the server, plus the canvas, on both sides.

Owner, every side Teammate Owner, neutral colours Teammate
o3 m2 o4 m3

A teammate's change racing mine. The owner's sender is held. The teammate renames page 2. The owner switches every side again. When the sender is let go:

  • the page on screen lands;
  • the server refuses page 2's side (revision_mismatch);
  • the sync button turns red ("needs you", one entry), and no toast says the switch wasn't saved.

Taking the cloud's version settles it, and both sides end on the teammate's page name.

Owner, page 2 held Teammate, after the owner took the cloud's
o5 m4

Offline (through linux-cut-network.sh). Before the cut, the teammate adds, renames and deletes a page the owner never opens. Cut off, the owner:

  1. renames the strategy;
  2. restores that page from Recently deleted;
  3. switches every side;
  4. turns on neutral colours. The page on screen takes them. The other pages are refused with words that name the page and the way out. This is the common way to meet that refusal: this computer has the page's row from the trash, but has never read its settings.

Once the network is back:

  • the name, the page order and every side are in the store and on the server, for both players;
  • after opening the restored page, neutral colours land on every page.
Recently deleted, offline Neutral colours refused, naming the page Back online Neutral colours once the page loaded Teammate
f1 f3 f4 f5 g1

What each control writes

All three use #1009's turn in StorePageStructure: StoreOwnership.inTurn, one readStrategy used as seen, one commitEachAs, and one retry on revisionMismatch. They use no marks. Each is a discrete tap, not canvas state compared at a handover.

Control Op Base
Strategy name (the editor's title, and the library dialog when it names the open store-owned strategy) StrategyPatchOp{name} the store row's revision (the lead's rule, as for map and theme)
Side of every page (F) one PagePatchOp{isAttack} per other live page whose side differs, all in one commit each page row's revision, as the store draws it
Neutral team colours one PageSettingsPatchOp per other live page whose setting differs, all in one commit; the page's other settings are kept, unknown fields included each page's settings read with readPage, as the store draws it

The page on screen still goes through its canvas handover, as on main. That makes it and the batch two writes.

Neutral colours read each page with readPage. readStrategy draws no page content, so its settings rows leave out this computer's unsent settings edits. A first version built on them, and a test caught it overwriting an unsent marker size on another page. The test "neutral colours turned on for every page while offline keep the marker size …" now pins this.

The title follows the store. While the strategy is store-owned, state.strategyName follows the name in the drawn snapshot header, which is the store's row. So a teammate's rename, a refusal, a hold and the reopened store after a doubt all show what the store holds. A written rename sets the title on the same frame.

Results, sealed (the lead's conditions)

PageChangeStopped is a sealed subset of PageChange: refused, blocked, not saved, in doubt, not owned, not made. The turn returns either the per-change answers or a stop. For the all-pages controls, EveryPageChange = EveryPageSaved(held pages with reasons, missed pages) | EveryPageNotChanged(stop). Every switch on these is exhaustive, with no default arm.

  • Some saved and some held: EveryPagePartlyHeldFace names the held pages ("A teammate changed 'Page 2' first… The other pages have your change"). The redraw takes the store's rows, which leave out only held work.
    • An unchecked page patch can't be held at commit today, so this arm can't be reached yet, like C2 PR 2: map and theme picks through the store #1012's ChangeHeldForUser arm.
    • The reachable partial hold is at the server. There, the store holds the refused page, it isn't drawn, and the sync button says it needs the player. The two-write tests and pair run 3 show it.
  • Refused before commit, named with the way out (en, ja, zh):
    • PageBlock.notLoaded: "'{page}' hasn't loaded on this computer yet, so the other pages weren't changed. Open it while you're online, then try again." This covers the store's own SettingsNeedContent, and a page whose settings the store has no row for.
    • PageBlock.unreadable: "'{page}' holds settings this version of Icarus can't read, so the other pages weren't changed. Update Icarus, then try again."
    • Both say "the other pages", because the page on screen took the change through its handover.
  • Rename:
    • refused or not saved: "Your change to the strategy's name wasn't saved because …. It was undone."
    • in doubt: "Icarus isn't sure the strategy's new name was saved. Once your library reopens, the name shows what was saved." Nothing is re-sent, and the title shows the store's name.
    • held: faceOfHeld.
  • All-pages controls: a second mismatch, not saved, and in doubt reuse Page add, duplicate, delete, rename, reorder and restore commit to the store in a store-owned strategy #1009's page faces, followed by a redraw from the store.

Cost per tap

For merge: no network in any tap's path. The title and the toggle change on the tap's own frame.

Tap Store reads Commits
Rename 1 readStrategy 1
Side of every page 2 readStrategy (the one the commit names as seen, and the check after it) 1 for all the other pages together; 0 when none differ
Neutral colours 2 readStrategy + 2 readPage per other live page (to build, and to check after) 1 for all the other pages together; 0 when none differ

The page on screen costs its usual handover. A revisionMismatch, or a page that is still wrong after the check, repeats the reads and the commit once. The lands tests assert the commits each tap makes with the sender offline: 1 for a rename, 2 for each all-pages tap (the handover and the batch).

Tests

In store_canvas_commit_test.dart, group "the name and every page of a store-owned strategy". Each test was run on main (863ea63) with the same test code. The only edit for main was that the two refusal tests match any face, because EveryPageBlockedFace doesn't exist there.

Test On main Now
a strategy renamed in the editor lands in the store and on the server, and the title shows it fails: the store keeps B split (main sends strategies:update over the network) passes
a teammate's rename that reaches the store shows in the editor's title fails: the title keeps B split passes
every page's side switched at once lands on every page fails: page 2 keeps its side passes
neutral team colours turned on for every page land on every page fails: page 2 false passes
two writes: the page on screen lands, the other page is held for the player and shows the server's side, and nothing says the switch was not saved fails: no entry needs the player (StoreMatchesServer), because page 2 was never sent passes
two writes: the other page lands, the page on screen is held for the player, and each page shows what the store holds fails: page 2 keeps its side passes
neutral colours while a restored, never-read page is there change only the page on screen, and name that page fails: main's old path asks the server for a full snapshot, which the test server doesn't serve (Null check operator) passes
neutral colours while one page's settings can't be read: the same, with "update" fails the same way passes
neutral colours offline keep this computer's unsent marker size on the other page, and land with it on reconnect fails: page 2 false passes

Changed with the lead's OK:

  • store_owned_open_test: the name and every-page controls are on.
  • The test "the controls that change every page are off…" is removed. The side test above replaces it.
  • The driver's expectStoreEditable now requires both controls on.

Proof

  • Locally: store_canvas_commit_test.dart and store_owned_open_test.dart, 120 tests, all pass.
  • flutter analyze on every changed Dart file, tests included: no issues.
  • node tool/comments.mjs check: passes.
  • Driver: pair run 3 and offline run 2 above. Earlier runs failed on script coordinates (pair 1, offline 1), not on the app. Pair run 2 was clean too.
  • New steps: storeExpectStrategyName, and storeExpectEveryPage (side and/or neutral colours, in the store, on the server and on the canvas).
  • New scripts: store-strategy-owner/mate.json, and store-strategy-offline(-mate).json.

Parked for Dara

Not covered

Sol's read of f1c29c3, as the lead ruled

Each was run on f1c29c3 with this head's test code first.

Finding Fix Test On f1c29c3
1. Leaving while a rename waits for its turn drops it silently The exit guard waits for the store turn (StoreOwnership.turnsDone) before it judges what is unsaved, as it already hands the canvas over first. This covers every tap that goes through the turn: #1009's page add, delete, rename, reorder and restore, and the controls here. A PageChangeNotOwned that still reaches the editor now says "You left the strategy before your change was saved, so it wasn't saved." guard: "a store write still in its turn, such as a rename just pressed, is waited for…"; store: "a strategy renamed and left before its turn ran…", and "a page renamed from the pages bar and left before its turn ran…" guard: left at once (Expected: null, Actual: true); both store tests: no face (Expected: ['LeftBeforeSavedFace'], Actual: [])
2. An all-pages tap misses a page changed between its read and its commit Sides are built from the read the commit names as seen. After the commit, both controls read every page again; a page without the value is the turn's one retry; after that EveryPageSaved.missed names it ("{pages} changed while your change was being saved…"). EveryPageSaved.saved is gone. "every page's side switched while a teammate's change to a page it skipped reaches the store between its read and its commit…", and the same for neutral colours Expected: false, Actual: true (side); Expected: true, Actual: false (neutral)
3. A teammate's rename during an open leaves the old title The title is taken from the drawn header when the open completes, not from the snapshot read before the storage wait "a teammate's rename that reaches the store while the strategy is still opening is the title once it opens" Expected: 'Their name', Actual: 'B split'
4. Pages-wide words for a part of the tap The batch never includes the page on screen, so its faces speak of "the other pages": changed meanwhile, not saved, in doubt (en, ja, zh) "neutral colours this computer cannot save on the other pages say so about the other pages…" Expected: ['OtherPagesNotSavedFace'], Actual: ['PageChangeNotSavedFace']
5. The side button's tooltip promised every page A click on a store-owned strategy switches every page, as it does for any other strategy, so the tooltip ("Switch side on all pages / Shift+click: this page only") is true again map_selector: "a click on the side of a store-owned strategy switches every page, as its tooltip says" Expected: [true], Actual: [false]

The two race tests for finding 2 were reworked: the first versions passed on f1c29c3, because the store runs its reads and writes strictly in order. They now park a store write so the batch's read comes first, then queue the teammate's change before the batch's commit, and they fail on f1c29c3 as shown.

Sol's test gaps:

  • The unreadable-settings refusal now has three pages, and asserts that the readable one isn't written, in the store or on the server.
  • The lands tests count commits.

cloud-store-own-open.json (after #1024): its strategy-wide section now renames from the title, presses F and turns on neutral colours, and requires each one in the store, on the server and on screen. Run on this head: 160 steps, clean.

Driver on 929a905: pair run 4 (owner 90 steps, teammate 52), offline run 3 (owner 89, teammate 40), own-open run 1 (160): all clean.

ci: analyze test web desktop

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Store-owned strategies now allow strategy renames and bulk page-side and neutral-colour changes through store commits. Batched changes report blocked or partly held outcomes, and remote strategy-name snapshots update the editor. Drive checks and collaboration scenarios cover these flows.

Changes: Store-Owned Strategy Editing

Layer / File(s) Summary
Batch store commits and page outcomes
lib/strategy/store_page_structure.dart
Store page changes now use batched operations. All-page side and neutral-colour changes return saved and held page results, or a stopped outcome when a change cannot proceed.
Editor routing and outcome reporting
lib/collab/strategy_capabilities.dart, lib/providers/strategy_provider.dart, lib/strategy/store_page_commit.dart, lib/l10n/app_*.arb, test/library_store/store_canvas_commit_test.dart, test/library_store/store_owned_open_test.dart
Store-owned strategies expose rename and all-page capabilities. The editor routes these operations through the store, updates its name from matching remote snapshots, and reports blocked or partly held changes. Tests cover successful edits, teammate changes, offline updates, and unreadable or unloaded page settings.
Drive checks and collaboration scenarios
lib/dev/drive/drive.dart, lib/dev/drive/drive_cloud_store.dart, tool/drive/README.md, tool/drive/scripts/store-strategy-*.json
Drive adds checks for strategy names and all-page settings. The owner, mate, and offline scenarios exercise shared edits and synchronization. Documentation now describes the store-owned controls as editable.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant StrategyProvider
  participant StorePageStructure
  participant Store
  StrategyProvider->>StorePageStructure: Request rename or all-page change
  StorePageStructure->>Store: Submit strategy or page patch batch
  Store-->>StorePageStructure: Return saved, held, or stopped result
  StorePageStructure-->>StrategyProvider: Return change outcome
  StrategyProvider->>StrategyProvider: Update strategy name or report outcome
Loading

Possibly related issues

  • SunkenInTime/icarus#709 — The issue plans store-backed all-page side and settings operations. This PR routes those operations through the store.
  • SunkenInTime/icarus#898 — The issue describes on-demand page reads. This PR blocks all-page neutral-colour changes when page settings are not loaded or readable.
  • SunkenInTime/icarus#984 — The issue concerns page-settings writes that drop unknown fields. This PR preserves other known settings and unknown fields when building neutral-colour patches.

Possibly related PRs

  • SunkenInTime/icarus#968 — That PR disables store-owned all-page controls; this PR enables those controls and routes them through the store.
  • SunkenInTime/icarus#962 — That PR establishes store-owned strategy state and write gating, which this PR uses for store-backed renames and all-page changes.
Merge Risk: Minimal · up to f1c29

This change lets store-owned strategies rename the strategy and apply side and neutral-colour changes to all pages through the store, with clear notices when a page is blocked or held. No concrete merge-blocking defect was found, and the drive scenarios and tests cover the main flows.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "C2: strategy rename and the all-pages controls through the store" matches the main change. The diff re-enables strategy renaming and the every-page side and neutral-colour controls for stor…
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 "C2: strategy rename and the all-pages controls through the store" matches the main change. The diff re-enables strategy renaming and the every-page side and neutral-colour controls for store-owned strategies, routing them through the store. It also adds the store methods (renameStrategy, sideOfEveryPage, neutralColoursOfEveryPage) and the related tests and localization strings. The "C2:" prefix is a tracking label rather than a description, but the rest of the title is specific and accurate.

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: 9ebadff6-d668-4d08-a603-dacbcf31b937
Commits

Reviewing files that changed from the base of the PR and between 863ea63 and f1c29c3.

Files selected for processing: 16

  • lib/collab/strategy_capabilities.dart
  • lib/dev/drive/drive.dart
  • lib/dev/drive/drive_cloud_store.dart
  • lib/l10n/app_en.arb
  • lib/l10n/app_ja.arb
  • lib/l10n/app_zh.arb
  • lib/providers/strategy_provider.dart
  • lib/strategy/store_page_commit.dart
  • lib/strategy/store_page_structure.dart
  • test/library_store/store_canvas_commit_test.dart
  • test/library_store/store_owned_open_test.dart
  • tool/drive/README.md
  • tool/drive/scripts/store-strategy-mate.json
  • tool/drive/scripts/store-strategy-offline-mate.json
  • tool/drive/scripts/store-strategy-offline.json
  • tool/drive/scripts/store-strategy-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.

… rename is one strategy patch, the side of every page and neutral team colours are one commit over the other pages, each read as the store draws it; the title follows the store's name; a page that has not loaded or cannot be read is named with the way out
…rategy says so; every-page taps check every page after the commit and retry once; the title is the store's when the open completes; every-page faces speak of the other pages; the side button switches every page on a store-owned strategy too
…, and requires each in the store, on the server and on screen
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