Skip to content

Update Spectre.Console to latest version (blocked by hyperlink rendering change) #14595

@joperezr

Description

@joperezr

Summary

Spectre.Console 0.54.1-alpha.0.37 introduced a behavioral change in how [link=url] markup renders ANSI hyperlink escape sequences (OSC 8). This broke the ConsoleActivityLoggerTests.WriteSummary_WithMarkdownLinkInPipelineSummary_RendersClickableLink test, which verifies that markdown links in pipeline summary output are converted to clickable ANSI hyperlinks.

The update was attempted in #14549 and reverted back to 0.52.1-preview.0.5.

What broke

The test at tests/Aspire.Cli.Tests/Utils/ConsoleActivityLoggerTests.cs:46 creates a Spectre.Console instance with AnsiSupport.Yes and ColorSystem.TrueColor, renders a pipeline summary containing a markdown link, and verifies the output contains an ANSI OSC 8 hyperlink escape sequence:

string hyperlinkPattern =
    $@"\u001b\]8;[^;]*;{expectedUrl}\u001b\\.*link.*\u001b\]8;;\u001b\\";
Assert.Matches(hyperlinkPattern, result);

With Spectre.Console 0.52.1-preview.0.5, the [link=url]text[/] markup correctly emits ANSI OSC 8 sequences (\u001b]8;...). With 0.54.1-alpha.0.37, the output no longer contains these escape sequences — the test value showed only separator dashes ("--------------------------------------------------") instead of the expected hyperlink markup.

How it works

  1. MarkdownToSpectreConverter.ConvertLinks() (src/Aspire.Cli/Utils/MarkdownToSpectreConverter.cs:199) converts markdown [text](url) to Spectre markup [cyan][link=$2]$1[/][/]
  2. ConsoleActivityLogger.FormatPipelineSummaryKvp() (src/Aspire.Cli/Utils/ConsoleActivityLogger.cs:314) uses this converter to format pipeline summary key-value pairs
  3. Spectre.Console is expected to render the [link=url] markup as ANSI OSC 8 hyperlinks when the console supports it

What needs to happen

To upgrade Spectre.Console:

  1. Investigate the rendering change: Determine if Spectre.Console 0.54.x changed how [link=url] is rendered (different escape format, new API, or removed feature)
  2. Update MarkdownToSpectreConverter: If the link markup syntax changed, update ConvertLinks() to use the new syntax
  3. Update the test: Adjust the regex pattern in ConsoleActivityLoggerTests to match the new escape sequence format, or update the test approach if links are rendered differently
  4. Verify all Spectre-dependent functionality: The CLI uses Spectre.Console extensively for tables, progress bars, markup rendering, and interactive prompts — verify these still work correctly

Files involved

  • src/Aspire.Cli/Utils/MarkdownToSpectreConverter.cs — link conversion logic
  • src/Aspire.Cli/Utils/ConsoleActivityLogger.cs — pipeline summary rendering
  • tests/Aspire.Cli.Tests/Utils/ConsoleActivityLoggerTests.cs — the failing test
  • Directory.Packages.props — Spectre.Console version (currently 0.52.1-preview.0.5)

Current version

  • Pinned at: 0.52.1-preview.0.5
  • Target: 0.54.1-alpha.0.37 or latest pre-release at time of upgrade

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions