Skip to content

fix(flow): mutate project titles in store and read query caches - #49

Closed
google-labs-stitch[bot] wants to merge 2 commits into
mainfrom
stitch/store-project-titles-and-query-caches-jm1-a778f9c6-0c31-475e-85bb-bafa9c00bb72
Closed

google-labs-stitch[bot] wants to merge 2 commits into
mainfrom
stitch/store-project-titles-and-query-caches-jm1-a778f9c6-0c31-475e-85bb-bafa9c00bb72

Conversation

@google-labs-stitch

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

Copy link
Copy Markdown
Contributor

Summary

  • Define ProjectMetadataFormat in ts/types.ts and map project metadata symbols and home dashboard grid symbols for both boq_labs-ai-sandbox-frontend_20261120.00_p0 (Rb, $N, Ag, Lc, YJ, Jk, Sg, pM, AE, tI, Y7, Id, xs, zf, Ub, getMetadata, Qd, Jn in ts/frontend_builds.ts) and boq_labs-ai-sandbox-frontend_20261129.06_p0 (oc, ZP, Yf, Ad, IH, xl, qh, sO, hG, iK, K7, Dd, ot, nf, Sb, getMetadata, Ud, ko in ts/frontend_nov29.ts), and append metadata_service, metadata_mutator, and project_title_signal checks to probeStore() in ts/frontend_compatibility.ts without changing FRONTEND_OPERATIONS.
  • Add ts/project_metadata.ts to dispatch set_project_title (Sg / qh) through ProjectStore, require loaded PROJECT (Ag / Yf) metadata before mutation, confirm the Jk() / xl() title signal, read PROJECT and PROJECT_DETAILS entries from QueryClient through configured getters, and paginate PROJECTS and SHARED_PROJECTS infinite queries up to 50 pages.
  • Route create_project and rename_project in src/project.rs through ProjectStoreSession on verified builds so renames run in place on active subroutes without touching <flow-editable-text> inputs.
  • Preserve /project/<id>/collection/<cid> in ensure_project_workspace_root (src/project_route.rs, ts/project_nav.ts), add ensure_project_root_route (exit_to_project_root) for legacy DOM set_title fallback, reject subroute URLs in projectsOp({ action: "set_title" }), and restrict legacy DOM set_title fallback to WORKSPACE_HEADER_SELECTOR (including <header> inside <main>).
  • Read Jk() / xl() and QueryClient caches verbatim in readStoreSnapshot (ts/read_store_snapshot.ts), clean "Google Flow" wrappers only on document.title, remove Editable text DOM scraping, and return project_id and project_title from flow_assets (src/assets.rs, src/service.rs, docs/*/tools-reference.md) across subroutes and /trash.
  • Read cached card protobufs for flow_projects list and open, scroll .load-more-sentinel up to 50 pages during delete until the target card mounts, skip mat-icon / [aria-hidden="true"] subtrees via TreeWalker without filtering plain-word titles, and confirm card removal without extra pagination requests.

Verification

  • Run cargo xtask ci, cargo deny --locked --workspace check (CI: OK), and headless Chrome runtime verification on both boq_labs-ai-sandbox-frontend_20261120.00_p0 and boq_labs-ai-sandbox-frontend_20261129.06_p0.
  • Verify end-to-end behavior with the compiled flow-mcp MCP server and headless Chrome across store and legacy scenarios:
    • In-place flow_projects rename across /collection/<cid>, /character/<cid>, /scene/<sid>, /edit/<wid>, and /tool/<tid> updates Jk() / xl() with zero edits to subroute or sidenav <flow-editable-text> inputs, and preserves titles such as "Flow", "Trash", "Flow: X", and "X - Flow":
      In-place store rename on collection subroute
    • flow_status (probe: true), probeStore(), and flow_assets (list) read authoritative titles from QueryClient on /project/<id>/trash while cleaning generic "Google Flow - ...: Trash" document.title values to null:
      Authoritative cache title on trash route
    • flow_projects list, open, and delete paginate PROJECTS and SHARED_PROJECTS past card 21, ignore raw protobuf arrays when getters return undefined, preserve plain-word DOM titles (edit, add, check, folder, public, lock, share, delete, close), confirm deletion with zero extra pagination requests, and bound faulty pagination at 50 pages:
      Multi-page dashboard grid pagination and card deletion

- Map project metadata mutator and home grid queries in VERIFIED_BUILDS
- Dispatch set_project_title in ProjectStore and verify the Jk signal
- Route project create and rename through ProjectStoreSession
- Exit collection subroutes on workspace return and keep file uploads
- Reject subroutes in fallback set_title and scope inputs to the header
- Read project titles from Jk and QueryClient caches without DOM inputs
- Paginate owned and shared grid queries and strip mat-icon ligatures
@byteland-app

Copy link
Copy Markdown
Contributor

Changes requested.

  1. src/project_route.rs (ensure_project_workspace_root): it now leaves every /project/<id>/<x> route, also /collection/<cid>. The callers in generation.rs, scenes.rs, voices.rs and characters.rs have no exception, so they navigate away from a collection page. This is the same point as in fix(flow): enforce root routes and scroll grid sentinels #45.
  2. clean_flow_page_title is now used also for the real projectTitle from Jk() or the cache. A project named "Flow" or "Trash", or "Flow: X" or "X - Flow", loses the text or becomes None. get_flow_state then overwrites project, and confirm_project_title can fail after a rename to such a name. Use the cleaning only for document.title.
  3. ts/projects_ops.ts (ICON_LIGATURE_RE): it filters the words edit, add, check, folder, public, lock, share, delete and close. A project with one of these names gets a null title in the DOM fallback.
  4. FORBIDDEN_TITLE_ANCESTOR contains main and the header selector has header. If an older build has the header inside main, the legacy set_title always returns project_title_input_not_found.
  5. ts/project_metadata.ts (readProtoString): when the getter fails, it uses the first string of any array field as the id or the title. This can give a wrong project id to the delete match.
  6. ensureProjectMetadataLoaded continues after 8 s even when PROJECT is not loaded. listCachedProjects() fetches all pages at every call and isRemovedNow polls up to 20 times, so a delete causes many requests.
  7. project_metadata.ts has 857 total lines (about 742 code lines). Confirm with cargo xtask check. Update docs/*/tools-reference.md if the output changes.

This PR overlaps with #45 (root routes, Jk title field), #48, #41 (closed), #46 and #51. Rebase after #48.

- Keep /collection/<cid> in ensure_project_workspace_root
- Add ensure_project_root_route for legacy DOM title fallback
- Clean Google Flow wrappers only on document.title
- Strip icon nodes in card fallback without filtering plain words
- Allow workspace header inside main for legacy title edits
- Read protobuf fields only from configured getters and keys
- Require loaded PROJECT metadata before title mutations
- Confirm card deletion without full-cache list pagination
- Document project_title in flow_assets list reference
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Addressed all 7 points in 6e21a2b:

  1. ensure_project_workspace_root on /collection/<cid> (src/project_route.rs, ts/project_nav.ts, src/characters.rs, src/upload.rs): Restored ensure_project_workspace_root (is_non_grid_subroute_url + exit_subroute) so /project/<id>/collection/<cid> is preserved for callers in generation.rs, scenes.rs, voices.rs, characters.rs, and upload.rs. Added a separate ensure_project_root_route (exit_to_project_root) used only by the legacy DOM apply_project_title fallback in src/project.rs.
  2. clean_flow_page_title restricted to document.title (src/project_route.rs, src/project.rs, src/assets.rs, ts/project_metadata.ts): Removed clean_flow_page_title from snap["projectTitle"] in get_flow_state, open_project, and read_project_assets, and restricted clean_flow_page_title / cleanFlowDocumentTitle strictly to "Google Flow" wrappers on document.title. Titles from Jk() and QueryClient (such as "Flow", "Trash", "Flow: X", and "X - Flow") are preserved verbatim.
  3. ICON_LIGATURE_RE plain-word filtering (ts/projects_ops.ts): Removed ICON_LIGATURE_RE. DOM card fallback now prefers .project-title-text and reads text with a TreeWalker that skips mat-icon / [aria-hidden="true"] subtrees without falling back to unstripped text, keeping real titles like edit, add, check, folder, public, lock, share, delete, and close.
  4. FORBIDDEN_TITLE_ANCESTOR and <main> (ts/projects_ops.ts): Removed main from FORBIDDEN_TITLE_ANCESTOR (retaining mat-sidenav, aside, [role="navigation"], flow-grid-tile-container, [role="dialog"]) and added flow-tile-view-header to WORKSPACE_HEADER_SELECTOR, allowing legacy set_title to find <header> inside <main>.
  5. readProtoString array fallback (ts/project_metadata.ts): Removed fallbackFieldIndex and Object.values(msg) array scanning from readProtoString and collectPagesEntries, and gated obfuscated Closure getters on activeProjectMetadataFormat().
  6. ensureProjectMetadataLoaded and delete pagination (ts/project_metadata.ts, ts/projects_ops.ts, src/project.rs): ensureProjectMetadataLoaded now aborts before write (project_metadata_load_failed / project_metadata_not_loaded, returned as { ok: false, error } prior to writeStarted) whenever PROJECT is not loaded. Removed listCachedProjects() from projectsOp({ action: "delete" }) and removed the pre/post list calls from delete_project, confirming removal via card detachment, !isProjectsGridFetching(), and scanCards(false) with zero extra pagination requests.
  7. Line count and tool docs (ts/project_metadata.ts, docs/*/tools-reference.md): Reduced ts/project_metadata.ts to 779 total lines (cargo xtask check and cargo xtask ci pass) and documented project_title in flow_assets (list action) across docs/en/tools-reference.md, docs/zh-CN/tools-reference.md, and docs/ja/tools-reference.md.

(#48 is still open, so this branch keeps fast-forward history against main for now and is ready to rebase once #48 lands.)

@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/store-project-titles-and-query-caches-jm1-a778f9c6-0c31-475e-85bb-bafa9c00bb72 branch December 1, 2026 03:30
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Opened #56 on current main (47de826) with merged conflict resolutions and verified ProjectMetadataFormat and subroute ProjectStore slot mappings for Google Flow build boq_labs-ai-sandbox-frontend_20261129.06_p0.

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