← Back to Pull requests

Feat(RHAI-59554):Added project switch modal changes #10870

Closed
unknown closed this pull request without merging on Dec 02, 2026 11:53 UTC
View on GitHub
unknown unknown commented on Nov 26, 2026 03:26 UTC
Author

Closes RHAI-59554

Problem

Changing the dashboard working project while a feature has unsaved state can discard the user's progress without giving the feature an opportunity to reset its state, reload project-scoped data, or navigate to the new project.

The shared project selector also needs to support feature-owned confirmation behavior without assuming how the project change should be completed. The feature must control the reset, project selection, and navigation sequence.

The selector also had issues with project creation and invalid project routes. Users needed a reliable recovery path when the current route referenced an unavailable project or when no projects were available.

Solution

Extend the shared working-project context and selector contract to support optional feature-owned project-change confirmation handlers.

The shared working-project flow now supports:

  • Optional feature-owned confirmation handlers while preserving immediate project changes when no handler is registered.

  • Atomic pending-request state and safe handler registration/cleanup, including protection against stale handler cleanup removing a newer handler.

  • Synchronous and asynchronous confirmation callbacks with loading, error, retry, and successful completion states.

  • Safe Cancel and modal-close behavior, including preventing the selector from reopening while confirmation is in progress.

  • Invalid-route, empty-project, valid-project recovery, and project-creation flows without leaving stale project state.
  • The selector UI also fixes the Create project action so that it:

  • Is available from the selector footer during the invalid project scenario

  • Works when no projects are available.

  • Returns to the expected selector state after project creation or cancellation.
  • The shared API leaves the actual project transition to the feature-specific callback. onConfirm is responsible for completing the project change, including any feature reset, project selection, and navigation required by that feature.

    No API, persistence, RBAC, or data migration changes are included.

    Evidence

    Focused unit tests were run with:

    pnpm --filter @odh-dashboard/ui-core test-unit -- \
      WorkingProjectSelector.spec.tsx \
      WorkingProjectContext.spec.tsx \
      --runInBand
    

    1. When we have an invalid project in Url and no project

    _Before_

    <img width="2546" height="1759" alt="image" src="https://github.com/user-attachments/assets/20f08676-ab35-4b55-b2c8-4f4e827b79aa" />

    _After_

    <img width="2536" height="1764" alt="image" src="https://github.com/user-attachments/assets/a6990e90-06f4-4925-aa0c-0b0bf435051f" />

    2. When we have invalid project in url and the create project button was not visible.

    _Before_

    <img width="2544" height="1764" alt="image" src="https://github.com/user-attachments/assets/ca403efc-7f14-4dbe-9686-4755704a3d01" />

    _After_

    <img width="2552" height="1756" alt="image" src="https://github.com/user-attachments/assets/68875bfe-6a21-41b8-a351-a9402f3ee824" />

    3. Switch modal example of how it would in a component model serving implementation scenario

    https://github.com/user-attachments/assets/6081ab72-0e02-4920-97e5-72da2520ca17

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Project changes can now require confirmation, with a description and error details shown before the change is applied. Confirmation can be retried after an error, and the selector cannot be dismissed while confirmation is in progress.
    * The Create project action is available on invalid routes. When no projects exist, the selector displays the empty state, including on an invalid route.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 485 lines (+363 / -122) across 6 files Reviewer: lucferbux Review duration: 9147m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.47) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 485 lines diff across 6 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.370
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #10870"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.3% (MEDIUM) · Higher = larger blast radius
    47.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%