fix(mobile): scope the project picker to the Home scope and say just "Cloud" under Cloud

Merged
SA
3mo ago
+80-98

Summary

  • The new-session project picker lists only the projects for the place picked at the top of Home — the selected machine, or Cloud — instead of every online machine plus a Cloud section.
  • Under Cloud scope the composer chip just says "Cloud" and doesn't open a picker: a sandbox has no real project structure yet.
  • The last row of the project/agent/branch pickers no longer sits under the home indicator.

Why / Context

#6651 fanned project.list across every online host and appended a cloud target per API project, and the picker rendered all of it in sections. Home already has a scope filter that picks Cloud or a machine, so the picker was choosing the place twice. Its Cloud section was also the retired v2_projects catalog — nothing writes that table since #6436 (docs/cloud-sandbox-considerations.md › Model tracks it as Open), so presenting it as a project structure was noise.

Separately, the picker's scroll content had 8px of bottom padding, so the last row sat under the home indicator and was only visible by over-scrolling.

How It Works

  • useNewChatTargets reads useWorkspaceScope + useSelectedHost. Host scope → that machine's project.list only, and only while it's online (an offline pick offers nothing rather than quietly moving you to another host or Cloud — same stance as the scope filter). Cloud scope → the API's cloud projects only. The composer, branch query and create path all hang off this hook, so switching scope at the top of Home re-targets the composer without re-picking.
  • ProjectPickerScreen is a flat list; the Cloud/host section headers are gone.
  • NewChatWidget: under Cloud the project chip is a plain "Cloud" label and inert. The row the create resolves against is still picked the way defaultTarget always did (last used, else first alphabetically) — the request is unchanged, the id just isn't surfaced. The "· Cloud" chip suffix is gone under host scope since the scope filter already says where you are.
  • The three pickers pad their scroll content by insets.bottom + 8.

Manual QA Checklist

Run on an iPhone 17 (iOS 26) sim against production with a live host:

  • App boots and lists real workspaces under both the machine scope and Cloud scope
  • Host scope: composer project chip opens a flat list of that machine's projects, no Cloud section
  • Cloud scope: composer header reads "Cloud · ", tapping "Cloud" does nothing, branch chip still lists remote branches
  • Flip scope at the top of Home → composer re-targets without re-picking
  • Project picker: last row fully visible without over-scrolling
  • Agent and branch pickers unchanged apart from bottom padding

Testing

  • bun run test in apps/mobile: 47 pass
  • bunx biome check on the changed files: clean
  • bunx turbo typecheck --filter=@superset/mobile: no errors in the changed files (18 pre-existing errors in packages/workspace-fs, unrelated)

Known Limitations

  • Cloud create still depends on a legacy v2_projects row. With several rows in an org, which repo the sandbox clones is an invisible last-used-or-first choice from the phone. Internal-only, and it goes away when the environment entity replaces the row — the UI here won't need to change.
  • Host scope with the selected machine offline offers no projects, by design.

Summary by cubic

Scopes the new-session project picker to the place already picked at the top of Home, so it no longer lists every online machine's projects plus a Cloud section. Under Cloud scope the composer chip reads just "Cloud" and opens nothing, since a sandbox has no project structure yet. Also pads the picker scroll content by the bottom safe-area inset so the last row no longer sits under the home indicator.

  • Project targets now come only from the selected machine (host scope) or the API's cloud projects (Cloud scope); an offline selected machine offers no projects.
  • Cloud create still resolves against a legacy v2_projects row, unchanged, but the id is no longer surfaced in the UI.
  • Agent and branch pickers changed only for the bottom padding fix.

Summary by CodeRabbit

  • New Features

    • New chat targets now reflect the selected Home scope, showing only relevant host or cloud projects.
    • Cloud targets are clearly identified with a non-interactive Cloud chip.
    • Project selection now displays all available targets in a single, streamlined list.
  • Bug Fixes

    • Improved picker layouts on devices with home indicators and display cutouts by applying safe-area spacing.
    • Cloud chips no longer trigger navigation or haptic feedback when pressed.