Skip to content

[Endpoints] [7/x] Add rest store implementation#19008

Merged
BenWilson2 merged 1 commit intomlflow:masterfrom
BenWilson2:stack/endpoints/rest-2
Dec 8, 2025
Merged

[Endpoints] [7/x] Add rest store implementation#19008
BenWilson2 merged 1 commit intomlflow:masterfrom
BenWilson2:stack/endpoints/rest-2

Conversation

@BenWilson2
Copy link
Member

@BenWilson2 BenWilson2 commented Nov 24, 2025

🥞 Stacked PR

Use this link to review incremental changes.


Related Issues/PRs

#xxx

What changes are proposed in this pull request?

Adds the rest store implementation and e2e backend tests

How is this PR tested?

  • Existing unit/integration tests
  • New unit/integration tests
  • Manual tests

Does this PR require documentation update?

  • No. You can skip the rest of this section.
  • Yes. I've updated:
    • Examples
    • API references
    • Instructions

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/tracking: Tracking Service, tracking client APIs, autologging
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflows
  • area/gateway: MLflow AI Gateway client APIs, server, and third-party integrations
  • area/prompts: MLflow prompt engineering features, prompt templates, and prompt management
  • area/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionality
  • area/projects: MLproject format, project running backends
  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages

How should the PR be classified in the release notes? Choose one:

  • rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section
  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

Should this PR be included in the next patch release?

Yes should be selected for bug fixes, documentation updates, and other small changes. No should be selected for new features and larger changes. If you're unsure about the release classification of this PR, leave this unchecked to let the maintainers decide.

What is a minor/patch release?
  • Minor release: a release that increments the second part of the version number (e.g., 1.2.0 -> 1.3.0).
    Bug fixes, doc updates and new features usually go into minor releases.
  • Patch release: a release that increments the third part of the version number (e.g., 1.2.0 -> 1.2.1).
    Bug fixes and doc updates usually go into patch releases.
  • Yes (this PR will be cherry-picked and included in the next patch release)
  • No (this PR will be included in the next minor release)

@BenWilson2 BenWilson2 changed the title rest store implementation [Endpoints] [7/x] Add rest store implementation Nov 24, 2025
@BenWilson2 BenWilson2 marked this pull request as ready for review November 24, 2025 22:01
@BenWilson2 BenWilson2 force-pushed the stack/endpoints/rest-2 branch from da8167e to e6b9861 Compare November 24, 2025 22:19
@github-actions github-actions bot added area/tracking Tracking service, tracking client APIs, autologging rn/feature Mention under Features in Changelogs. labels Nov 24, 2025
@BenWilson2 BenWilson2 force-pushed the stack/endpoints/rest-2 branch 2 times, most recently from eee09fd to 0a0523d Compare November 26, 2025 03:40
@BenWilson2 BenWilson2 force-pushed the stack/endpoints/rest-2 branch from 0a0523d to 8738ac2 Compare November 27, 2025 06:31
@BenWilson2 BenWilson2 force-pushed the stack/endpoints/rest-2 branch 2 times, most recently from f57e5af to 4fc4111 Compare December 2, 2025 02:14
@BenWilson2 BenWilson2 force-pushed the stack/endpoints/rest-2 branch 2 times, most recently from d3c8fb5 to e736d1c Compare December 2, 2025 22:49
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

Documentation preview for 03c364d is available at:

More info
  • Ignore this comment if this PR does not change the documentation.
  • The preview is updated when a new commit is pushed to this PR.
  • This comment was created by this workflow run.
  • The documentation was built by this workflow run.

@BenWilson2 BenWilson2 force-pushed the stack/endpoints/rest-2 branch 3 times, most recently from 7e7a193 to 6915f33 Compare December 4, 2025 00:27
@BenWilson2 BenWilson2 force-pushed the stack/endpoints/rest-2 branch 3 times, most recently from da5f51d to 68f01c4 Compare December 5, 2025 04:29


class RestStore(AbstractStore):
class RestStore(RestGatewayStoreMixin, AbstractStore):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since AbstractStore inherits GatewayStoreMixin, RestGatewayStoreMixin needs to be passed first, correct? Depending on the order of parent classes seems risky, can we add a comment for the future reminder?

from mlflow.utils.proto_json_utils import message_to_json


class RestGatewayStoreMixin:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we implement get_resource_endpoint_configs as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, we can't create any REST endpoints for that API (that would allow any user to get any decrypted key). In order to make sure that we don't ever accidentally add that as a feature, I removed this API from the standard store mixins and put it in store/tracking/gateway with some NB notes and guidance about how dangerous use of this API outside of the tracking server is.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Understood, where did you make the change to remove get_resource_endpoint_configs from the general store mixin?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah it was for the feedback in sql-store that @B-Step62 mentioned... it's the right call to separate this out for future dev security.

# Endpoint Bindings APIs
CreateGatewayEndpointBinding: _create_endpoint_binding,
DeleteGatewayEndpointBinding: _delete_endpoint_binding,
ListGatewayEndpointBindings: _list_endpoint_bindings,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shall we add proto for get_resource_endpoint_configs?

Copy link
Member Author

Choose a reason for hiding this comment

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

^ same answer as preceding question

@BenWilson2 BenWilson2 force-pushed the stack/endpoints/rest-2 branch 10 times, most recently from dc518e8 to 77da1a1 Compare December 7, 2025 01:57
proto.resource_type = (
self.resource_type.value
if isinstance(self.resource_type, GatewayResourceType)
else self.resource_type
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need else branch? We only expect GatewayResourceType in this field.

Copy link
Collaborator

@TomeHirata TomeHirata left a comment

Choose a reason for hiding this comment

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

LGTM

CreateGatewaySecret(),
schema={
"secret_name": [_assert_required, _assert_string],
"secret_value": [_assert_required, _assert_string],
Copy link
Collaborator

Choose a reason for hiding this comment

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

These assertion logic seems to print the value directly in the error message. Even if it does not, these are pretty generic utils so we can accidentally add display logic. Should we have a special validation logic to avoid the risk of such leakage?

Also worth checking the other general logic like message_to_json does not expose unencrypted values to the rest error or the server logs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch - we need a separate validation handler that is only used for the APIs interfacing with plaintext API Keys to guard against any potential future log leakage. Updated

UpdateGatewaySecret(),
schema={
"secret_id": [_assert_required, _assert_string],
"secret_value": [_assert_required, _assert_string],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is secret value required? Shall we allow users to update auth config only?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea - this definitely makes the 4 providers that have complex configs a bit more flexible. We can handle single-key missing value entries guarded in the UI (do not allow editing a key that only has API KEY to set an empty string).

self,
endpoint_id: str,
model_definition_id: str,
weight: int = 1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be float?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep - missed updating that!

Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
@BenWilson2 BenWilson2 force-pushed the stack/endpoints/rest-2 branch from 77da1a1 to 03c364d Compare December 8, 2025 19:34
@BenWilson2 BenWilson2 added this pull request to the merge queue Dec 8, 2025
Merged via the queue into mlflow:master with commit 5afc02e Dec 8, 2025
68 of 71 checks passed
@BenWilson2 BenWilson2 deleted the stack/endpoints/rest-2 branch December 8, 2025 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tracking Tracking service, tracking client APIs, autologging rn/feature Mention under Features in Changelogs. team-review Trigger a team review request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants