Skip to content

Fix 31889: Extract MLflow 3.x model signatures and paginate the registry listing - #32024

Merged
harshsoni2024 merged 5 commits into
mainfrom
fix/mlflow3-mlfeatures
Aug 26, 2026
Merged

harshsoni2024 merged 5 commits into
mainfrom
fix/mlflow3-mlfeatures

Conversation

@harshsoni2024

@harshsoni2024 harshsoni2024 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #31889

I fixed MLflow 3.x model-signature extraction, and two adjacent defects the
investigation surfaced in the same method, because all three made a broken
Unity Catalog ingestion look like a successful one.

  1. mlFeatures was never populated on MLflow 3.x. The connector read the
    mlflow.log-model.history run tag, which MLflow 3.x removed in favour of
    LoggedModel entities. The resulting KeyError was swallowed by a broad
    except, so every model ingested with empty features plus a spurious
    warning.
  2. Only the first page of the registry was ingested. search_registered_models
    returns one bounded page; the connector called it once and dropped the rest
    silently.
  3. An empty registry was indistinguishable from success. Zero models
    produced zero records, no warnings, and Success %: 100.0.

Manual testing

  • the features are successfully ingested on mlflow 3.x versions
image

Type of change:

  • Bug fix

High-level design:

Where the signature lives. No metadata API exposes it. I checked all three
candidates against a real Unity Catalog registry:

endpoint signature?
/api/2.0/mlflow/logged-models/{id} no — params, tags, artifact_uri only
/api/2.0/mlflow/unity-catalog/model-versions/get no
/api/2.1/unity-catalog/models/{name}/versions/{v} no

MLflow 3 keeps it only in the model's MLmodel metadata file, so it has to be
read from the artifact store. Just that one file is fetched — never the weights —
and MLflow's progress bar is suppressed so it stays out of the ingestion logs.

Why not mlflow.models.get_model_info (the approach in #31920): it resolves
models:/ URIs through MLflow's global tracking config, which this connector
never sets — it only passes URIs to the MlflowClient constructor. Against Unity
Catalog it therefore resolves against a local default store and dies with
ModuleNotFoundError: alembic. Forcing the globals gets one step further and then
fails on ModuleNotFoundError: pandas, which mlflow-skinny does not ship and
the mlflow extra does not add. Instead the artifact location is resolved through
the connector's own client (get_logged_model(...).artifact_location for a
models:/ source) and the YAML parsed with json — no global state, no pandas.

mlflow.artifacts.load_text would be tidier but its signature is
load_text(artifact_uri) with no tracking_uri, so it hits the same
global-config problem. download_artifacts(..., tracking_uri=...) is used instead.

Backward compatibility. The MLflow 2.x tag is still tried first and short-
circuits without any artifact call, so 2.x behaviour is unchanged. The artifact
read happens only when the tag is absent or carries no entry for the run.

Cost. One extra round trip per model, only on the fallback path, and only for
models that resolved a version — so system.ai.* foundation models, which have no
run-backed versions, pay nothing.

Tests:

Use cases covered

  • A model logged on MLflow 3.x (no history tag) has its signature ingested into mlFeatures, with string mapped to categorical and numeric types to numerical
  • A model logged on MLflow 2.x still resolves from the run tag, with no artifact call
  • A models:/<model_id> source is resolved through the registry; a direct artifact source is used as-is
  • A history tag with no entry for the run, or malformed JSON, falls back to the artifacts instead of giving up
  • A signature stored as a Python repr rather than JSON is still parsed
  • Tensor signatures (unnamed columns) are skipped rather than failing
  • A registry that cannot be read records a warning and does not abort the model
  • Models spread over several pages are all ingested, and the page token is passed back correctly
  • A backend that never stops returning a page token halts at the page budget
  • An empty registry logs a warning naming registryUri and credentials as the causes
  • yield_mlmodel carries the resolved features onto the CreateMlModelRequest

