Skip to content

Let CUJ 2, 7 and 9 accept multi-target provider services - #1910

Open
asteele-db wants to merge 4 commits into
mainfrom
alexander-steele/cuj-multi-target-providers
Open

asteele-db wants to merge 4 commits into
mainfrom
alexander-steele/cuj-multi-target-providers

Conversation

@asteele-db

@asteele-db asteele-db commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • CUJ 2 _assert_mps_catalog: requires the fixture model to be among each provider service's targets (not the only target), checks the native APIs per target, and compares the LIST FULL targets against the fetched targets.
  • CUJ 2 Claude routing case: the first-prompt inference must be served by the model in the routes:select response, not the fixture default. The plain Claude and Codex inference cases still assert the admin default model.
  • CUJ 7 saved-provider routing: each selection must be an offered option for the launched harness, and every selected model must serve a successful inference for the delegated task. The parent's requests are no longer pinned to one model.
  • CUJ 9: both provider services only need to contain their deep-link target. The Copilot registry check expects ug_e2e.providers.openai.* to list every live OpenAI target, read from the provider service.
  • tests/e2e_cuj/README.md now describes which CUJs accept extra targets.

Validation

  • uv run pytest tests/test_e2e_cuj_helpers.py: 223 passed. The catalog unit test now runs with one and two targets per service.
  • Collect-only of CUJ 2, 7 and 9: 29 tests collected.
  • ruff check and ruff format --check pass on the changed files.
  • Live CUJs run only in CI. The fixtures currently have one target each, so the multi-target path is not exercised live until a second target is added.

This pull request and its description were written by Isaac.

asteele-db and others added 2 commits November 25, 2026 18:50
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@asteele-db

Copy link
Copy Markdown
Collaborator Author

/integration-test

@asteele-db

Copy link
Copy Markdown
Collaborator Author

/ug-review

Comment on lines +404 to +405
selections = response.payload["route_selection"]
assert len(selections) == 1, selections

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test · low
can we also assert the selection is one of route.payload["route_options"] (and harness is claude), like cuj7 does? now any model the router returns passes, so we lose the old target check.

Suggestion:

Suggested change
selections = response.payload["route_selection"]
assert len(selections) == 1, selections
selections = response.payload["route_selection"]
assert len(selections) == 1, selections
assert selections[0]["route_option"] in route.payload["route_options"], selections

assert_served(recorder, served, served.payload["model"])
served_models.add(served.payload["model"])
# The parent may run on another provider target; each routed child must run on its pick.
assert selected_models <= served_models, (selected_models, served_models)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test · medium
can we tie each child request to its route selection? served_models includes parent requests that mention the filename, so a child served on the wrong model still passes if the parent uses the picked model. Also, assert_served(..., served.payload["model"]) makes its model check always pass.

@github-actions

Copy link
Copy Markdown
Contributor

UG review recommendation

RECOMMENDATION: APPROVE

Reasons:

  • The cuj7 finding (medium) says the test assertions are weak. The served_models matching can include parent requests, and assert_served(..., served.payload["model"]) compares the model to itself, so it always passes. This lowers how much the test proves, but it is a test-quality gap, not a produc
  • The cuj2 finding (low) asks to also check that the selected model is in route_options and that the harness is claude. This restores a lost target check and is an optional hardening.
  • Neither finding reports data loss, leakage, broken workflows, configuration problems, or a reproducible bug in shipped code. Both only touch e2e test strictness.

Findings considered: 2 (severities: low: 1, medium: 1); see the inline review comments.

Advisory only: this recommendation never approves or merges the pull request. The ready-to-approve label tracks it.

@github-actions github-actions Bot added the ready-to-approve Ready for maintainer approval label Nov 25, 2026
Co-authored-by: Isaac <no-reply@databricks.com>
@asteele-db

Copy link
Copy Markdown
Collaborator Author

/integration-test

@github-actions

Copy link
Copy Markdown
Contributor

Polly AI Review

Blocking issues

  • tests/e2e_cuj/test_cuj7_model_discovery.py:500: can we match each pick to child inference? when Claude omits its child model, parent traffic on selected A plus a wrong-model child B passes this subset check.

Security vulnerabilities

None found in the changed code.

Non-blocking notes

  • tests/e2e_cuj/README.md:170: can we qualify CUJ2's multi-target claim or update its Desktop expectation? a second discovered Claude target conflicts with the singleton assertion at tests/e2e_cuj/test_cuj2_mps_mcp.py:267.
  • tests/test_e2e_cuj_helpers.py:1013: can we add an invalid-second-target case? both targets currently share their APIs, so validating only the first target would pass this matrix.

Approach

