Skip to content

test(ingestion): cover newest-version selection in the Mlflow source#30198

Draft
IceS2 wants to merge 4 commits into
mainfrom
test/mlflow-newest-version-coverage
Draft

test(ingestion): cover newest-version selection in the Mlflow source#30198
IceS2 wants to merge 4 commits into
mainfrom
test/mlflow-newest-version-coverage

Conversation

@IceS2

@IceS2 IceS2 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #30191, addressing a Greptile review comment: the Mlflow integration test created a single model version, so max(..., key=version) was never exercised — a matcher that selected a stale version would still pass.

What

Register a second model version with distinct hyperparameters (alpha=0.2, l1_ratio=0.3), then assert the ingested entity carries the newest version's run (alpha=0.5, l1_ratio=1.0) and that the older version's values are absent. The log-model retry loop is extracted into a shared helper so both versions register through the same path.

Key finding

RegisteredModel.latest_versions returns a single element — the newest version — even with many versions registered (verified against MLflow 3.10 and 3.14: three versions still yield a one-element list). Stages were the only thing that produced multiple entries, and they are deprecated. So the connector's max() cannot be discriminated by min-vs-max no matter how many versions exist. What the second version does change is which run the connector reads (get_run(latest_version.run_id)), so asserting the ingested hyperparameters match the newest run is the meaningful coverage — it catches a regression that walked all versions and grabbed the oldest.

Verified locally against the testcontainers stack: the strengthened test fails with the pre-fix connector (Version not found) and passes with #30191's fix.

Note

This branch is stacked on #30191 and currently contains its commits too; the diff narrows to just the test once #30191 merges. Draft until then.

IceS2 added 3 commits July 17, 2026 16:15
Fixes #30189

Select the newest registered model version by version number. Matching the
parent's last_updated_timestamp only held while the version creation was the
last write to the registered model; any later edit to its description, tags or
aliases desynced the two and silently dropped the model.

Point the Playwright Mlflow connection at sqlite backends. The placeholder
strings resolved to MLflow's file store, which 3.13+ rejects, so the AutoPilot
agent failed to connect and the run-completed banner never rendered.
search_registered_models returns a list of RegisteredModel, but the cast
claimed the collection itself was one. Iterating a RegisteredModel yields its
property pairs, so basedpyright inferred the loop variable as tuple[str, Any]
and rejected every attribute access on it. The cast was a no-op at runtime.

Modernize the annotations to PEP 585/604 while here, which retires the UP006,
UP035 and UP045 suppressions rather than moving them.
Register a second model version with distinct hyperparameters and assert the
ingested entity carries the newest version's run, not the older one's. Without
this the fixture created a single version, so a matcher that selected a stale
version would still pass. Extract the log-model retry into a helper shared by
both versions.
@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Jul 17, 2026
raise
log_registered_model(lr, signature)

# Describing the model bumps RegisteredModel.last_updated_timestamp past the

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Quality: Duplicated update_registered_model call and comment

Lines 179-181 are a verbatim copy of the block at 175-177 (same comment, same update_registered_model call). The second call is redundant — it re-applies the identical description and adds no coverage. Remove the duplicated block to keep the fixture clean.

Remove the duplicated update_registered_model block (lines 179-181).:

# Describing the model bumps RegisteredModel.last_updated_timestamp past the
# version's, which must not hide the version from the registry listing.
mlflow.MlflowClient().update_registered_model(MODEL_NAME, description=MODEL_DESCRIPTION)
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

@gitar-bot

gitar-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 0 resolved / 1 findings

Strengthens MLflow ingestion tests by asserting the latest model version's run parameters. Consolidate the duplicated update_registered_model call and accompanying comment on lines 175-181.

💡 Quality: Duplicated update_registered_model call and comment

📄 ingestion/tests/integration/sources/mlmodels/mlflow/test_mlflow.py:175-181

Lines 179-181 are a verbatim copy of the block at 175-177 (same comment, same update_registered_model call). The second call is redundant — it re-applies the identical description and adds no coverage. Remove the duplicated block to keep the fixture clean.

Remove the duplicated update_registered_model block (lines 179-181).
# Describing the model bumps RegisteredModel.last_updated_timestamp past the
# version's, which must not hide the version from the registry listing.
mlflow.MlflowClient().update_registered_model(MODEL_NAME, description=MODEL_DESCRIPTION)
🤖 Prompt for agents
Code Review: Strengthens MLflow ingestion tests by asserting the latest model version's run parameters. Consolidate the duplicated `update_registered_model` call and accompanying comment on lines 175-181.

1. 💡 Quality: Duplicated update_registered_model call and comment
   Files: ingestion/tests/integration/sources/mlmodels/mlflow/test_mlflow.py:175-181

   Lines 179-181 are a verbatim copy of the block at 175-177 (same comment, same `update_registered_model` call). The second call is redundant — it re-applies the identical description and adds no coverage. Remove the duplicated block to keep the fixture clean.

   Fix (Remove the duplicated update_registered_model block (lines 179-181).):
   # Describing the model bumps RegisteredModel.last_updated_timestamp past the
   # version's, which must not hide the version from the registry listing.
   mlflow.MlflowClient().update_registered_model(MODEL_NAME, description=MODEL_DESCRIPTION)

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 👍 / 👎 | Gitar

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.

1 participant