Unit tests

  • I added unit tests for the new/changed logic.
  • Files updated: ingestion/tests/unit/source/mlmodel/mlflow/test_metadata.py (+22 tests, 34 total)
  • Coverage: 91% on metadata/ingestion/source/mlmodel/mlflow/metadata.py
    (201 statements, 19 missed). Every added or changed line is covered; the
    remainder is pre-existing untested code — create() and the exception
    branches of _get_hyper_params / _get_ml_store — which this PR does not touch.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not added. The existing MLflow integration test runs against an OSS server,
    which cannot reproduce the Unity Catalog path (OSS populates latest_versions
    and its source is a directly-readable artifact URI, so both defects are
    hidden). Verified manually against real Unity Catalog instead — steps below.

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

Against a real Databricks Unity Catalog registry (trackingUri: databricks,
registryUri: databricks-uc) and a local OpenMetadata server, ingesting a
UC-registered model with a 3-column signature:

  1. Registered demo.om_connector_test.sales_forecast via mlflow.pyfunc.log_model
    with signature store_id:string, week_of_year:long, prior_sales:double.
  2. Ran metadata ingest before the fix — the model ingested with mlFeatures: EMPTY
    and 2 warnings (Cannot extract properties from RunData: 'mlflow.log-model.history').
  3. Ran it after the fix — same model, same registry:
    mlFeatures: [(store_id, categorical), (week_of_year, numerical), (prior_sales, numerical)],
    Warnings: 0, Errors: 0, Success 100%. Confirmed via
    GET /api/v1/mlmodels?service=...&fields=mlFeatures and in the UI.
  4. Confirmed pagination on the same registry:
    Listed 88 registered model(s) from the MLflow registry over 2 page(s) — it now
    follows the token instead of stopping at page 1.
  5. Confirmed the empty-registry warning by pointing the connector at an empty
    local MLflow registry (Docker, mlflow 3.14.0), which previously reported
    Success %: 100.0 with no indication.
  6. Verified on both ends of the supported pin range — mlflow-skinny 3.10.1 and
    3.14.0 — with identical results.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: not applicable, no schema changes.
  • For UI changes: not applicable.
  • I have added tests (unit) and listed them above.

Greptile Summary

The PR adds MLflow 3.x signature extraction from MLmodel artifacts, paginates registered-model discovery, and adds conservative deletion checks for incomplete or empty registry listings.

  • Preserves the MLflow 2.x run-tag signature path while adding artifact fallback for MLflow 3.x.
  • Streams registry pages with a bounded page budget and records listing completion.
  • Suppresses deletion after truncated, failed, or empty registry listings.
  • Adds unit coverage for signature parsing, pagination, status reporting, and deletion safeguards.

Confidence Score: 4/5

The PR is not yet safe to merge because a transient per-model processing failure can still cause a valid OpenMetadata model to be soft-deleted.

Registry pagination can complete successfully while version or run processing drops an individual model before it enters mlmodel_source_state, after which deletion reconciliation treats that missing model as stale.

Files Needing Attention: ingestion/src/metadata/ingestion/source/mlmodel/mlflow/metadata.py

Important Files Changed

Filename Overview
ingestion/src/metadata/ingestion/source/mlmodel/mlflow/metadata.py Adds signature artifact fallback and pagination safeguards, but deletion can still run against incomplete source state after per-model processing failures.
ingestion/tests/unit/source/mlmodel/mlflow/test_metadata.py Adds broad unit coverage for the new behavior, but does not cover per-model processing failure followed by deletion reconciliation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Paginate MLflow registry] --> B{Terminal page reached?}
  B -- No --> C[Skip deletion reconciliation]
  B -- Yes --> D[Process each listed model]
  D --> E{Version and run processing succeeds?}
  E -- Yes --> F[Add model FQN to source state]
  E -- No --> G[Model absent from source state]
  F --> H[Run deletion reconciliation]
  G --> H
  H --> I[Unrecorded existing models are soft-deleted]
Loading

Reviews (4): Last reviewed commit: "test(mlflow): cover an empty registry pa..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Context used:

MLflow 3.x dropped the `mlflow.log-model.history` run tag in favour of
LoggedModel entities, so `data.tags["mlflow.log-model.history"]` raised
KeyError on every model. The broad except swallowed it, leaving mlFeatures
empty and emitting a spurious warning per model.

No metadata API exposes the signature -- not the MLflow logged-model
endpoint, nor either Unity Catalog model-version endpoint -- so it can only
be read from the model's own MLmodel file. Fetch just that one file.

`mlflow.models.get_model_info` is deliberately avoided: it resolves
`models:/` URIs through MLflow's global tracking config, which this
connector never sets, and it imports pandas, which mlflow-skinny does not
ship. Both make it fail on Unity Catalog. Resolving the artifact location
through the connector's own client and parsing the YAML with json avoids
each. `mlflow.artifacts.load_text` would be tidier but takes no
tracking_uri, so it hits the same global-config problem.

A missing tag now logs at debug rather than warning, since it is the norm
on 3.x, and a tag with no entry for the run falls through to the artifacts
instead of returning early.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 25, 2026 11:10
@harshsoni2024
harshsoni2024 requested a review from a team as a code owner August 25, 2026 11:10

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Aug 25, 2026
Guard the ML-feature build: a malformed signature escaped yield_mlmodel, and
the topology runner drops the entity without recording a failure, so the model
vanished silently. Also skip deletion reconciliation when the registry listing
was truncated, since models beyond the page budget would be wrongly marked
deleted.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI review requested due to automatic review settings August 25, 2026 11:58

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 9d1610e2a7b9850ad01894c6a18b27f2835e5d08 in Playwright run 32900203336, attempt 1.

✅ 109 passed · ❌ 0 failed · 🟡 1 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 46m 53s

⏱️ Max setup 7m 14s · max shard execution 16m 12s · max shard-job elapsed before upload 23m 16s · reporting 7s

