Skip to content

CLI: file-less warnings render in red "Unhandled exception" panel #3726

Description

@lcawl

Summary

After #3698 (e455e495, 2026-07-22), file-less diagnostics are routed to a dedicated Spectre panel labeled "Unhandled exception" with red styling. This panel was intended for multiline exception stack traces, but it also captures ordinary CLI warnings that have no source file — most visibly changelog bundle warnings like No changelog file found for PR: ….

That makes expected warnings look like fatal errors and can produce garbled output when many similar warnings are rendered in one panel.

Steps to reproduce

From a repo with a serverless-release profile (for example, kibana):

docs-builder changelog bundle serverless-release 2026-07-22 ./docs/temp/serverless-prs.txt

When some PRs in the list have no matching changelog entry, the CLI prints a red rounded panel:

╭─Unhandled exception────
│  No changelog file found for PR: https://github.com/elastic/kibana/pull/27…
╰─────────────────────────

Expected behavior

  • Unhandled exceptions (with stack traces) should use the dedicated panel so newlines are preserved.
  • File-less warnings should not appear under an "Unhandled exception" header or in exception styling.
  • Warnings should use warning styling and render one message per line without horizontal concatenation.

Actual behavior

  1. Misleading label/styling: All file-less diagnostics — errors and warnings — are rendered in DisplayGlobalDiagnostics with header "Unhandled exception" and [bold red] text (ErrataFileSourceRepository.cs).

  2. Changelog warnings affected: ChangelogEntryMatcher emits missing-PR warnings with an empty file:

    collector.EmitWarning(string.Empty, $"No changelog file found for PR: {pr}");
  3. Formatting glitch: When many similar warnings are stacked as Rows inside one panel, adjacent messages can render on the same line (for example, truncated URLs concatenated: pull/27│pull/27│pull/279825).

Root cause

#3698 split diagnostics into:

  • File-anchored → Errata summary (unchanged)
  • File-less (File == "") → DisplayGlobalDiagnostics panel

The panel path does not distinguish exceptions from warnings, and always uses exception presentation.

Proposed fix

In src/tooling/docs-builder/Diagnostics/Console/ErrataFileSourceRepository.cs:

  1. Route file-less errors that look like exceptions (for example, message contains "Exception:" or multiline stack trace) to the red "Unhandled exception" panel.
  2. Route file-less warnings (and other non-exception file-less diagnostics) to a separate section — for example, a yellow/blue "Warnings" panel, or include them in the existing Errata summary with appropriate severity styling.
  3. Ensure each warning renders on its own line (avoid horizontal concatenation in narrow terminals).

Context

Acceptance criteria

  • changelog bundle missing-PR warnings do not appear under "Unhandled exception"
  • Real unhandled exceptions still render with preserved multiline stack traces
  • Multiple file-less warnings render legibly (one message per line)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions