fix: fallback to origin when lab/runtime is missing in standardize_labs#1844
Merged
gustavobtflores merged 2 commits intokernelci:mainfrom Apr 10, 2026
Merged
Conversation
alanpeixinho
reviewed
Apr 8, 2026
backend/kernelCI_app/management/commands/helpers/kcidbng_ingester.py
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
this change is already on main, remember to rebase your branch with the latest changes
Contributor
Author
There was a problem hiding this comment.
The linting change is not on the PR anymore after the rebase
backend/kernelCI_app/management/commands/helpers/kcidbng_ingester.py
Outdated
Show resolved
Hide resolved
0cbbb0a to
0c419e9
Compare
backend/kernelCI_app/management/commands/helpers/kcidbng_ingester.py
Outdated
Show resolved
Hide resolved
gustavobtflores
approved these changes
Apr 10, 2026
Contributor
gustavobtflores
left a comment
There was a problem hiding this comment.
Looks good, just a nit, pre-approving
backend/kernelCI_app/management/commands/helpers/kcidbng_ingester.py
Outdated
Show resolved
Hide resolved
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 |
alanpeixinho
approved these changes
Apr 10, 2026
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
bbbe844 to
c81454f
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1752
When ingesting data via
standardize_labs, builds and tests that haveno
lab(builds) orruntime(tests) value inmiscwere silentlylosing their origin context. This fix uses the
originfield as afallback, ensuring entries without explicit lab information can still
be grouped and filtered by origin.
Behavior:
lab/runtimeis missing andoriginexists →originis set aslab/runtimeinmiscoriginis NOT used as fallbacklab/runtimenororiginis present → no changeHow to verify
Run the unit tests:
cd backend poetry run pytest kernelCI_app/tests/unitTests/commands/monitorSubmissions/kcidbng_ingester_test.py::TestStandardizeLabs -v -m unitAll 8 test cases in
TestStandardizeLabsshould pass, including the 4 new ones added in this PR that cover the fallback scenarios.