Skip to content

feat: branch deployment previews via @branch path segments#9011

Draft
ericpgreen2 wants to merge 9 commits intomainfrom
ericgreen/branch-selector-ui
Draft

feat: branch deployment previews via @branch path segments#9011
ericpgreen2 wants to merge 9 commits intomainfrom
ericgreen/branch-selector-ui

Conversation

@ericpgreen2
Copy link
Copy Markdown
Contributor

@ericpgreen2 ericpgreen2 commented Mar 10, 2026

Adds the ability for project admins to preview branch deployments in Rill Cloud. Branches are addressed via @branch path segments in the URL (e.g., /acme/analytics/@eric~revenue-metrics/explore/dashboard).

Also adds a Deployments management page under Project Status.

Closes APP-776

Depends on #9140

User-facing changes:

  • A branch selector pill in the header breadcrumbs lets admins switch between deployments, showing each branch's status (polls at 2s when dropdown is open)
  • Navigating between pages within a project automatically preserves the active branch
  • Stopped branch deployments show a "Start deployment" button with optimistic UI updates
  • New "Deployments" tab on the status page with start/stop/delete actions, slot usage, and author info
  • Branch-specific "Starting branch deployment..." message when a branch deployment is booting

Implementation:

  • A SvelteKit reroute hook strips @branch before route matching, so existing routes work transparently
  • Branch names containing / are encoded as ~ (which git disallows), making them safe for URL paths
  • createSmartRefetchInterval scopes ListResources polling to relevant resource types, preventing perpetual polling when ProjectParser stays RUNNING on branch deployments
  • Shared deployment-utils.ts with invalidateDeployments() and isActiveDeployment() used by both BranchDeploymentStopped and DeploymentsSection

Test coverage:

  • 44 unit tests for branch-utils.ts
  • Comprehensive suite for refetch-interval-store.ts

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

Developed in collaboration with Claude Code

@ericpgreen2 ericpgreen2 self-assigned this Mar 10, 2026
@ericpgreen2 ericpgreen2 changed the title feat: branch deployment selector with @branch path segments feat: branch deployment previews via @branch path segments Mar 11, 2026
@ericpgreen2 ericpgreen2 mentioned this pull request Mar 13, 2026
8 tasks
@ericpgreen2 ericpgreen2 force-pushed the ericgreen/branch-selector-ui branch from 6543e45 to cb6a7cf Compare March 26, 2026 13:57
… utilities

- Migrate `+layout.svelte` from Svelte 4 to Svelte 5 runes (`$derived`, `$effect`, `$props`)
- Extract `baseGetProjectQueryOptions` polling config to `project-query-options.ts`
- Extract `resolveRuntimeConnection` to `project-runtime.ts` with unit tests
- Remove duplicate mock query chain from `ProjectHeader` (layout already passes mock-aware permissions)
- Add section comments and component-level doc block to layout
- Delete `invalidations.ts` (dead code, zero consumers)
- Delete `ResourceError.svelte` (dead code, shadowed by `web-common` version)
- Move `constants.ts` to `user-management/constants.ts` (closer to its only consumer)
@ericpgreen2 ericpgreen2 force-pushed the ericgreen/branch-selector-ui branch from 724c618 to d13e3bf Compare March 30, 2026 12:12
@ericpgreen2 ericpgreen2 changed the base branch from main to ericgreen/project-layout-refactor March 30, 2026 12:12
@ericpgreen2 ericpgreen2 force-pushed the ericgreen/branch-selector-ui branch from d13e3bf to 8eddf35 Compare March 30, 2026 12:14
Replace three positional mock params (userId, credentials, permissions)
with a single `mockUser` object. The caller constructs it or passes
undefined, so the "all or nothing" relationship is enforced by the type
system rather than a runtime check.
Remove `pageData`, `pathname`, and `projectError` — pure aliases that
add indirection without simplifying anything. Use `page.data`,
`page.url.pathname`, and `$projectQuery.error` directly.
Branch deployment UI:
- Add BranchSelector component in project header breadcrumbs
- Extract branch from URL's @Branch path segment via `extractBranchFromPath`
- Inject active branch into intra-project navigations via `handleBranchNavigation`
- Pass branch param to GetProject and GetDeploymentCredentials queries
- Add BranchDeploymentStopped component for stopped/stopping states
- Keep BranchSelector's ListDeployments query in sync on status transitions
- Poll during STOPPING status

Deployments page:
- Add Deployments management page under Status tab
- Add `createSmartRefetchInterval` for filtered resource polling
- Add branch deployment hint to Deployments page
- Extract shared deployment utilities to `deployment-utils.ts`
@ericpgreen2 ericpgreen2 force-pushed the ericgreen/branch-selector-ui branch from 2b26c7a to 081ddb4 Compare March 30, 2026 12:44
When the user selects a branch in the dropdown, seed the GetProject
query cache with the deployment data already available from
ListDeployments. This lets the layout's RuntimeProvider re-key
immediately instead of waiting for the network round-trip.
Base automatically changed from ericgreen/project-layout-refactor to main March 31, 2026 07:02
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