Repository navigation
Fix ub-test-reports link properties overwriting when mapped to same link field (#2058) - #2088
Closed
0xrutabaga wants to merge 1 commit into
Closed
0xrutabaga wants to merge 1 commit into
0xrutabaga wants to merge 1 commit into
Conversation
…ink field (useblocks#2058) ## Summary - In ub_test_reports.needs_export.build_need, merge values from multiple XML properties mapped onto the same link field instead of overwriting previous values. - Pre-initialize all mapped link fields so empty fields are emitted unconditionally. - Preserve mapping order and comma order, deduplicate IDs, and ignore empty or absent properties. - Add regression tests in test_needs_export.py and test_cli_convert.py. - Add changelog entry in packages/ub-test-reports/docs/changelog.rst. Fixes useblocks#2058.
Member
|
Thanks for the quick fix. #2058 is now fixed through #2119, so I'm closing this one in its favour. #2119 merges the same way (mapping order, each id once, the field still written when empty) and also pins the mapping through the |
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
Fixes an issue in
ub-test-reportswhere multiple XML properties mapped onto the same link field overwrite each other instead of merging.Closes #2058.
Problem / Root Cause
In
build_need, iterating overlink_properties.items()directly assignedneed[link_field] = [item.strip() for item in raw.split(",") if item.strip()]. If multiple properties were mapped to the same field, subsequent properties unconditionally replaced earlier ones. Furthermore, if a mapped property was missing from a test case, it evaluated to empty, erasing previously extracted links.Solution
link_fieldtargets to[].list(dict.fromkeys(existing + items)).packages/ub-test-reports/docs/changelog.rst.Tests Added
packages/ub-test-reports/tests/test_needs_export.pyverifying multi-property merging, deduplication, order preservation, and absent property preservation.packages/ub-test-reports/tests/test_cli_convert.py.Validation
uv run pytest packages/ub-test-reports/tests/test_needs_export.py: 53 passed.uv run pytest packages/ub-test-reports/tests/test_cli_convert.py: 47 passed, 1 skipped.uv run pytest packages/ub-test-reports/tests/test_cli_config.py: 36 passed.uv run ruff check packages/ub-test-reports: All checks passed.uv run ruff format --check packages/ub-test-reports: 24 files clean.test_project_config.pywas skipped locally due to Windows symlink privilege limitations.