Skip to content

Add Deploy tab: cross-workspace Genie Space deployment with catalog remapping#78

Open
louiscsq wants to merge 13 commits intomainfrom
feature/deployops-ui
Open

Add Deploy tab: cross-workspace Genie Space deployment with catalog remapping#78
louiscsq wants to merge 13 commits intomainfrom
feature/deployops-ui

Conversation

@louiscsq
Copy link
Copy Markdown
Collaborator

@louiscsq louiscsq commented Apr 18, 2026

Summary

  • Deploy tab — new top-level tab (Score → Optimize → History → Deploy) for deploying Genie Space configs to target workspaces
  • Catalog remapping — remap table identifiers during deploy (e.g. dev_bank.retail.*prod_bank.retail.*)
  • Create or update — creates a new Genie Space in the target workspace when no target space ID is provided; PATCHes an existing space when an ID is given
  • Remembered config — target workspace URL, space ID, and catalog mappings are persisted in localStorage across sessions
  • deploy.sh fix — fallback when user_api_scopes not supported on workspace (was silently dropping all resources including sql-warehouse and postgres)
  • Prerequisites UI — documents SP registration, catalog access, and UC grant requirements on the Deploy tab

Architecture

User clicks Deploy → POST /api/auto-optimize/spaces/{id}/deploy
  → Fetch source space config (Genie API)
  → Remap catalog references (in-memory)
  → Connect to target workspace (SP credentials)
  → CREATE new space or PATCH existing space (target Genie API)
  → Return space URL

The app's SP must be registered in the target workspace. No UC model or optimization run required — works with any Genie Space.

Test plan

  • Deploy tab renders with 4 tabs (Score, Optimize, History, Deploy)
  • Config fields pre-fill from localStorage on revisit
  • Deploy with target space ID → PATCHes existing space
  • Deploy without target space ID → creates new space
  • Catalog remapping transforms identifiers correctly
  • Error messages display properly (auth failures, permission errors)
  • TypeScript compiles with zero errors
  • Full E2E: deploy from dev workspace to prod workspace with catalog remapping

This pull request was AI-assisted by Isaac.

louiscsq added 13 commits April 17, 2026 10:26
Frontend:
- Add collapsible Deployment section to OptimizationConfig with target
  workspace URL, target space ID, and catalog mapping (source→target)
- Extend GSOTriggerRequest with deploy_space_id and catalog_map fields

Backend:
- Extend TriggerRequest with deploy_space_id and catalog_map
- Forward new params through trigger → job_launcher → job parameters

GSO:
- Add catalog_map widget to run_cross_env_deploy notebook
- Remap table/metric_view identifiers before applying to target workspace
  (e.g. dev_catalog.schema.table → prod_catalog.schema.table)
- Forward deploy_space_id and catalog_map through trigger and job_launcher

Co-authored-by: Isaac
- RunDetailView: add deployment status banner showing target workspace,
  status (PENDING_APPROVAL/DEPLOYED/FAILED), and link to target workspace
  Color-coded: green=deployed, blue=pending, red=failed

- Backend: expose deployTarget at top-level run response (was only in
  step detail before)

- Types: add deployTarget to GSOPipelineRun interface

Co-authored-by: Isaac
The PATCH API rejects user_api_scopes on workspaces without the token
passthrough feature, causing ALL resources (including sql-warehouse and
postgres) to not be attached. The error was hidden by 2>/dev/null.

Fix: try PATCH with scopes first; if it fails, retry with resources
only. This ensures the warehouse and Lakebase resources are always
attached regardless of workspace feature flags.

Co-authored-by: Isaac
Move deployment config from OptimizationConfig (auto-deploy during
pipeline) to RunDetailView (on-demand after optimization completes).

Frontend:
- Revert OptimizationConfig to original (no deployment section)
- Add "Deploy to Workspace" collapsible panel in RunDetailView for
  completed runs (CONVERGED/STALLED/MAX_ITERATIONS/APPLIED)
- Pre-fill config from localStorage, save on successful deploy
- Show deployment status banner for runs that have been deployed

Backend:
- Add POST /api/auto-optimize/runs/{run_id}/deploy endpoint
- Validates run is terminal, has UC model, then triggers deployment job
- Uses existing ensure_deployment_job() from GSO job_launcher

API:
- Add deployOptimizationRun() in api.ts

Co-authored-by: Isaac
New DeployTab component:
- Top-level tab in SpaceDetail alongside Score, Optimize, History
- Deployment config: target workspace URL, space ID, catalog mappings
- Config remembered via localStorage across sessions
- Shows completed optimization runs as selectable cards
- Deploy button triggers cross-env deployment job
- Success/error feedback with link to target workspace

RunDetailView cleaned up:
- Removed deploy dialog (moved to DeployTab)
- Kept deployment status banner for already-deployed runs

Co-authored-by: Isaac
Backend:
- Replace POST /runs/{run_id}/deploy with POST /spaces/{space_id}/deploy
- Fetches current space config via Genie API (get_serialized_space)
- Applies catalog remapping in-memory
- PATCHes directly to target workspace via patch_space_config
- No UC model, no optimization run, no deployment job required

Frontend:
- Simplify DeployTab: remove run selection (not needed)
- Just enter target config and click Deploy
- deploySpace() API replaces deployOptimizationRun()

Co-authored-by: Isaac
The app SP isn't registered in the target workspace. Use the user's
OBO token instead — the user is authenticated in both workspaces.

Co-authored-by: Isaac
Use the app's SP credentials (client_id + client_secret) to
authenticate to the target workspace. The SP must be registered
in the target workspace — this is a one-time admin setup.

Co-authored-by: Isaac
When target space ID is not provided, create a new Genie Space in
the target workspace using POST /api/2.0/genie/spaces with:
- Title from the source space
- First available SQL warehouse in target workspace
- Parent path /Shared/
- Remapped serialized config

When target space ID is provided, PATCH the existing space as before.

Also return spaceUrl in the response so the frontend can link
directly to the newly created Genie Space.

Co-authored-by: Isaac
Document permission requirements: SP registration, Genie Space
permissions, target catalog existence, and table access grants.

Co-authored-by: Isaac
Catalogs are accessed via shared metastore or target metastore
configuration, not 'exist in the target workspace'. List the
specific UC grants needed (USE_CATALOG, USE_SCHEMA, SELECT).

Co-authored-by: Isaac
@louiscsq louiscsq requested a review from hiydavid April 18, 2026 08:39
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