-
Notifications
You must be signed in to change notification settings - Fork 809
Description
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
MarkdownToSpectreConverter.ConvertLinks()(src/Aspire.Cli/Utils/MarkdownToSpectreConverter.cs:199) converts markdown[text](url)to Spectre markup[cyan][link=$2]$1[/][/]ConsoleActivityLogger.FormatPipelineSummaryKvp()(src/Aspire.Cli/Utils/ConsoleActivityLogger.cs:314) uses this converter to format pipeline summary key-value pairs- 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:
- 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) - Update
MarkdownToSpectreConverter: If the link markup syntax changed, updateConvertLinks()to use the new syntax - Update the test: Adjust the regex pattern in
ConsoleActivityLoggerTeststo match the new escape sequence format, or update the test approach if links are rendered differently - 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 logicsrc/Aspire.Cli/Utils/ConsoleActivityLogger.cs— pipeline summary renderingtests/Aspire.Cli.Tests/Utils/ConsoleActivityLoggerTests.cs— the failing testDirectory.Packages.props— Spectre.Console version (currently0.52.1-preview.0.5)
Current version
- Pinned at:
0.52.1-preview.0.5 - Target:
0.54.1-alpha.0.37or latest pre-release at time of upgrade
References
- PR that discovered this: Update external NuGet dependencies to latest versions #14549
- Spectre.Console repo: https://github.com/spectreconsole/spectre.console