Skip to content

#2042: quiet modus supression for question - #2228

Open
marceltchanga9 wants to merge 2 commits into
devonfw:mainfrom
marceltchanga9:bug/2042_quiet_modus_supression_for_question
Open

#2042: quiet modus supression for question#2228
marceltchanga9 wants to merge 2 commits into
devonfw:mainfrom
marceltchanga9:bug/2042_quiet_modus_supression_for_question

Conversation

@marceltchanga9

@marceltchanga9 marceltchanga9 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #2042

Implemented changes:

Changed the log level in quiet modus


Testing instructions

  1. The ide-setting repo is working with the main branch of IDEasy. So in \ide-settings\repositories\IDEasy.properties change the git_url to "https://github.com/marceltchanga9/IDEasy.git" and the git branch to bug/2042_quiet_modus_supression_for_question
  2. Delete all settings in settings.xml
  3. create a new project using the command ide -q create test-project https://github.com/marceltchanga9/ide-settings.git#bug/2042_q_parameter_suspression
  4. Check the console and you'll be asked about the version of Python not being up-to-date

Checklist for this PR

Make sure everything is checked before merging this PR. For further info please also see
our DoD.

  • When running mvn clean test locally all tests pass and build is successful ✅
  • PR title is of the form #«issue-id»: «brief summary» (e.g. #921: fixed setup.bat). If no issue ID exists, title only.✅
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)✅
  • PR and issue(s) have suitable labels✅
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)✅
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled
    with internal
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"✅

…bug/2042_quiet_modus_supression_for_question

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Jul 29, 2026
@marceltchanga9 marceltchanga9 changed the title Bug/2042 quiet modus supression for question #2042: quiet modus supression for question Jul 29, 2026
@quando632 quando632 moved this from 🆕 New to Team Review in IDEasy board Jul 29, 2026

@quando632 quando632 left a comment

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.

Thanks for tackling this. The one line change does fix the reported symptom: with the threshold at INTERACTION, both the question from cveCheck and the option list are visible under -q.

Since only ContextCommandlet.java is part of the diff, GitHub does not let me attach applyable suggestions to the other files, so the proposed changes are inlined below.

On the chosen approach

The fix works, but it deviates from the guidance in the issue, which says: "IMHO INTERACTION has to be raised to be after WARNING." This PR lowers the quiet threshold instead and leaves the enum order untouched.

Two points on that:

  1. The underlying design flaw remains. Any code path that sets the threshold to WARNING or higher will still swallow prompts. This is not theoretical: see the existing workaround in AbstractIdeContext lines 1480 to 1485, where the log level is temporarily lowered to INFO just so the license question becomes visible. runWithoutLogging(lambda, threshold) can also set arbitrary thresholds.

  2. The functional difference is not just cosmetic. With this variant SUCCESS also becomes visible under -q, while the enum reordering would keep it suppressed. Affected messages include IDE_ROOT is set to ..., IDE_HOME is set to ..., You are online., Found bash executable at: ... and all step.success() output. This does match the documented behaviour of the flag, but it is a noticeable change for anyone using -q to keep output small.

Please either reorder the enum to ... SUCCESS, WARNING, INTERACTION, ERROR, PROCESSABLE and keep quiet = WARNING, or briefly explain in the PR why this variant was chosen and align it with @hohwille.

1. Duplicate question logging

cli/src/main/java/com/devonfw/tools/ide/context/AbstractIdeContext.java line 1087

The question is logged twice: once at INTERACTION and once as WARN. The WARN line used to be the workaround so that at least the question text showed up under -q. Now that INTERACTION is visible in quiet mode, the question is printed twice, in normal mode as well as in quiet mode. This line should be removed as part of this fix.

    assert (options.length > 0);
    IdeLogLevel.INTERACTION.log(LOG, question, args);
    LOG.warn(question, args);   // <- remove this line
    return displayOptionsAndGetAnswer(options);

2. English help text

cli/src/main/resources/nls/Help.properties line 188

The help text no longer describes the actual behaviour. Interactive questions are now visible too.

opt.--quiet=disable info logging (only log interaction, success, warning or error).

3. German help text

cli/src/main/resources/nls/Help_de.properties line 188

Same change as in the English file. The stray space after the opening bracket is fixed along the way.

opt.--quiet=Deaktiviert Info Logging (nur interaction, success, warning und error).

4. Missing CHANGELOG entry

CHANGELOG.adoc, section == 2026.08.001

The DoD requires an entry for the issue in the next open release. This change is visible to end users.

* https://github.com/devonfw/IDEasy/issues/2100[#2100]: Fix Python not available for Mac x64
* https://github.com/devonfw/IDEasy/issues/2042[#2042]: -q parameter no longer suppresses interactive questions

5. Missing test

cli/src/test/java/com/devonfw/tools/ide/commandlet/ContextCommandletTest.java

The bugfix has no test. Without an assertion on the log level a revert would go unnoticed. testRunWithOptions() already sets --quiet, only the check is missing.

Add the import:

import com.devonfw.tools.ide.log.IdeLogLevel;

And the assertion at the end of testRunWithOptions():

    assertThat(cxt.getStartContext().getLogLevelConsole()).isEqualTo(IdeLogLevel.INTERACTION);

On top of that, an end to end test via IdeTestContext would be useful: run a question(...) in quiet mode and assert that both the question and the option list are logged, and that the question is logged only once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

-q parameter supresses ask for CVE choices

2 participants