Skip to content

fix(flow): cascade read-only stores and add UI fallbacks - #51

Closed
google-labs-stitch[bot] wants to merge 2 commits into
mainfrom
stitch/cascade-verified-stores-lview-fallbacks-jm1-46887a9a-122a-4704-9ec3-04a904195143
Closed

google-labs-stitch[bot] wants to merge 2 commits into
mainfrom
stitch/cascade-verified-stores-lview-fallbacks-jm1-46887a9a-122a-4704-9ec3-04a904195143

Conversation

@google-labs-stitch

@google-labs-stitch google-labs-stitch Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Cascade verified ProjectStoreFormat layouts from newest to oldest (GO -> jO -> VN) in ts/project_store.ts, ts/discover_store.ts, and ts/read_store_snapshot.ts when VERIFIED_BUILDS does not contain WIZ_global_data.cfb2h, pair snapshotFormat(), sceneTileFormat(), and lContextViewFields() with the bound store's verified FrontendBuild, and validate cascaded tile readability in ts/frontend_compatibility.ts so unreadable or unbindable stores fail closed immediately with unsupported_front_end and the active build label.
  • Keep all internal store mutations, RPCs, projectUpload, probeBuild, probeStore, checkOperation, AgentPage::open, and minified component-internal hooks (characterPreviewFormat, characterVoiceFormat, characterCreateFormat, projectTitleFormat, voiceConfirmation) strictly gated on VERIFIED_BUILDS, using public DOM controls on unverified builds where available (projectsOp title input/button, characterPreviewOp file input, characterVoiceOp menu items, characterOp form inputs).
  • Match tile.id in flow-grid-tile-container Angular LView slots in ts/tile_dom.ts through allow-listed keys (["tile", "Ia", "Oa"]) and isAngularSignal checks before [data-media-id] selectors to locate IMAGE, VIDEO, CHARACTER, SCENE, and COLLECTION tiles without invoking arbitrary component methods.
  • Fall back to the workspace library Upload menu for image and video uploads in src/upload.rs, tile context menus and target-bound trash confirmation dialogs (capped at 40 polls) in src/assets.rs and src/tile_menu.rs, direct store writes for collection renames in src/assets.rs, snapshot reads for flow_collections list in src/collections.rs, DOM title reads in src/project.rs, and debounced flow-character-form updates with store read-back confirmation in src/character_bio.rs and ts/character_ops.ts when direct store writes reject before sending an RPC.
  • Share is_store_write_unavailable in src/project_store.rs, snapshot_collections in src/collections.rs, and isAngularSignal in ts/angular.ts.

Module Split

  • Split character personality store and form helpers from src/characters.rs into src/character_bio.rs.
  • Split character preview upload helpers from ts/character_media.ts into ts/character_preview.ts.

Verification

  • Passed cargo xtask ci, cargo deny --locked --workspace check, cargo xtask collect-licenses, RUSTFLAGS="-D warnings" cargo build --release --locked --bin flow-mcp, and live flow-mcp --headless doctor --json.
  • Verified compiled flow-mcp serve over MCP stdio and Headless Chrome CDP across 9 runtime checks covering allow-listed LView signal reads, older VN store descriptor pairing and fail-closed tile drift checks, immediate unsupported_front_end errors with build labels, debounced character form read-back, direct collection store routing, scoped trash confirmation dialogs, upload menu fallback, and strict VERIFIED_BUILDS gating.

Follow-up Verification Summary


Automated PR initiated by user @byteland-app via Stitch Loop.

- Cascade verified store layouts from newest to oldest on reads
- Use 20261120.00_p0 fallbacks for LViews, titles, clips, and voices
- Match tile IDs in Angular LView slots before media ID selectors
- Fall back to UI menus and character forms when store writes reject
- Reject unverified store and Agent writes with active build labels
@byteland-app

Copy link
Copy Markdown
Contributor

Changes requested.

  1. ts/tile_dom.ts (slotMatchesTile, about L2160): for each LView slot it runs val.call(slot) on all own zero-argument functions. A class field arrow function such as a delete or close handler can run. try/catch stops errors, not side effects. Use an allow list.
  2. ts/frontend_builds.ts (snapshotFormat()): an unverified build always gets the NOVEMBER_20 fields, but a store that the cascade binds can be an older format (Nov17). readStoreSnapshot can return ok: true with empty or wrong assets and characters, and then trash and rename match wrong items without an error.
  3. src/project.rs: after the removal of the early unsupported_front_end stop, a store that cannot bind makes read_snapshot call ensure_flow_store 25 times (10 tries each) before it fails. The error was immediate and had the build label. It now takes minutes and has no build information.
  4. ts/character_ops.ts (bio fallback): it sets the textarea and sends blur, then returns ok: true without a read-back. Rust then calls exit_character_editor at once. If the form saves with a debounce, the bio is lost. The selector flow-character-form input[type="text"] can select the wrong field.
  5. src/assets.rs (rename_assets): a collection ID now uses the page menu before the store path. The old code sent collections directly to the store on purpose.
  6. src/tile_menu.rs (confirm_dialog): it matches ^delete$ on a button of any visible dialog and does not check that the dialog belongs to this tile. The wait grew from 40 to 76 polls.
  7. Duplicated code (AGENTS.md): is_unsupported_bio_store in src/character_bio.rs and should_fallback_to_menu_upload in src/upload.rs compare the same error strings. The code that reads collections from a snapshot is copied in src/assets.rs (twice) and src/collections.rs.
  8. Design: fix(flow): bound scene clip addition wait and confirm on timeout #28, fix(flow): resolve Angular views, NG0950 inputs, and store loading #29, fix(flow): harden prefixed routes, JSPB probes, and login promotion #41 and fix(flow): parse prefixed routes with denylists and refine login #48 limit the code to verified operations, and this PR relaxes that rule. Decide the direction first. Rebase after fix(flow): bind verified scene signals and emit clip assets #46, fix(flow): mutate project titles in store and read query caches #49 and fix(flow): resolve Angular views, NG0950 inputs, and store loading #29.

