flightcheck: offline URL host hygiene gate (catch typo'd/hallucinated link hosts)#209
Open
daeunJe0ng wants to merge 1 commit into
Open
Conversation
…ated link hosts before merge) FlightCheck emits portal, doc, and API URLs but nothing verifies the hosts are real and intended. A typo'd or hallucinated host (learn.microsft.com) or an http portal link sends the operator nowhere, and today that ships silently. Add a deterministic, offline test that scans FlightCheck source for every http(s) URL and asserts each static host is registered in a curated allowlist and that fetchable hosts use https. Wire it into ci.yml as a fast no-network job so it gates every PR. This is a host-level gate only; it does not verify a path is live (stale-path/404 detection is a separate networked concern that can reuse url_registry.py). 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
Adds a deterministic, offline gate that catches a whole class of broken links in the FlightCheck report before merge: URLs pointing at a host that is a typo or a hallucination.
FlightCheck emits three kinds of URLs (user-facing portal/doc links, backend API hosts, and XML namespace/example URIs), but today nothing checks that the hosts are real and intended. A single wrong character (
learn.microsft.com,admin.powerplatfrom.microsoft.com) or anhttp://portal link renders as a clickable link that sends the operator nowhere, and it ships silently.What this does
tests/flightcheck/url_registry.py: a curated allowlist of every host FlightCheck is allowed to emit, split into three categories (portal/doc, API, namespace/example) plus a per-tenant suffix rule for*.crm.dynamics.com.tests/flightcheck/test_url_hygiene.py: scans FlightCheck source (stdlib only, no imports of check modules, no network) for everyhttp(s)URL and asserts:https..github/workflows/ci.yml: wires the test in as a fast, no-network job so it gates every PR. (The FlightCheck pytest suite is otherwise not run in CI, so a test alone would enforce nothing.)Adding or misspelling a host now turns into a review signal: the test fails until the host is deliberately categorized in
url_registry.py.Scope and honest limits
This is a host-level gate. It catches typo'd/unapproved domains and http-on-a-portal.
It does not verify that a path is live. A well-formed
https://learn.microsoft.com/<moved-article>that now 404s or redirects to the docs home still passes. That "stale path" problem needs a live, networked checker, which is intentionally kept out of the deterministic suite and can reuseurl_registry.py.Testing
python -m pytest tests/flightcheck/test_url_hygiene.py -q→ 7 passed.ruff checkon both new files → clean.ci.ymlparses as valid YAML.Relationship to #208
Complementary, not overlapping. #208 makes bare URLs clickable; this PR makes sure the host a link points at is real.