Membership and per-target validation fit the outcome. For child correlation, promote the relevant CUJ4 task-matching logic into shared evidence utilities rather than adding another live journey.

Summary

Diff size (computed): 5 files; +41 / -25 lines (66 changed text lines); 0 binary files.

Category Files Added Deleted Share of changed text lines
Tests and test support 5 41 25 100.0%
Documentation 0 0 0 0.0%
Dependencies and lockfiles 0 0 0 0.0%
Implementation / other 0 0 0 0.0%

Shares use additions + deletions, including generated text and lockfiles. Binary files have no line count. Tests include fixtures/helpers under test paths and colocated test/spec files; categories are path-based, not coverage measurements.

Changes

The change relaxes provider-target assumptions in CUJ2, CUJ7, and CUJ9, updates routing evidence, extends the catalog unit matrix, and documents fixture restrictions. No production code, dependencies, or generated assets change.

The size is proportional to the outcome. Parameterizing the existing catalog test avoids duplicate setup; no concrete size reduction is warranted.

Tests

Test-by-test assessment
Test / case Behavior protected Layer Needed? Action / rationale
tests/e2e_cuj/README.md — provider fixture requirements Documents extra-target support and CUJ9’s OpenAI singleton restriction Documentation keep Relevant operational guidance; qualify CUJ2 support until its Desktop expectation handles additional discovered Claude models.
tests/e2e_cuj/test_cuj2_mps_mcp.py::_assert_mps_catalog Fixture-model membership, native APIs on every target, and LIST FULL/GET target agreement Live fixture validator keep Validates the actual published catalog for configuration and plain inference journeys. Isolated validation logic also has unit coverage below.
tests/e2e_cuj/test_cuj2_mps_mcp.py::TestCuj2ClaudeSmartRouting::test_cuj_claude_mps_smart_routing_header First-prompt inference uses the router-selected model Live TUI/API keep Correlates routing response with successful inference, provider headers, and the expected prompt. The native routing boundary warrants live coverage.
tests/e2e_cuj/test_cuj7_model_discovery.py::TestUnmanagedModelDiscovery::test_ug_claude_saved_provider_smart_routing Saved-provider launch, delegation, and completed Claude tasks Live TUI/API keep Exercises a distinct native harness boundary; repair the shared child-model assertion rather than adding another journey.
tests/e2e_cuj/test_cuj7_model_discovery.py::TestUnmanagedModelDiscovery::test_ug_codex_saved_provider_smart_routing Saved-provider launch, delegation, and completed Codex tasks Live TUI/API keep Covers the separate Codex boundary. Existing native rollout evidence additionally checks child-model identity.
tests/e2e_cuj/test_cuj7_model_discovery.py::_assert_saved_provider_routing Offered-option membership, selected harness, provider headers, and successful inference Shared E2E assertion uncertain HTTP success checks remain meaningful, but pooled served-model sets allow parent traffic to substitute for selected-child evidence. Fix the correlation identified above.
tests/e2e_cuj/test_cuj9_model_sources.py::source_contract Anthropic target membership while preserving Copilot’s singleton OpenAI inventory Live fixture validator keep The provider-specific distinction matches the existing source matrices; no new journey or fixture setup is introduced.
tests/test_e2e_cuj_helpers.py::test_cuj2_mps_catalog_requires_fixture_apis — target_count=1/2, existing API cases Accepts valid API lists and rejects missing or unsupported APIs with one or two targets Unit keep Extends an existing matrix at the smallest reliable layer. Add an asymmetric invalid-second-target case to prove every target is checked.

Existing plain Claude and Codex inference cases still verify the admin defaults. CUJ7’s Claude native audit permits unknown child-model identity, so it does not close the blocking correlation gap. Synthetic recorder cases can protect that gap without another live journey. Independent LIST FULL/GET mismatch and missing-fixture-target rejection are not established by the changed unit matrix.

The PR reports 223 helper tests passing, 29 CUJ cases collected, and successful Ruff checks; these were not independently rerun. Static patch applicability and Python parsing were checked. Live multi-target discovery and inference remain unverified. Request-header checks do not establish downstream usage attribution.

To verify the revision, run uv run pytest tests/test_e2e_cuj_helpers.py. On an authorized CUJ runner, exercise different parent/child models and reject selected-A/parent-A/child-B evidence; also check CUJ2 configuration with a second discovered Claude target.

Scope

All changes support accepting multi-target provider services; no unrelated changes were found. The documented OpenAI singleton restriction is intentional. CUJ2’s remaining Desktop singleton expectation limits the broader support claim, as noted above.


Automated review by Polly · workflow run

@github-actions

Copy link
Copy Markdown
Contributor

Co-authored-by: Isaac <no-reply@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-approve Ready for maintainer approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants