Skip to content

fix: fallback to origin when lab/runtime is missing in standardize_labs#1844

Merged
gustavobtflores merged 2 commits intokernelci:mainfrom
profusion:feat/coalesce-query-data
Apr 10, 2026
Merged

fix: fallback to origin when lab/runtime is missing in standardize_labs#1844
gustavobtflores merged 2 commits intokernelci:mainfrom
profusion:feat/coalesce-query-data

Conversation

@dede999
Copy link
Copy Markdown
Contributor

@dede999 dede999 commented Apr 8, 2026

Summary

Closes #1752

When ingesting data via standardize_labs, builds and tests that have
no lab (builds) or runtime (tests) value in misc were silently
losing their origin context. This fix uses the origin field as a
fallback, ensuring entries without explicit lab information can still
be grouped and filtered by origin.

Behavior:

  • If lab/runtime is missing and origin exists → origin is set as lab/runtime in misc
  • If the lab matches an automatic lab pattern → existing behavior is preserved; origin is NOT used as fallback
  • If neither lab/runtime nor origin is present → no change

How to verify

Run the unit tests:

cd backend
poetry run pytest kernelCI_app/tests/unitTests/commands/monitorSubmissions/kcidbng_ingester_test.py::TestStandardizeLabs -v -m unit

All 8 test cases in TestStandardizeLabs should pass, including the 4 new ones added in this PR that cover the fallback scenarios.

@MarceloRobert MarceloRobert added Ingester The issue relates to the ingester tool, including the command itself and related functions. Data Quality labels Apr 8, 2026
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.

this change is already on main, remember to rebase your branch with the latest changes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The linting change is not on the PR anymore after the rebase

@dede999 dede999 force-pushed the feat/coalesce-query-data branch 2 times, most recently from 0cbbb0a to 0c419e9 Compare April 10, 2026 12:22
Copy link
Copy Markdown
Contributor

@gustavobtflores gustavobtflores left a comment

Choose a reason for hiding this comment

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

Looks good, just a nit, pre-approving

Comment on lines +114 to +122
lab = test.get("misc", {}).get("runtime")
if lab and AUTOMATIC_LABS.match(lab):
test["misc"][AUTOMATIC_LAB_FIELD] = lab
test["misc"].pop("runtime", None)
lab = None
if not lab:
origin = test.get("origin")
if origin:
test.setdefault("misc", {})["runtime"] = origin
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.

ditto

When a build or test has no lab (builds) or runtime (tests) field in misc,
use the origin field as a fallback value. This avoids losing origin context
for entries that lack explicit lab information.

Closes kernelci#1752
@dede999 dede999 force-pushed the feat/coalesce-query-data branch from bbbe844 to c81454f Compare April 10, 2026 17:48
Move the shared build/test lab normalization logic into a private helper
_standardize_lab_field(item, field). Both builds ("lab") and tests
("runtime") now delegate to it, eliminating the duplicated
AUTOMATIC_LAB_FIELD + origin-fallback blocks.

Add TestStandardizeLabField unit tests covering all branches of the helper.
Copy link
Copy Markdown
Collaborator

@MarceloRobert MarceloRobert left a comment

Choose a reason for hiding this comment

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

LGTM

@gustavobtflores gustavobtflores added this pull request to the merge queue Apr 10, 2026
Merged via the queue into kernelci:main with commit 654fed2 Apr 10, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Data Quality Ingester The issue relates to the ingester tool, including the command itself and related functions.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

coalesce "lab" with "origin"

4 participants