Skip to content

fix(flow): enforce root routes and scroll grid sentinels - #45

Open
google-labs-stitch[bot] wants to merge 5 commits into
mainfrom
stitch/fix-project-root-routes-and-grid-pagination-jm0-808d7af3-e66f-45d4-80c8-1fcd24d36dbb
Open

google-labs-stitch[bot] wants to merge 5 commits into
mainfrom
stitch/fix-project-root-routes-and-grid-pagination-jm0-808d7af3-e66f-45d4-80c8-1fcd24d36dbb

Conversation

@google-labs-stitch

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

Copy link
Copy Markdown
Contributor

Summary

  • Add url_route_path, is_project_subroute_url(url, allow_collection), collection_id_from_url, is_character_route_url, and clean_project_title(raw, verified) in src/project_route.rs so workspace callers (allow_collection = true across upload.rs, generation.rs, scenes.rs, voices.rs, and characters.rs) keep /project/<id>/collection/<cid> grid pages intact while exiting /chat, /edit/*, /scene/*, /character/*, /collection/<cid>/character, /trash/*, and /tools subroutes, rename_project (allow_collection = false) exits /collection/<cid> to /project/<id>, and character route checks match /character segments without matching /characters.
  • Update ensure_project_route / ensure_project_workspace_root (src/project.rs), projectNav("exit_subroute" | "exit_to_root") (ts/project_nav.ts), rename_project (src/project.rs), characterOp (ts/character_ops.ts), and exit_character_editor (src/characters.rs) so collection views remain active on workspace operations while project renames always run on /project/<id>.
  • Reject subroute and non-root paths in projectsOp({ action: "set_title" }) (ts/projects_ops.ts) and scope editable title selection strictly to flow-project-page flow-tile-view-header flow-navigation-header flow-editable-text, ignoring sidenav <flow-editable-text> inputs.
  • Add title: "Jk" to ProjectStoreFormat (ts/frontend_builds.ts), expose getTitle() and isTitleVerified() in ts/project_store.ts with PROJECT_DETAILS and PROJECT query cache fallbacks, remove Editable text DOM scraping in ts/read_store_snapshot.ts, unwrap at most one "Google Flow - " or "- Google Flow" wrapper on unverified fallback document.title values without touching "Flow - ..." user titles, and propagate verified titles through get_flow_state, open_project, confirm_project_title, read_project_assets, and flow_assets.
  • Extract ts/projects_grid.ts and share one 45-second deadline (open_signed_in_home_page / timeout_ms) across home-page navigation, .load-more-sentinel pagination, and project deletion confirmation: wait while .load-more-sentinel remains active until new cards load, hasNextPage reaches false, stopWhen matches, MAX_GRID_PAGES is reached, or the deadline expires (truncated: true), aggregate multi-query (PROJECTS + SHARED_PROJECTS) pagination signals, verify deletion against rendered cards without rescanning sentinel pages, return project_scan_timeout if the deadline expires before the confirmation click, return outcome_unknown (stage: "confirm_project_delete") if confirmation expires after the write, and read icon-free .project-title-text titles via TreeWalker without stripping single-word titles.

Verification

  • cargo xtask ci: Passed formatting, license headers, LF line endings, 800-code-line ceiling (src/project.rs: 756/800, src/characters.rs: 780/800, ts/projects_grid.ts: 716/800), forbidden construct checks, contract checks, tsc --noEmit, Clippy (-D warnings), rustdoc (--document-private-items), workspace build, and cargo deny.
  • Live Google Flow build check (flow-mcp --headless doctor --json): Confirmed compatibility against live boq_labs-ai-sandbox-frontend_20261120.00_p0.
  • Headless Chrome & Rust behavioral suite: Verified slow unobserved network pagination (> 2 retries, 4.8s page latency) loading page-2 targets with truncated: false, slow-network budget expiry with active .load-more-sentinel reporting truncated: true (timeout instead of "No project matches"), dual-query (PROJECTS + SHARED_PROJECTS) pagination, /collection/<cid> preservation on workspace ops vs. /project/<id> root exit on rename_project, single "Google Flow" wrapper unwrapping preserving "Flow - Notes" and single-word card titles ("Edit", "Share"), /character segment matching rejecting /characters, early target stop on delete with zero post-confirm sentinel scrolls, and post-write confirmation expiry returning outcome_unknown.

Verification report

- Add subroute URL and fallback title helpers in project_route.
- Exit collection and editor subroutes before workspace title edits.
- Scope set_title to the workspace header and reject subroute paths.
- Read Jk and PROJECT_DETAILS titles in the bound project store.
- Scroll load-more-sentinel up to 50 pages and strip icon ligatures.

@byteland-app byteland-app left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ts/projects_ops.ts:195–224 can spend more than 120 seconds on one sentinel scan. Project deletion calls the full scan again after the confirmation click at lines 702–722. A client can get a timeout while Flow has already deleted the project. Use one deadline for pagination and confirmation. Stop scanning when the target is found, and report an unknown outcome if confirmation expires after the write. Verify a slow grid with many pages.

- Share one 45s deadline across grid pagination and confirmation
- Stop scanning grid pages as soon as the target project matches
- Confirm deletion on rendered cards without rescanning all pages
- Return outcome_unknown if confirmation expires after the write
- Document outcome_unknown for flow_projects delete in all guides
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Addressed in commit 9f0c3ae:

  • Single shared deadline (45s): Added PROJECTS_OP_BUDGET (Duration::from_secs(45)) in src/project.rs and propagated the remaining timeout_ms into createProjectsGridContext (ts/projects_grid.ts) so home-page navigation, sentinel pagination, and delete confirmation share one deadline well below the 60s client timeout and 120s CDP timeout.
  • Stop scanning when target is found & no post-confirm rescan: Separated rendered-card extraction (collectRenderedCards) from sentinel pagination (scanGridCards(stopWhen)). "delete" (and exact-title "open" lookups) now stop scrolling .load-more-sentinel as soon as the target card appears, and delete_project / projectsOp({ action: "delete" }) confirm removal directly against rendered DOM cards without pre-delete or post-confirm full-grid scans.
  • Pre-write vs. post-write deadline expiry (outcome_unknown): If the deadline expires before clicking Delete project, projectsOp dismisses any open dialog and returns project_scan_timeout. Once finalConfirm.click() runs, if the shared deadline expires before removal settles (or if CDP fails mid-call), projectsOp and delete_project report outcome_unknown (stage: "confirm_project_delete", with project_id and title).
  • Slow multi-page grid verification: Verified in headless Chrome against 30–50 page slow grids (1.0s–2.1s/page, with and without <mat-spinner>), confirming page-6 early stop with zero post-confirm sentinel requests, deadline-bounded truncated: true listing, pre-write project_scan_timeout, and post-write outcome_unknown when Flow finishes deleting after the deadline.

@byteland-app

Copy link
Copy Markdown
Contributor

Changes requested.

  1. src/project.rs (ensure_project_workspace_root) now uses is_project_subroute_url(url, false). This treats the valid /project/<id>/collection/<cid> page as a sub-route and navigates away. Only upload.rs passes true. The callers generation.rs, scenes.rs, voices.rs and characters.rs have no exception. Keep the collection route for these callers, or show that none of them needs it.
  2. ts/projects_grid.ts (scanGridCards): the loop stops when settledAttempts >= 2 while truncated is still false and the sentinel can still exist. On a slow network open_project reports "No project matches" instead of a timeout.
  3. clean_project_title removes a flow or google flow prefix or suffix when verified=false. A title such as "Flow - Notes" becomes "Notes".
  4. src/characters.rs: in_character changed from "/character/" to "/character" and now also matches /characters.
  5. src/project.rs and src/characters.rs are already above 800 total lines in the base. Confirm the code line count with cargo xtask check. The deadline and timeout_ms code is copied in open_project and delete_project. Move it to one helper.
  6. The Jk title field overlaps with fix(flow): mutate project titles in store and read query caches #49, and project.rs overlaps with fix(flow): parse prefixed routes with denylists and refine login #48 and fix(flow): mutate project titles in store and read query caches #49. Rebase after fix(flow): parse prefixed routes with denylists and refine login #48 and fix(flow): mutate project titles in store and read query caches #49 are decided.

- Keep /collection/<cid> routes on workspace callers except rename
- Wait for active grid sentinels until completion or deadline expiry
- Strip at most one Google Flow wrapper on fallback document titles
- Match /character route segments without matching /characters
- Move home grid deadline setup into open_signed_in_home_page
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Addressed in 7ff97b4:

  1. Preserve /project/<id>/collection/<cid> across workspace callers (src/project.rs, src/upload.rs, src/characters.rs, ts/project_nav.ts, ts/character_ops.ts): Split ensure_project_route(engine, allow_collection) so ensure_project_workspace_root(engine) passes allow_collection = true (projectNav("exit_subroute")), keeping /project/<id>/collection/<cid> intact across upload.rs, generation.rs, scenes.rs, voices.rs, and characters.rs (and returning /project/<id>/collection/<cid>/character to /project/<id>/collection/<cid>), while rename_project calls ensure_project_route(engine, false) (projectNav("exit_to_root")) to return /collection/<cid> to /project/<id>.
  2. Slow-network sentinel pagination and timeout reporting (ts/projects_grid.ts): Removed the settledAttempts >= 2 and tick < 80 breakouts in scanGridCards so active .load-more-sentinel grids keep retrying until new cards render, hasNextPage is false, stopWhen matches, MAX_GRID_PAGES is reached, or deadline expires, setting truncated: true whenever stopping with an active sentinel so open_project reports a timeout instead of "No Google Flow project matches". Also updated probeInfiniteGridQuery to aggregate both owned and shared infinite queries (Id + xs) and preserved single-word .project-title-text titles ("Edit", "Share", etc.).
  3. Fallback title normalization (src/project_route.rs, ts/read_store_snapshot.ts, src/project.rs, src/assets.rs): Updated clean_project_title and readStoreSnapshot to strip at most one outer "Google Flow - " or "- Google Flow" wrapper on unverified fallback document.title values without stripping bare "Flow" prefixes/suffixes (so "Flow - Notes" stays "Flow - Notes", and "Google Flow - Flow - Notes" becomes "Flow - Notes"), and avoided double-stripping snap["projectTitle"].
  4. Character route matching (src/project_route.rs, src/characters.rs): Added segment-exact is_character_route_url(url) matching /project/<id>/character, /project/<id>/character/<cid>, and /project/<id>/collection/<cid>/character without matching /characters.
  5. Code-line ceiling and shared home-grid deadline helper (src/project.rs): Confirmed cargo xtask check passes the 800 non-comment, non-blank code-line ceiling (src/project.rs: 756/800 code lines, src/characters.rs: 780/800 code lines, ts/projects_grid.ts: 716/800 code lines), and consolidated PROJECTS_OP_BUDGET deadline creation and timeout_ms calculation into open_signed_in_home_page(engine) -> Result<u64> shared by list_projects, open_project, and delete_project.
  6. Overlap with fix(flow): parse prefixed routes with denylists and refine login #48 and fix(flow): mutate project titles in store and read query caches #49: Checked fix(flow): parse prefixed routes with denylists and refine login #48 and fix(flow): mutate project titles in store and read query caches #49 (both currently open with main unchanged at 34de8f5, mergeable_state: "clean" on fix(flow): enforce root routes and scroll grid sentinels #45); ready to rebase once fix(flow): parse prefixed routes with denylists and refine login #48 and fix(flow): mutate project titles in store and read query caches #49 land.

@byteland-app

Copy link
Copy Markdown
Contributor

I reviewed this pull request on top of current main (build 20261129.06_p0 is now supported). The merge is clean, and the 20261129.06 build entry survives. The changes for project titles from the store, collection routes, grid pagination limits, and outcome_unknown after a delete are useful. I did not merge it, because of these defects:

  1. readProjectTitleState (ts/project_store.ts) hard-codes the query scopes ["PROJECT_DETAILS", "PROJECT"]. Nothing shows they exist on 20261129.06_p0 (the description verifies only 20261120.00). If they are absent, a rename is written, but confirm_project_title fails after 6 s (src/project.rs:~735-757). Put the scope names in ProjectStoreFormat, fill them for each build, and return outcome_unknown when only the confirmation fails.
  2. ts/read_store_snapshot.ts:204-208 removes the route_changed guard, and projectStoreStatus overwrites routePath. A store bound on one subroute can then read as current on another.
  3. src/project.rs:832 labels every call_flow_async error as outcome_unknown, including errors before the click.
  4. Title cleaning exists twice (ts/read_store_snapshot.ts and clean_project_title in src/project_route.rs). Keep one and pass projectTitleVerified through.
  5. The diff contains many unrelated style rewrites (26 files). Please drop or split them.
  6. The overlap with fix(flow): parse prefixed routes with denylists and refine login #48 and fix(flow): mutate project titles in store and read query caches #49 is not resolved. fix(flow): mutate project titles in store and read query caches #49 is now closed.

Please rebase on main and verify the title path on 20261129.06_p0.

…nation-jm0-808d7af3-e66f-45d4-80c8-1fcd24d36dbb
…nation-jm0-808d7af3-e66f-45d4-80c8-1fcd24d36dbb
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