🌐 216.29 requests/attempt · 1.81 app boots/UI scenario · 0.00% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 216.29 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 1.81 per UI scenario (228 boots / 126 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 46 0 0 0 0 0
🟡 Shard ingestion-01 28 0 1 0 0 0
✅ Shard ingestion-02 35 0 0 0 0 0
🟡 1 flaky test(s) (passed on retry)
  • Features/IncidentManager.spec.ts › Complete Incident lifecycle with table owner (shard ingestion-01, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

Copilot AI review requested due to automatic review settings August 25, 2026 12:54

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Track listing completion positively instead of tracking truncation, and reset
it per run, so an abandoned, failed or never-started listing fails closed
rather than licensing soft-deletes. Also skip reconciliation when the registry
listed no models at all -- a wrong `registryUri` or credentials that cannot
list are indistinguishable from an emptied registry, and acting on it deletes
every model under the service.
Copilot AI review requested due to automatic review settings August 25, 2026 21:06

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The reporter's registry answered the first page with a token and no
`registered_models` at all. The old single-call listing read that as an empty
registry and reported a fully successful run over zero models.
Copilot AI review requested due to automatic review settings August 25, 2026 21:17

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@gitar-bot

gitar-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Adds pagination support for MLflow registry listings and model signature extraction for MLflow 3.x, addressing the malformed signature payload finding. No issues found.

✅ 1 resolved
✅ Edge Case: Malformed signature payload can silently drop the whole model

📄 ingestion/src/metadata/ingestion/source/mlmodel/mlflow/metadata.py:332-336 📄 ingestion/src/metadata/ingestion/source/mlmodel/mlflow/metadata.py:437-451
In _get_ml_features, _build_ml_features(columns) (line 336) runs outside any try/except, and the run-tag path (_signature_columns_from_run_tags) returns its parsed columns without validating they are name-bearing dicts. If a signature payload parses to something _build_ml_features can't handle — e.g. a list of non-dict elements (column.get/column["name"] raises AttributeError/KeyError) or a column whose name fails MlFeature pydantic validation — the exception propagates out of yield_mlmodel. The topology runner catches it, logs it, and yields nothing for that model without calling status.failed. The model is dropped entirely (worse than the old behavior, which swallowed the error and ingested the model with empty features) and, ironically, produces exactly the invisible-failure/100%-success symptom this PR set out to fix. Wrap the feature build defensively so a bad signature degrades to no features + a recorded warning rather than a silent drop.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

Copy link
Copy Markdown

harshsoni2024 added a commit that referenced this pull request Aug 25, 2026
* fix(mlflow): read model signatures from the MLmodel file on MLflow 3.x

MLflow 3.x dropped the `mlflow.log-model.history` run tag in favour of
LoggedModel entities, so `data.tags["mlflow.log-model.history"]` raised
KeyError on every model. The broad except swallowed it, leaving mlFeatures
empty and emitting a spurious warning per model.

No metadata API exposes the signature -- not the MLflow logged-model
endpoint, nor either Unity Catalog model-version endpoint -- so it can only
be read from the model's own MLmodel file. Fetch just that one file.

`mlflow.models.get_model_info` is deliberately avoided: it resolves
`models:/` URIs through MLflow's global tracking config, which this
connector never sets, and it imports pandas, which mlflow-skinny does not
ship. Both make it fail on Unity Catalog. Resolving the artifact location
through the connector's own client and parsing the YAML with json avoids
each. `mlflow.artifacts.load_text` would be tidier but takes no
tracking_uri, so it hits the same global-config problem.

A missing tag now logs at debug rather than warning, since it is the norm
on 3.x, and a tag with no entry for the run falls through to the artifacts
instead of returning early.

Co-Authored-By: Claude Opus 5 <[email protected]>
(cherry picked from commit 1ab63cd)

* fix(mlflow): stop a bad signature or partial listing from losing models

Guard the ML-feature build: a malformed signature escaped yield_mlmodel, and
the topology runner drops the entity without recording a failure, so the model
vanished silently. Also skip deletion reconciliation when the registry listing
was truncated, since models beyond the page budget would be wrongly marked
deleted.

Co-Authored-By: Claude Opus 5 <[email protected]>
(cherry picked from commit 8931369)

* fix(mlflow): never reconcile deletions off a listing we cannot trust

Track listing completion positively instead of tracking truncation, and reset
it per run, so an abandoned, failed or never-started listing fails closed
rather than licensing soft-deletes. Also skip reconciliation when the registry
listed no models at all -- a wrong `registryUri` or credentials that cannot
list are indistinguishable from an emptied registry, and acting on it deletes
every model under the service.

Adds the regression test for the reporter's registry shape: an empty first page
that still carries a page token, which the old single-call listing read as
"no models" and reported as a fully successful run.

---------

Co-authored-by: Claude Opus 5 <[email protected]>
@harshsoni2024
harshsoni2024 added this pull request to the merge queue Aug 26, 2026
Merged via the queue into main with commit 9487c78 Aug 26, 2026
109 checks passed
@harshsoni2024
harshsoni2024 deleted the fix/mlflow3-mlfeatures branch August 26, 2026 06:11
harshsoni2024 added a commit that referenced this pull request Aug 27, 2026
…try listing (#32024) (#32093)

* fix(mlflow): read model signatures from the MLmodel file on MLflow 3.x

MLflow 3.x dropped the `mlflow.log-model.history` run tag in favour of
LoggedModel entities, so `data.tags["mlflow.log-model.history"]` raised
KeyError on every model. The broad except swallowed it, leaving mlFeatures
empty and emitting a spurious warning per model.

No metadata API exposes the signature -- not the MLflow logged-model
endpoint, nor either Unity Catalog model-version endpoint -- so it can only
be read from the model's own MLmodel file. Fetch just that one file.

`mlflow.models.get_model_info` is deliberately avoided: it resolves
`models:/` URIs through MLflow's global tracking config, which this
connector never sets, and it imports pandas, which mlflow-skinny does not
ship. Both make it fail on Unity Catalog. Resolving the artifact location
through the connector's own client and parsing the YAML with json avoids
each. `mlflow.artifacts.load_text` would be tidier but takes no
tracking_uri, so it hits the same global-config problem.

A missing tag now logs at debug rather than warning, since it is the norm
on 3.x, and a tag with no entry for the run falls through to the artifacts
instead of returning early.



* fix(mlflow): stop a bad signature or partial listing from losing models

Guard the ML-feature build: a malformed signature escaped yield_mlmodel, and
the topology runner drops the entity without recording a failure, so the model
vanished silently. Also skip deletion reconciliation when the registry listing
was truncated, since models beyond the page budget would be wrongly marked
deleted.



* fix(mlflow): never reconcile deletions off a listing we cannot trust

Track listing completion positively instead of tracking truncation, and reset
it per run, so an abandoned, failed or never-started listing fails closed
rather than licensing soft-deletes. Also skip reconciliation when the registry
listed no models at all -- a wrong `registryUri` or credentials that cannot
list are indistinguishable from an emptied registry, and acting on it deletes
every model under the service.

* test(mlflow): cover an empty registry page that still carries a token

The reporter's registry answered the first page with a token and no
`registered_models` at all. The old single-call listing read that as an empty
registry and reported a fully successful run over zero models.

---------

Co-authored-by: Claude Opus 5 <[email protected]>
pmbrull pushed a commit that referenced this pull request Sep 2, 2026
* fix(mlflow): read model signatures from the MLmodel file on MLflow 3.x

MLflow 3.x dropped the `mlflow.log-model.history` run tag in favour of
LoggedModel entities, so `data.tags["mlflow.log-model.history"]` raised
KeyError on every model. The broad except swallowed it, leaving mlFeatures
empty and emitting a spurious warning per model.

No metadata API exposes the signature -- not the MLflow logged-model
endpoint, nor either Unity Catalog model-version endpoint -- so it can only
be read from the model's own MLmodel file. Fetch just that one file.

`mlflow.models.get_model_info` is deliberately avoided: it resolves
`models:/` URIs through MLflow's global tracking config, which this
connector never sets, and it imports pandas, which mlflow-skinny does not
ship. Both make it fail on Unity Catalog. Resolving the artifact location
through the connector's own client and parsing the YAML with json avoids
each. `mlflow.artifacts.load_text` would be tidier but takes no
tracking_uri, so it hits the same global-config problem.

A missing tag now logs at debug rather than warning, since it is the norm
on 3.x, and a tag with no entry for the run falls through to the artifacts
instead of returning early.


(cherry picked from commit 1ab63cd)

* fix(mlflow): stop a bad signature or partial listing from losing models

Guard the ML-feature build: a malformed signature escaped yield_mlmodel, and
the topology runner drops the entity without recording a failure, so the model
vanished silently. Also skip deletion reconciliation when the registry listing
was truncated, since models beyond the page budget would be wrongly marked
deleted.


(cherry picked from commit 8931369)

* fix(mlflow): never reconcile deletions off a listing we cannot trust

Track listing completion positively instead of tracking truncation, and reset
it per run, so an abandoned, failed or never-started listing fails closed
rather than licensing soft-deletes. Also skip reconciliation when the registry
listed no models at all -- a wrong `registryUri` or credentials that cannot
list are indistinguishable from an emptied registry, and acting on it deletes
every model under the service.

Adds the regression test for the reporter's registry shape: an empty first page
that still carries a page token, which the old single-call listing read as
"no models" and reported as a fully successful run.

---------

Co-authored-by: Claude Opus 5 <[email protected]>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MLflow connector fails to extract features on MLflow 3.x due to removed mlflow.log-model.history tag

3 participants