Skip to content

Suppress inline warnings in summary warning mode - #13667

Merged
gnodet merged 4 commits into
apache:feature/warning-modefrom
abdulhannansyed548-cmd:investigate-13563-warning-mode
Oct 22, 2026
Merged

gnodet merged 4 commits into
apache:feature/warning-modefrom
abdulhannansyed548-cmd:investigate-13563-warning-mode

Conversation

@abdulhannansyed548-cmd

Copy link
Copy Markdown
Contributor

What does this change do?

When --warning-mode=summary is selected, inline WARN log events are suppressed while warnings remain available for build report capture.

  • Passes the configured warning mode to ProjectBuildLogAppender.
  • Suppresses inline warning events in summary mode.
  • Preserves warning events for the build report collector.
  • Adds tests covering summary mode, all mode, INFO forwarding, and case-insensitive mode matching.

Testing

  • Focused Spotless checks passed.
  • git diff --check passed.
  • Targeted Maven tests could not complete because of a pre-existing compilation error in BuildPlanExecutor.java involving Throwable and Exception.

The full test suite has not passed due to this compilation issue.

@gnodet-bot gnodet-bot 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.

The core logic is correct: in summary mode, inline WARN events are filtered from buildEventListener.projectLogMessage() while still flowing to reportCapture — that's the right split. Tests confirm the behaviour and would fail against the base branch. A few comments below.

⚠️ Note: The PR description acknowledges a pre-existing compilation error in BuildPlanExecutor.java that prevented the full test suite from running. This should be resolved before merging — even if the error is pre-existing, a PR that cannot compile the full project in CI is not merge-ready for the feature branch.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@abdulhannansyed548-cmd

Copy link
Copy Markdown
Contributor Author

Thanks for the review!

I've added Javadoc to document the warningMode parameter and fixed the Throwable/Exception type mismatch in BuildPlanExecutor that was preventing compilation.

The focused ProjectBuildLogAppenderTest run now passes (4 tests, 0 failures), and the formatting and whitespace checks pass as well.

Thanks for pointing these out!

@gnodet-bot gnodet-bot 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.

The main feature logic is sound — filtering inline WARN from projectLogMessage() in summary mode while preserving the event for reportCapture is the right approach. The verifier confirmed two of the original six findings as false positives. Remaining actionable items below.

False positives cleared:

  • The 1-arg constructor removal doesn't break anything — LookupInvoker.java (the only call site) is updated in this PR.
  • The @AfterEach leak concern is unfounded — all tests use try-with-resources which calls close(), which in turn calls MavenSimpleLogger.setLogSink(null).

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@abdulhannansyed548-cmd

Copy link
Copy Markdown
Contributor Author

Thanks for the review!

I've updated the constructor Javadoc to document the null behavior.

Regarding the unrelated BuildPlanExecutor change, I understand that it would be cleaner to keep it separate from this feature PR. I'll preserve the compilation fix separately and keep this PR focused on the warning-mode functionality.

Thanks for the guidance!

@gnodet-bot gnodet-bot 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.

The new commit (Javadoc for warningMode parameter) addresses two of the four prior threads — nicely done, the null-behavior documentation is especially helpful. Two items remain:

  1. "summary" hardcoded in .orElse("summary") — the fallback string is still duplicated here and inside BuildReportCollector. Consider extracting it to a constant to keep the canonical default in one place.

  2. Unrelated changes in BuildPlanExecutor.java — the Exception → Throwable widening and the missing-newline-at-EOF fix are good changes, but they are unrelated to the warning-mode feature. Keeping them in this PR obscures the blast radius.

No new issues introduced by the Javadoc commit.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@abdulhannansyed548-cmd
abdulhannansyed548-cmd force-pushed the investigate-13563-warning-mode branch from e887b31 to 28be59a Compare October 22, 2026 01:28

@gnodet-bot gnodet-bot 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.

Following up on my earlier reviews — the null-behavior documentation for warningMode is now in place (latest commit). That closes the last Javadoc gap.

One item from the previous review remains open:

"summary" hardcoded in .orElse("summary") — the fallback string is duplicated: once in LookupInvoker.java (here) and again inside ProjectBuildLogAppender's Javadoc which describes the accepted values. A shared constant (e.g. in ProjectBuildLogAppender or alongside the option parsing) would make a future default change safe and obvious. As-is, the two literals will silently diverge.

The BuildPlanExecutor.java thread is now outdated — that file is no longer in the PR diff, so either the changes were dropped or merged upstream. No action needed there.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet-bot gnodet-bot 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.

Following up on my earlier reviews — the last remaining open item (the hardcoded "summary" literal spread across three call sites) has been addressed in this update: LookupInvoker, MavenInvoker, and BuildReportCollector all now reference ProjectBuildLogAppender.DEFAULT_WARNING_MODE. That closes both open threads.

The implementation looks solid:

  • suppressInlineWarnings is correctly derived at construction time, not per-call.
  • The accept() filter is tight: WARN events are suppressed from projectLogMessage() while still flowing to reportCapture. INFO/DEBUG/ERROR are unaffected.
  • "summary".equalsIgnoreCase(null) returns false — the null case behaves as documented.
  • The four unit tests cover summary suppression, all-mode forwarding, INFO passthrough, and case-insensitive matching.

LGTM.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet
gnodet merged commit 6530083 into apache:feature/warning-mode Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants