Skip to content

fix(flow): resolve Angular views, NG0950 inputs, and store loading - #29

Open
google-labs-stitch[bot] wants to merge 10 commits into
mainfrom
stitch/detect-store-and-lcontext-by-shape-jm0-8f51e20b-27c2-4250-b59e-f5fc55ac89b8
Open

google-labs-stitch[bot] wants to merge 10 commits into
mainfrom
stitch/detect-store-and-lcontext-by-shape-jm0-8f51e20b-27c2-4250-b59e-f5fc55ac89b8

Conversation

@google-labs-stitch

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

Copy link
Copy Markdown
Contributor

Summary

This pull request aligns the branch baseline with main (96eacfb, v2.4.0+) and separates the changes into three file-disjoint commits verified on boq_labs-ai-sandbox-frontend_20261129.06_p0:

  1. Part (a) — d53c6c6 (fix(flow): resolve Angular views and slot IDs in UI helpers):
    • Adds readLViewSlotId and { lViewId } fallback lookup in ts/angular.ts, guards !(raw instanceof Node) in resolveLView, and updates bindAngularViews, ts/character_voices.ts, ts/open_edit_asset.ts, and ts/projects_ops.ts to read upgraded Angular LContext wrappers ({ lq: lView } on 20261129.06_p0) and numeric ngLViewMap slot IDs while keeping the 25-item array scan limit in extractIdFromObject.
  2. Part (b) — c5fcc64 (fix(flow): catch NG0950 when project page inputs are unset):
    • Catches NG0950 when <flow-project-page> (_.Kv) reads an unset required project input (Kv.oa()) in ts/project_upload.ts (isCurrentPage) and ts/agent_chat.ts (liveBinding).
  3. Part (c) — 7edc43d (fix(flow): report store_loading while project store loads):
    • Shares one STORE_HOST_SELECTORS list between ts/project_store.ts and ts/discover_store.ts.
    • Reports store_loading during cold /project/<id> route loads before lazy route bundles settle (router.url check in isProjectRouteLoading without banner tag heuristics) or while a live ProjectStore (_.LQ) waits for its route project signal (undefined or NG0950).
    • Keeps isPending / state.status === "pending" in isProjectStorePending so idle, paused, and fetching pending tile queries all report store_loading.
    • Checks only slot and format.componentSlots in inspectProjectStoreInView, keeps projectStoreStatus O(1) without LView scans, and keeps dom_probed = false in ProjectStoreSession::open when an early discoverStore probe returns store_loading.

Flow Front End Build Label

  • boq_labs-ai-sandbox-frontend_20261129.06_p0 (./target/debug/flow-mcp --headless doctor --json reports flow-build: ok).

Steps That Show the Issues on main (96eacfb)

On boq_labs-ai-sandbox-frontend_20261129.06_p0, Angular Ivy upgrades inspected host contexts to { lq: lView } (Jga), <flow-project-page> (_.Kv) defines required input this.oa = _.kj.required() (which throws NG0950 before input binding), and ProjectStore (_.LQ) loads from lazy route module wO1vlb with this.oa = this.va.oa (undefined until NavigationEnd updates route parameters):

  1. Part (a): On main, when a host carries { lq: lView }, bindAngularViews returns false, characterVoiceOp({ action: "list_voices" }) misses <flow-character-form>, openEditAsset misses <flow-grid-tile-container>, and projectsOp({ action: "list" }) returns id: null on <flow-project-card>.
  2. Part (b): On main, calling projectUpload, agentBound, or agentBusy while <flow-project-page> (Kv.oa()) has no bound required input throws an uncaught NG0950 error.
  3. Part (c): On main, calling bindProjectStore or discoverStore before wO1vlb loads LQ or while LQ.oa() is undefined (or throws NG0950) returns collection_store_not_bound instead of store_loading.

Verification

  • cargo fmt --all -- --check
  • cargo xtask check
  • cargo clippy --locked --workspace --all-targets -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --locked --workspace --no-deps --document-private-items
  • RUSTFLAGS="-D warnings" cargo build --locked --workspace
  • ./target/debug/flow-mcp --headless doctor --json against live boq_labs-ai-sandbox-frontend_20261129.06_p0
  • Headless Chrome CDP verification of each split part against main (96eacfb) on boq_labs-ai-sandbox-frontend_20261129.06_p0:

Part (a) verification on 20261129.06_p0

Part (b) verification on 20261129.06_p0

Part (c) verification on 20261129.06_p0

- Check store format hints and boolean Va or Wa flags for disposal
- Share isStoreDestroyed in snapshot reads and character operations
- Check tileQuery hints and pending PROJECT_TILES queries on load
- Prefer async TanStack mutators such as ld before queue polling
- Subscribe to Da and oa error streams without wedging the queue
- Scan component properties and flow-scene-builder for active stores
- Unwrap LContext objects through lView, zp, Pn, or LView slots

Copy link
Copy Markdown
Contributor

Please base the next change on main and send the read-only Angular view and project loading checks as a separate change. Include the Flow build label and the steps that show the issue on main. Keep the verified store format and leave the active mutation queue unchanged. Please open a separate proposal with a reproducible case if the queue still stops after these fixes.

- Unwrap upgraded LContext views in resolveLView and bindAngularViews
- Read character form, grid tile, and project card LViews safely
- Find verified ProjectStore instances on own component fields
- Catch NG0950 errors before required project page inputs bind
- Report and retry store_loading while project routes load
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Thank you for the review, @byteland-app. I updated this branch onto main (v2.2.1, 34de8f5) and narrowed the pull request to only the read-only Angular view checks and project loading checks:

  • Kept ts/frontend_builds.ts (ProjectStoreFormat) and the active mutation queue in ts/project_store.ts unchanged (ts/store_shape.ts and all queue changes are removed).
  • Added the Flow front end build label (boq_labs-ai-sandbox-frontend_20261120.00_p0) and the exact reproduction steps on main to the pull request description.
  • Verified all repository checks, flow-mcp --headless doctor --json, and the Headless Chrome reproduction cases against main.

@google-labs-stitch google-labs-stitch Bot changed the title fix(flow): detect store state and LContext by object shape fix(flow): check Angular views and project loading states Nov 24, 2026
- Probe Map instances when projectStoreStatus reports unbound loading
- Check sub-route and landing hosts in isProjectRouteLoading
- Read lViewId from upgraded LContext wrappers during map capture

@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.

I ran cargo xtask ci and reproduced a cold-load failure on this commit. When flow-project-shell exists and the verified GO store's project signal throws NG0950, bindProjectStore returns collection_store_not_bound. The same store binds once its input is ready. ProjectStoreSession::open stops retrying on the unbound result after one discovery pass. Report store_loading for a verified store with an unset project input, and retry without binding stores from other projects. Verify the case with the shell already mounted.

- Report store_loading when a live verified store throws NG0950
- Keep exact project ID checks so other project stores do not bind
- Bind ngLViewMap from mounted route hosts in bindProjectStore
- Retry ProjectStoreSession::open when discovery sees store_loading
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Addressed in 079db7b:

  • ts/project_store.ts: readStoreProjectId and inspectProjectStoreInView distinguish a live verified GO store with a matching projectId (state: "ready"), a live verified GO store whose project signal throws NG0950 (state: "loading"), and destroyed or mismatched stores (state: "ready" with another project ID or state: "invalid"). isCurrent still requires project.state === "ready" && project.projectId === projectId, so stores from other projects never bind. When <flow-project-shell> is already mounted and a live verified store throws NG0950, bindProjectStore binds ngLViewMap from the mounted route host and both bindProjectStore and projectStoreStatus return store_loading.
  • ts/discover_store.ts: scanDomStore, captureStoreDuring, and discoverStore track inputPending via inspectProjectStoreInView and return { bound: false, newlyDiscovered: false, error: "store_loading" } without binding stores from other projects.
  • src/project_store.rs & src/project.rs: ProjectStoreSession::open and ensure_flow_store check discovery.get("error") for "store_loading" (and NG0950), reset dom_probed, and keep polling until the store input and signalQuery settle, then bind the same store once its projectId input is ready.
  • Verification: Verified with <flow-project-shell> already mounted in Headless Chrome CDP and end-to-end through the compiled flow-mcp binary (flow_collections list -> ProjectStoreSession::open) across NG0950 -> pending -> settled transitions and with a second live GO store from another project present in ngLViewMap.

@byteland-app

Copy link
Copy Markdown
Contributor

Changes requested.

  1. ts/project_store.ts (isProjectRouteLoading): it returns true for any page that has app-root or aisandbox-root and no host element from the list. Then projectStoreStatus reports store_loading instead of collection_store_not_bound, and ensure_flow_store in src/project.rs skips discoverStore. A project page with only an unlisted host element ends with a misleading "still loading" error.
  2. src/project_store.rs: dom_probed is reset on each loading branch. The probe, which hovers and scrolls, can run many times in 30 rounds.
  3. ts/angular.ts (unwrapContextView): it uses minified field names (zp, Pn) and scans all own properties with a loose isLViewArray check. This can match a wrong array.
  4. ts/project_store.ts (isProjectStorePending): status === "pending" stays true for a disabled query, so the store never becomes ready.
  5. findProjectStoreInView is now a dead wrapper. The lViewId read is copied in ts/character_voices.ts and ts/projects_ops.ts. Move it to one shared function in ts/angular.ts (AGENTS.md: no duplicated helpers).
  6. The commit chore: sync branch with main has no scope. Squash it or remove it.

This PR changes the same files as #41, #45, #46, #48, #49 and #51. Rebase after the order of those PRs is decided.

- Limit route loading checks to empty roots and inactive outlets.
- Run the DOM store probe at most once per project store session.
- Read context views only from lView, build fields, or lViewId.
- Check active query fetches so disabled queries do not block.
- Share LView slot ID lookup and remove findProjectStoreInView.
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Addressed in b74582f:

  1. ts/project_store.ts (isProjectRouteLoading): Replaced the blanket Boolean(document.querySelector("aisandbox-root, app-root")) check so isProjectRouteLoading() only returns true while the document is incomplete, an explicit loading view (flow-loading-page, .projects-loading-container) is shown, <aisandbox-root>/<app-root> has 0 child elements, or its primary <router-outlet:not([name])> has no nextElementSibling and no non-banner custom element is mounted. A settled project page with only an unlisted host element now reports collection_store_not_bound, allowing ensure_flow_store and ProjectStoreSession::open to run discoverStore.
  2. src/project_store.rs (dom_probed): Removed dom_probed = false; from the store_loading / NG0950 retry branch so discoverStore runs at most once in ProjectStoreSession::open.
  3. ts/angular.ts (unwrapContextView): Removed the hardcoded zp and Pn fields, deleted isLViewArray, and removed the Object.getOwnPropertyNames scan. unwrapContextView now reads only "lView", frontendBuild(readBuildLabel())?.projectStore.lContextView, or lViewId in runtimeState.ngLViewMap.
  4. ts/project_store.ts (isProjectStorePending): Replaced the bare isPending and status === "pending" checks with NG0950, isLoading (boolean), and status === "pending" && fetchStatus === "fetching" (on signalQuery and projectQuery(store)?.state), so disabled queries (status === "pending", fetchStatus === "idle", isLoading === false) do not block readiness.
  5. Dead findProjectStoreInView and shared lViewId helper: Deleted findProjectStoreInView from ts/project_store.ts and added exported readLViewSlotId in ts/angular.ts, used across bindAngularViews (ts/angular.ts), characterVoiceOp (ts/character_voices.ts), and projectsOp (ts/projects_ops.ts).
  6. 48553f6 (chore: sync branch with main) & rebase timing: Left the branch un-rebased per your note on #45, #46, #48, #49, and #51. Force-push is disabled in this automated sandbox (git_push allows fast-forward pushes only), so 48553f6 could not be rewritten in place here and can be dropped/squashed when rebasing after the PR order is decided.

@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. I did not merge it. All verification in the description is for build 20261120.00_p0, and main already handles LContext wrappers through resolveLView and the per-build lContextView.

Defects:

  1. ts/project_store.ts:206-226 (isProjectStorePending): a pending query that is not fetching yet (idle or paused) now counts as ready. readProjectStore and isReady then run on a store with no data.
  2. isProjectRouteLoading (ts/project_store.ts:528-549) is a heuristic with a hard-coded list of banner tags. A settled page with an unlisted host can still end with the store-loading error and not collection_store_not_bound.
  3. src/project_store.rs:38-45 sets dom_probed on the first probe, even when the result is store_loading. Discovery never runs again after the page finishes loading.
  4. PROJECT_ROUTE_HOST_SELECTOR copies STORE_HOST_SELECTORS in ts/discover_store.ts. Share one list.
  5. inspectProjectStoreInView now reads every object slot in every LView, not only format.componentSlots. It runs on each status poll. The scan limit in extractIdFromObject rose from 25 to 80 for all arrays.
  6. The unscoped commit chore: sync branch with main is still in the history.

Please split the change: (a) the resolveLView and readLViewSlotId fix for character_voices, open_edit_asset, and projects_ops; (b) the NG0950 try/catch; (c) the cold-load store_loading state. Rebase on current main and verify each part on 20261129.06_p0.

- Add readLViewSlotId and check lViewId in resolveLView
- Read character form views with resolveLView and readLViewSlotId
- Read grid tile views with resolveLView in openEditAsset
- Read project card views with resolveLView and readLViewSlotId
- Catch unset project signal errors in projectUpload page checks
- Catch unset project signal errors in liveBinding for Agent chat
- Share STORE_HOST_SELECTORS between store bind and DOM discovery
- Keep idle and paused pending tile queries marked as pending
- Check router URL and loading nodes instead of banner tag lists
- Retry DOM discovery when an early probe hits store_loading
@google-labs-stitch

Copy link
Copy Markdown
Contributor Author

Addressed all six review items on current main (96eacfb, verified against boq_labs-ai-sandbox-frontend_20261129.06_p0):

  1. Pending idle and paused tile queries (ts/project_store.ts): isProjectStorePending keeps the isPending and projectQuery(store)?.state.status === "pending" checks (wrapped with NG0950 try/catch and lazy signalQuery priming in projectQuery) instead of filtering by fetchStatus === "fetching". Pending queries in idle, paused, or fetching state all report store_loading, so readProjectStore and isReady do not run before initial query data settles.
  2. No banner-tag heuristic in isProjectRouteLoading (ts/project_store.ts): Removed SHELL_BANNER_SELECTOR. isProjectRouteLoading(projectId) now checks only document.readyState !== "complete", explicit loading nodes (flow-loading-page, .projects-loading-container), an unbootstrapped empty root (aisandbox-root, app-root with childElementCount === 0 and no __ngContext__), and Angular Router.url (projectRoutePath(routerUrl) !== targetPath). Once the router settles on /project/<id> or an unlisted subroute (even when banners are present), isProjectRouteLoading returns false, so bindProjectStore returns collection_store_not_bound.
  3. Retry discoverStore after cold store_loading (src/project_store.rs): ProjectStoreSession::open checks discovery.get("error") before setting dom_probed = true. When discoverStore returns store_loading or NG0950, dom_probed remains false and open retries after the route settles.
  4. Single shared host selector list (ts/project_store.ts, ts/discover_store.ts): Exported STORE_HOST_SELECTORS once from ts/project_store.ts and imported it in ts/discover_store.ts.
  5. Bounded LView and array scans (ts/project_store.ts, ts/projects_ops.ts): inspectProjectStoreInView reads only slot and format.componentSlots (no Object.keys(slot) scan), projectStoreStatus stays O(1) without scanning ngLViewMap on status polls, and extractIdFromObject in ts/projects_ops.ts keeps Math.min(obj.length, 25).
  6. Branch baseline and three-part split (d53c6c6, c5fcc64, 7edc43d): The sandbox GitHub proxy blocks force-pushes and restricts git_push to this PR's branch name (HTTP 403 on new branch names), so historical commit 48553f6 cannot be rewritten from this environment. To give a clean baseline on main (96eacfb) and separate the three changes cleanly, 69aed12 resets the branch tree to exact origin/main (git diff origin/main 69aed12 is empty) and the top three file-disjoint commits isolate each part so each commit builds, passes checks, and can be cherry-picked directly onto main (or squash-merged together):
    • (a) d53c6c6 — fix(flow): resolve Angular views and slot IDs in UI helpers (ts/angular.ts, ts/character_voices.ts, ts/open_edit_asset.ts, ts/projects_ops.ts)
    • (b) c5fcc64 — fix(flow): catch NG0950 when project page inputs are unset (ts/agent_chat.ts, ts/project_upload.ts)
    • (c) 7edc43d — fix(flow): report store_loading while project store loads (src/project.rs, src/project_store.rs, ts/discover_store.ts, ts/project_store.rs)

Each part was verified individually and together against boq_labs-ai-sandbox-frontend_20261129.06_p0 (flow-mcp --headless doctor --json and Headless Chrome CDP checks; see the updated PR description for reproduction and results).

@google-labs-stitch google-labs-stitch Bot changed the title fix(flow): check Angular views and project loading states fix(flow): resolve Angular views, NG0950 inputs, and store loading Dec 1, 2026
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