Skip to content

Handle wildcard paths to external content sources; check redirects - #740

Merged
gewarren merged 2 commits into
dotnet:mainfrom
gewarren:handle-wildcards
Sep 11, 2026
Merged

Handle wildcard paths to external content sources; check redirects#740
gewarren merged 2 commits into
dotnet:mainfrom
gewarren:handle-wildcards

Conversation

@gewarren

Copy link
Copy Markdown
Collaborator

Contributes to #738

Copilot AI lite review requested due to automatic review settings September 11, 2026 18:10
@gewarren
gewarren enabled auto-merge (squash) September 11, 2026 18:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved path-matching and redirect-status issues remain, and GET fallback coverage is missing.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates DocsVerifier to handle wildcard external content paths and validate redirects with GET fallback.

Changes:

  • Adds wildcard-parent matching for external sources.
  • Falls back from redirected HEAD requests to GET.
  • Adds regression coverage for wildcard paths.
File summaries
File Summary
actions/docs-verifier/tests/GitHub.UnitTests/PathVerifierTests.cs Adds wildcard external-source path tests.
actions/docs-verifier/src/RedirectionVerifier/RedirectTargetVerifier.cs Restrict fallback handling to actual redirects or responses with Location; add HTTP-backed coverage for the HEAD-to-GET path. Moderate (1 vote), nit (1 vote).
actions/docs-verifier/src/DocfxVerifier/PathVerifier.cs Use case-insensitive comparisons and apply ancestor matching only to wildcard metadata keys. Moderate (1 vote), moderate (3 votes).
Review details

Suppressed comments (3)

actions/docs-verifier/src/DocfxVerifier/PathVerifier.cs:329

  • These comparisons use ordinal case-sensitive matching, while DocFX config content matching is explicitly StringComparison.OrdinalIgnoreCase (actions/docs-verifier/src/RedirectionVerifier/DocfxConfiguration.cs:36). An external src and its fileMetadata glob that differ only by case are therefore reported as invalid even though DocFX treats them as the same path; use the case-insensitive comparison consistently here.
                if (pathPrefix.Equals(sourceDirectory, StringComparison.Ordinal)
                    || pathPrefix.StartsWith(sourceDirectory + "/", StringComparison.Ordinal)
                    || sourceDirectory.StartsWith(pathPrefix + "/", StringComparison.Ordinal))

actions/docs-verifier/src/RedirectionVerifier/RedirectTargetVerifier.cs:124

  • The numeric range includes 300 MultipleChoices, 304 NotModified, and 305 UseProxy, which are not redirect responses. For those statuses this causes an unnecessary GET and can replace a reachable 3xx result with a method-specific 404 or other failure; restrict the helper to actual redirect codes (301/302/303/307/308), or require a Location header.
        int code = (int)statusCode;
        return code >= 300 && code < 400;

actions/docs-verifier/src/RedirectionVerifier/RedirectTargetVerifier.cs:102

  • The new HEAD-3xx-to-GET fallback is not exercised by the existing tests: every RedirectTargetVerifier test injects statusCodeProvider, so GetStatusCodeAsync and this branch never run. Add an HttpMessageHandler-backed test (or equivalent HTTP-client injection) that verifies a redirect followed by a working target and a redirect followed by 404 use the GET result.
            if (headResponse.StatusCode is HttpStatusCode.MethodNotAllowed or HttpStatusCode.NotImplemented or HttpStatusCode.NotFound
                || IsRedirectStatusCode(headResponse.StatusCode))
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread actions/docs-verifier/src/DocfxVerifier/PathVerifier.cs Outdated

@wadepickett wadepickett left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gewarren: Approved. Looks good. Copilot found one edge case issue. Worth fixing it seems. Somewhat low to moderate issue.

@gewarren
gewarren merged commit 6261880 into dotnet:main Sep 11, 2026
8 checks passed
@gewarren
gewarren deleted the handle-wildcards branch September 11, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants