Do not copy unused options on --insert - #5136
Open
Zinkelburger wants to merge 1 commit into
Open
Conversation
LecrisUT
reviewed
Aug 21, 2026
LecrisUT
left a comment
Member
There was a problem hiding this comment.
I defer the review to someone who has touched those things. Reading the code around that section looks like it is getting way too over-engineered.
Comment on lines
1158
to
1172
| def _iter_options() -> Iterator[tuple[str, Any]]: | ||
| for name, value in options.items(): | ||
| if name in ('update', 'update_missing', 'insert', 'allowed-how'): | ||
| for name, value in invocation.options.items(): | ||
| if name in ('update', 'update_missing', 'insert', 'allowed_how'): | ||
| continue | ||
|
|
||
| value_source = invocation.option_sources.get(name) | ||
| if value_source not in ( | ||
| ParameterSource.COMMANDLINE, | ||
| ParameterSource.ENVIRONMENT, | ||
| ): | ||
| debug4(f'{name} not really given via CLI/env, omit from raw step datum') | ||
| continue |
Member
There was a problem hiding this comment.
Overall looks ok to me, but it seems like we are dancing around something that could/should have been much simpler
Click fills every discover option with a default, so --insert was writing repository and revision as unused None into the new phase. That made tmt warn about deprecated keys even when callers used url and ref, as Testing Farm does for kernelinstall. Only copy options that were really given on the command line or via environment. The filter now lives in a single place, _to_raw_step_datum(), so _patch_raw_datum() no longer needs to consult Click and only handles --update-missing semantics. Also fix the skip list to use 'allowed_how', the Click parameter name, instead of 'allowed-how' which never matched. Assisted-by: Cursor Co-authored-by: Cursor <cursoragent@cursor.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WooXbhjvXNBanpvtVD84Mi
Zinkelburger
force-pushed
the
insert-omit-unused-cli-defaults
branch
from
August 21, 2026 15:44
821ac56 to
98208e9
Compare
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.
Click fills every step option with its default, so
discover --insertwas copying all options into the new phase, including
repository: Noneand
revision: None. tmt then warned that those deprecated keys were inuse even though the caller only passed
--url/--ref:This is how Testing Farm invokes tmt for kernelinstall, so every such
run produced false warnings.
_to_raw_step_datum()now only copies options whose ClickParameterSourceisCOMMANDLINEorENVIRONMENT, which is the samefilter
--updatealready applies in_patch_raw_datum(). An optionthat is genuinely passed (e.g. an explicit
--repository) still landsin the phase and still warns.
Pull Request Checklist
--insertcopying defaults)