← Back to Pull requests

RHOAIENG-96075: Add modular host contracts for namespace, authorization, capability discovery, and gateway access #10029

Closed
unknown closed this pull request without merging on Oct 01, 2026 13:10 UTC
View on GitHub
unknown unknown commented on Sep 30, 2026 21:10 UTC
Author

<!--- If this is a non-code change, this template is not required; reference any issues or top-level descriptions as needed -->
<!--- All code change PRs should relate to an issue, reference it here; see example below -->
<!--- https://issues.redhat.com/browse/RHOAIENG-123456 -->
https://redhat.atlassian.net/browse/RHOAIENG-96075

## Description

Add modular host contracts for namespace resolution, authorization, resource capability discovery, and gateway access. Migrate llmd-serving to these contracts so it no longer relies on legacy namespace, SSAR, or generic proxy utilities for these operations.

The implementation follows [package-topology.md](/docs/package-topology.md): distribution hosts compose services, plugin-core owns package-neutral contracts, k8s-core provides stateless Kubernetes utilities, and model-serving owns gateway domain behavior. llmd-serving depends on the serving hub and core packages, not the
sibling KServe package.

Key changes:

| Area | Changes |
|------|---------|
| Host contracts | Wire namespace, strict access-review, and discovery services into RHOAI and RHAII. Keep the operator namespace separate from deployment projects. |
| Authorization | Add fail-closed access-review states and operation-specific permissions for llmd configuration routes and actions. Preserve unrelated legacy access-check behavior. |
| Capability discovery | Activate llmd functionality only when the required API is available and the caller has list/watch access in a supported scope. Handle loading, missing, forbidden, and error states without leaving routes indefinitely loading. |
| llmd integration | Remove the KServe package dependency and use hub-only activation. Gate create, duplicate, edit, toggle, and delete operations with their exact resource permissions. |
| Gateway access | Add an optional hub-owned gateway service. Constrain both backend implementations to the fixed GET operation with a validated namespace, preserve caller identity and gateway metadata, and support request cancellation. |
| Documentation | Update package and backend documentation with ownership boundaries, activation requirements, gateway behavior, and the permission inventory. |

## How Has This Been Tested?

Validation completed after rebasing:

- pnpm install --frozen-lockfile — passed.
- Scoped type checking — all 16 tasks passed.
- Scoped source lint and Cypress lint — passed with existing warnings only.
- Scoped unit tests across affected workspaces and dependencies — 6,102 tests passed.
- Core BFF API and proxy tests — go test ./internal/api ./internal/proxy passed.
- Core BFF contract tests — 236 tests passed across OpenShift and XKS.
- RHAII production build, RHOAI Cypress host build, and model-serving federated build — passed with existing bundle-size warnings.
- Existing llmd Cypress mock coverage — all 6 specs passed, totaling 97 tests.
- Checked package boundaries and built Module Federation manifests for the required shared contracts.
- git diff --check passed; the rebase preserved the implementation patch.

To rerun the llmd Cypress mock suites, run from packages/cypress against the configured Cypress host:

  pnpm run run:mock --spec '../llmd-serving/cypress/tests/mocked/**/*.cy.ts' --config video=false
  

Manual UI and live-cluster verification have not been performed.

Test Impact

Added or updated unit, backend, and contract coverage for:

- Exact SSAR attributes, limited-access users, denied/error responses, cancellation, and stale-result handling.
- Capability discovery and activation states, project-scoped authorization, and initial route loading.
- Operation-specific llmd permissions, including editing without create permission.
- Both distribution host adapters and shared-context identity.
- Gateway metadata validation, optional-service failures, caller identity forwarding, and rejection of unsupported paths, methods, or query parameters.

Shared Cypress fixtures were updated, and the existing llmd mock suites were rerun. No new Cypress specs were added.

Request review criteria:


<!--- This PR will be merged by any repository approver when it meets all the points in the checklist -->
<!--- Go over all the following points, and put an x in all the boxes that apply. -->

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work

  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).

  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

  • The code follows our [Best Practices](/docs/best-practices.md) (React coding standards, PatternFly usage, performance considerations)
  • If you have UI changes:
    <!--- You can ignore these if you are doing manifest, backend, internal logic, etc changes; aka non-UI / visual changes -->

  • Included any necessary screenshots or gifs if it was a UI change.

  • Included tags to the UX team if it was a UI/UX change.
  • After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    New Features
    Added gateway discovery for a selected namespace and LLM-d sample configuration retrieval for supported topologies.
    LLM-serving features now check whether required resources are available and permissions are granted before becoming available.
    Improvements
    Configuration create, edit, duplicate, delete, and enable/disable controls now reflect your permissions. Unauthorized actions are hidden or disabled.
    Model-serving requests are limited to gateway discovery and supported sample configurations; unsupported paths, methods, and query parameters are rejected.
    * Kubernetes resource discovery and access checks use the caller’s identity. Gateway selectors remain disabled when gateway data cannot be loaded.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: paulovmr Review duration: 959m
    All Vouch review confidence checks passed
    Residual risk 0.32 = Change Risk (0.80) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.80 · 650 lines diff across 8 files
    0.80
    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%
    60%
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.080
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #10029"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    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: 80.2% (HIGH) · Higher = larger blast radius
    80.2%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 31.7% · Safe to merge
    31.7%