test(model-registry): add upstream-aware BFF contract gate #10256
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
Real PR Conversation Timeline
1 comments
"Review active on #10256"
general
weight: 0.35
lucferbux
https://redhat.atlassian.net/browse/RHOAIENG-101356
Related Core BFF story: https://redhat.atlassian.net/browse/RHOAIENG-100663
Cross-package schema authorization: https://redhat.atlassian.net/browse/RHOAIENG-101357
Reviewer note: expected CI result
OpenAPI compatibility vs PR base / checkis expected to fail in this PR.This PR intentionally corrects the Model Catalog BFF OpenAPI schema. The old base schema describes responses as raw entities/lists, while the actual BFF returns them inside a required
dataenvelope. Moving fields such asitems,size,pageSize,nextPageToken, andnameunderdatais reported as 24 breaking OpenAPI findings.The same gate reports 8 additional findings because Model Catalog read paths document
namespaceas required and non-empty. The BFF runtime already rejects missing or empty values throughAttachNamespace, so this is a second intentional baseline correction rather than a runtime regression.The gate also reports 54 additional findings because the shared
Errorschema now matches the BFF's actual{"error":{"code","message"}}response envelope instead of documenting a flat{"code","message"}object. The current expected total is 86 findings.The gate runs in
enforcemode so the baseline transition is visible. Once this PR merges, the corrected schema becomes the newmainbaseline and future incompatible changes fail normally.BFF contract vs upstream mainpreviously exposed a real upstream mismatch: Model Registry's BFF returned Model Catalog payloads insidedata, but its OpenAPI response schemas omitted that envelope. Upstream fixed this in kubeflow/hub#3351, merged as09fc03499c281cfd05ed625aeb83b2152b71b9d6.The new missing-
namespaceerror test exposed a second live upstream mismatch: the BFF returns anerrorenvelope, but upstreammainstill documents a flatErrorobject. The current run therefore fails 1/9 until kubeflow/hub#3360 merges. That upstream PR changes only the OpenAPIErrorschema to match the runtime and generated BFF swagger definition.Post-merge evidence is available in #10262:
The simulation is refreshed against the latest PR head before merge. Its base contains that head while its head adds only a workflow comment. It should remain red only for the upstream error-envelope mismatch until #3360 merges; then it can be rerun to prove the post-merge dashboard baseline is green. #10262 is evidence only and should not be merged.
Problem
The Model Registry BFF contract suite only covered the registry list endpoint, did not enable the Model Catalog mock client, and described Model Catalog responses without the BFF's
dataenvelope. Automated upstream-sync PRs also did not run BFF contract tests, so upstream schema drift was not exercised through the dashboard consumer path.Two additional gaps were exposed by review:
namespaceparameter even though Model Catalog read routes reject missing or empty values at runtime.Errorschema did not match the BFF's actual error envelope, and the suite had no Model Catalog error-response test.Solution
namespace400 response.dataenvelope.namespacequery parameter on all Model Catalog read paths with a catalog-specific parameter markedrequired: trueandminLength: 1; other endpoints retain the existing optional parameter.dataenvelope and key consumed fields, independent of the upstream OpenAPI schema.size,pageSize, andnextPageToken).Errorschema to document the BFF's requirederrorenvelope.Contract / Model Registryworkflow with two jobs:-
OpenAPI compatibility vs PR base-
BFF contract vs upstream mainkubeflow/model-registry@mainto an exact SHA and run the dashboard BFF tests against that upstream SHA.red-hat-data-services/api-contract-testsrepository.- Nullable handling follows OpenAPI 3.0.3:
nullablewidens only an explicitly definedtype; constraints such asenumretain their behavior, and$refsiblings are ignored.- Missing references now fail both positive and negated assertions, with regression coverage for both cases.
- The EvalHub and Gen AI OpenAPI response corrections are authorized by RHOAIENG-101357.
$refsibling, test populated, empty, and missing-namespaceerror responses, and assert the populated response contains a non-null distribution object.UserModel.userIdfield.6a3603a16; nullable and LSD status coverage added inb5410e675,1fb4eaa6d, and504702157; user mock alignment added in5668e258e.Protected File Rationale
The
.github/workflows/changes add the Model Registry contract gates and run BFF contract tests during automated upstream-sync PRs.The
.claude/rules/contract-tests.mdchange updates the contract-test examples so media-type JSON Pointer segments correctly escape/as~1, for exampleapplication~1json. The stricter schema-reference validation made the previous unescaped examples invalid. This is a documentation correction for the shared contract-test rule, not a governance-policy change.Check Map
| Check | Question it answers | Result in this PR |
|---|---|---|
|
Test / Contract-Tests| Do the dashboard's broad mocked contract suites pass? | Pass ||
Model Registry BFF Tests| Does the dashboard's synced Model Registry BFF pass its dedicated tests? | Pass ||
Contract / Model Registry / OpenAPI compatibility vs PR base| Does this PR break the documented BFF OpenAPI contract relative to its base? | Fail intentionally ||
Contract / Model Registry / BFF contract vs upstream main| Do the dashboard consumer tests pass against the latest upstreammainBFF and OpenAPI document? | Fail intentionally until #3360 merges* |The first two checks are existing dashboard workflows. The last two are jobs in the new consolidated
Contract / Model Registryworkflow.Central Contract Tests Onboarding
This PR onboards the Dashboard Model Registry BFF to the shared red-hat-data-services/api-contract-tests repository.
The OpenAPI job calls the reusable workflow:
red-hat-data-services/api-contract-tests/.github/workflows/provider-openapi-check.yml@bf7aa8c4767cfb1cfe883110f8f4d2d6a6a76bdfThat central workflow:
1. Checks out this dashboard PR as the provider repository.
2. Reads
packages/model-registry/.rhoai/contracts.yaml.3. Selects contract
model-registry-bff-model-catalog-v1.4. Compares the PR's OpenAPI contract surface against the PR base SHA.
5. Installs the pinned
oasdiffandyqversions declared by the contract.6. Runs a static OpenAPI compatibility check in
enforcemode.7. Fails the check when breaking findings are present and uploads the report.
The 86 findings come from the intentional success-envelope, required-
namespace, and error-envelope corrections described above. They are not an upstreammainfailure and not a mocked BFF test failure.Direct Upstream Main Gate
The
BFF contract vs upstream mainjob implements the latest-mainpolicy:1. Resolve
kubeflow/model-registry@mainonce to a full 40-character SHA.2. Record that SHA in the job summary.
3. Check out Model Registry at the exact SHA.
4. Run the dashboard contract tests against the upstream
clients/ui/bff.5. Load the upstream
clients/ui/api/openapi/mod-arch.yamlthroughCONTRACT_OPENAPI_PATH.6. Fail the dashboard PR if the consumer tests no longer pass against the latest upstream
main.The resolved SHA makes every run reproducible and makes upstream drift attributable while still following the latest-
mainpolicy.The upstream gate runs the nine Model Registry and Model Catalog consumer tests. The three Serving Runtime Catalog tests remain part of the dashboard's broad contract suite because those endpoints are dashboard-specific and are not exposed by the upstream Model Registry BFF.
The tests also include Dashboard-owned assertions for the
dataenvelope and consumed fields. This matters because the upstream BFF and upstream OpenAPI document come from the same resolved SHA: without independent assertions, an upstream change could alter both the implementation and schema together without preserving the Dashboard's consumer expectations.Fullsend Review Follow-up
Addressed the remaining Fullsend findings in
5d91855f301734d1ae23e341b98fa306aaee61d6:namespaceparameter withrequired: trueandminLength: 1, while other endpoints retain the existing optional parameter.dataenvelope and key fields independently of the upstream OpenAPI schema.size,pageSize, andnextPageToken.namespacetest validates the documented 400 response and the actualerrorenvelope./as~1in JSON Pointer media-type segments.Validation:
pnpm --filter @odh-dashboard/model-registry test:contract: 14/14 passing.mainrun at09fc03499c281cfd05ed625aeb83b2152b71b9d6: 8/9 passing; the sole failure is the known upstreamErrorschema mismatch fixed by #3360.pnpm --filter @odh-dashboard/model-registry lintandtype-check: passing.BFF contract vs upstream mainis expected to fail 1/9 until #3360 merges.OpenAPI compatibility vs PR basestill fails intentionally with 86 findings during this baseline transition.Retroactive Bug Coverage
I reviewed the Jira search for
RHOAIENGbugs labelledcypress_found_bug. Of 223 results, 11 explicitly mention Model Registry. They fall into UI/test-selector issues, browser/runtime errors, controller finalizer or RBAC behavior, and deployment/route problems. None are OpenAPI response-schema drift, so this PR should not claim that these gates would have caught those historical bugs.The gates did, however, catch a live Model Catalog contract mismatch during development: upstream BFF responses used a required
dataenvelope while the upstream OpenAPI schema omitted it. That produced failing consumer tests until kubeflow/hub#3351 corrected the upstream schema. This is the intended class of failure: implementation/OpenAPI drift that reaches the Dashboard consumer.One related known drift, RHOAIENG-100553, concerns Serving Runtime Catalog field names (
llmInferenceServiceConfigandminimumRHOAIVersion). This initial contract intentionally scopes static compatibility and BFF tests to/api/v1/model_catalog; it would not catch that Serving Runtime Catalog drift yet. A follow-up should onboard/api/v1/serving_runtime_catalogand add consumer assertions for those fields.Testing
pnpm --filter @odh-dashboard/model-registry test:contract— 14/14 tests passing.pnpm --filter @odh-dashboard/gen-ai test:contract— 29/29 tests passing.kubeflow/model-registry@09fc03499c281cfd05ed625aeb83b2152b71b9d6— 8/9 tests passing; the sole failure is the known upstreamErrorschema mismatch fixed by #3360.d7c53f2da7649d4663d4a5f0e8f6cc7e59d87644— 9/9 tests passing.pnpm --filter @odh-dashboard/model-registry lint— passing.pnpm --filter @odh-dashboard/model-registry type-check— passing.pnpm run test:contract— 11/11 tasks passing.OpenAPI compatibility vs PR base— expected intentional baseline-transition failure with 86 findings.maindoes not currently produce committed CRDs; itscontroller/manifeststarget generated no CRD files. Generic CRD support is available centrally in api-contract-tests PR #2.Merge Order
1. The central api-contract-tests PR #2 is merged.
2. Merge kubeflow/hub#3360, which corrects the upstream error envelope.
3. Merge this PR, which pins the central reusable workflow by SHA.
4. The corrected schema becomes the new
mainbaseline; #10262 provides the green post-merge simulation.[RHOAIENG-100553]: https://redhat.atlassian.net/browse/RHOAIENG-100553?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJpIjoiZ2l0aHViLWNvbS1KU1cifQ%
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
New Features
Added compatibility checks for Model Registry catalog APIs and upstream OpenAPI updates.
Added contract coverage for Model Registry catalog responses, including validation of successful and invalid requests.
Bug Fixes
Improved contract validation for nullable schemas and invalid or unresolved schema references.
Updated evaluation job responses to return a list of jobs and no longer require benchmark details.
Updated Gen AI user responses to include user details in a
dataenvelope.Documentation
Added guidance on Model Registry contract compatibility and running its checks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
[RHOAIENG-101357]: https://redhat.atlassian.net/browse/RHOAIENG-101357?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