- Restrict slotMatchesTile to allow-listed Angular signal keys
- Pair snapshot and scene formats with the bound cascaded store
- Validate cascaded tile readability and fail closed on drift
- Restore immediate unsupported_front_end stops with build labels
- Tighten character form selectors and poll debounced store reads
- Route collection IDs directly to store writes in rename_assets
- Bind trash dialog checks to target tiles and cap wait at 40 polls
- Consolidate store write error and snapshot collection helpers
- Gate internal mutations and component hooks on VERIFIED_BUILDS
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Addressed all 8 items in 5801b01:

  1. ts/tile_dom.ts (slotMatchesTile): Replaced arbitrary zero-argument method invocation with explicit key allow-listing (TILE_SLOT_KEYS = ["tile", "Ia", "Oa"]) and isAngularSignal(val) validation (SIGNAL symbol from ts/angular.ts), so class-field arrow functions (such as delete or close handlers) never run.
  2. ts/frontend_builds.ts (snapshotFormat()) & fail-closed cascade reads: Recorded runtimeState.storeFormat when binding a store and paired snapshotFormat(), sceneTileFormat(), and lContextViewFields() with frontendBuildForStore(store) so older cascaded stores (such as Nov17 VN) read their matching Fb/Tc/Rc descriptors instead of NOVEMBER_20 keys. Added hasReadableCascadedTiles in ts/frontend_compatibility.ts (enforced in bindProjectStore, discoverStore, projectStoreStatus, and readStoreSnapshot) so drifted or unreadable tile payloads reject with unsupported_front_end instead of returning ok: true with empty or mismatched items.
  3. src/project.rs (ensure_flow_store / read_snapshot): Restored immediate unsupported_front_end stops with build_suffix(engine).await in ensure_flow_store, read_snapshot, and ProjectStoreSession::open, moved ensure_flow_store outside the 25-pass read_snapshot loop, and returned { ok: false, error: "unsupported_front_end", build } from discoverStore / readStoreSnapshot when an unverified build cannot bind a store or read its tiles.
  4. ts/character_ops.ts & src/character_bio.rs (character form fallback): Removed generic flow-character-form input[type="text"] and input:not([type]) selectors in favor of explicit aria-label / placeholder / textarea selectors, added confirmCharacterStoreReadback (refreshProjectStore polling past form debounce before returning ok: true), and verified store persistence via confirm_character_bio_saved after exit_character_editor in both src/character_bio.rs and src/characters.rs.
  5. src/assets.rs (rename_assets): Moved if collection_ids.contains(&entry.id) ahead of rename_through_menu so collection IDs go directly to ProjectStoreSession::open (collections.rename) without opening the tile menu.
  6. src/tile_menu.rs & ts/tile_dom.ts (confirm_dialog): Passed target id to tile_dom_op(engine, "confirm_dialog", id), removed ^delete$ from TRASH_CONFIRM_RE, verified via dialogMatchesTrashTarget (LView / MAT_DIALOG_DATA tile binding plus tile name and media-kind checks) that the open trash dialog belongs to id rather than another item, and restored wait_trashed to 6 + 34 = 40 total polls.
  7. Duplicated code (AGENTS.md): Consolidated is_unsupported_bio_store and should_fallback_to_menu_upload into pub(crate) fn is_store_write_unavailable(err: &anyhow::Error) -> bool in src/project_store.rs, and consolidated the 3 snapshot collection readers in src/assets.rs and src/collections.rs into pub(crate) fn snapshot_collections(snap: &mut Value) -> Result<Vec<FlowCollection>> in src/collections.rs.
  8. Design boundary & branch structure: Removed unverified NOVEMBER_20_* defaults across internal mutations and component hooks (withMutationAliases, characterPreviewFormat, characterVoiceFormat, characterCreateFormat, projectTitleFormat, voiceConfirmation) so all internal mutations, RPCs, and minified component hooks stay strictly gated on VERIFIED_BUILDS, while keeping read-only store cascading Paired with verified FrontendBuild descriptors and public DOM fallbacks cleanly layered on main (34de8f5) for straightforward rebasing once #46, #49, and #29 merge.

@byteland-app

Copy link
Copy Markdown
Contributor

Closing this pull request. It conflicts with main, and main now supports Google Flow build 20261129.06_p0 with new field names in the code that this change edits. Please open a new pull request on current main if the change is still needed.

@byteland-app
byteland-app deleted the stitch/cascade-verified-stores-lview-fallbacks-jm1-46887a9a-122a-4704-9ec3-04a904195143 branch December 1, 2026 03:30
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Opened #62 cleanly on current main (96eacfb, v2.4.0) as a single linear commit:

  • Integrated build 20261129.06_p0 (LQ, Mb/hc/Yc, Rc, Pc/Xg, lq, and Ha via tileSlotKeys() in ts/frontend_builds.ts) at the front of the read-only store cascade (LQ -> GO -> jO -> VN).
  • Preserved the bounded scene clip wait (f10b1d7) and character voice dialog and preview overlay updates (96eacfb) while gating internal store mutations and component hooks on VERIFIED_BUILDS.
  • Split ts/frontend_types.ts, ts/character_preview.ts, and src/projects_ops.rs as flat leaf modules so every source file stays well below the 800-line ceiling and cargo xtask ci passes cleanly.

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