flightcheck: autolink bare URLs in report remediation#208
Open
daeunJe0ng wants to merge 2 commits into
Open
Conversation
…ble links on manual rows) Report remediation text supported two link forms but only linkified markdown [label](url). Bare https:// URLs were escaped to plain text, so they rendered but were not clickable - worst on MANUAL / NotConfigured rows where the remediation URL is the operator's only path to the fix. _md_links_to_html now also autolinks bare URLs (stepping over anchors it just created so markdown links are not double-wrapped), and trims trailing sentence punctuation. _multiline_html and the manual checklist renderer inherit the fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8fb19ec0-cad9-41c2-8064-2208b3844ede
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FlightCheck report
remediationtext supports two link forms: markdown[label](url)and barehttps://…URLs. Only the markdown form was linkified. Bare URLs were HTML-escaped and rendered as plain text, so they showed up but were not clickable. Because different checks author URLs differently, operators saw links that worked on some rows and not others.The concrete live case is the WD-CONN connection-health check (
checks/workday.py), whose WARNING and FAILED remediations embed a baremake.powerautomate.com/environments/<env>/connectionsURL built via f-string. That URL is the operator's path to fix a broken Workday connection, and today it renders as non-clickable plain text.This makes both forms render as clickable anchors.
What changed
_md_links_to_html(inrunner.py) now runs a second pass,_autolink_bare_urls, after the markdown pass.[label](url)is never double-wrapped..,;:!?) and an unbalanced closing paren are trimmed off the link target, sosee https://aka.ms/x.keeps the period outside thehref._multiline_htmland the manual checklist renderer call_md_links_to_html, so they inherit the fix with no separate change.Design rationale
The fix lives in the renderer, not in each check. That fixes every existing report immediately and means check authors cannot reintroduce a non-clickable link by pasting a raw URL. The alternative (a lint rule forcing markdown links) would leave current reports broken and add an ongoing authoring burden. The renderer is the single choke point every remediation string already passes through, so it is the correct layer.
Testing
tests/flightcheck/test_runner_link_rendering.py(12 tests): bare URL becomes an anchor, trailing punctuation and parens excluded, query-string&stays HTML-safe, markdown links still work and are not double-wrapped, mixed markdown + bare, plain text untouched except escaping,_multiline_htmllinkifies and keeps line breaks, plus end-to-end check cards render clickable links.Scope note
This PR makes bare URLs clickable. It does not check that a link's host is real/intended (typo'd or hallucinated domains) — that host-level hygiene gate is #209.
Risks and assumptions
http/httpsonly. Other schemes are not autolinked, which is intentional for a security-reviewed report surface._mask_sensitivecan rewrite a GUID that appears inside a deep-link URL, which alters the link target. That is a separate concern from clickability and is left untouched here.