Repository navigation
Closed
Labels
ai-triagedIssue received an initial assessment through AI-powered current code and architecture checks.ai:eng-questionAI triage raised an architecture/engineering question.ai:writer-questionAI triage raised a question about authoring/writing workflow.enhancement
Description
Prerequisites
- I have searched existing issues to ensure this feature hasn't already been requested
- I have tested using the latest version of docs-builder
What problem are you trying to solve?
When you redirect to a path without .md extension, you get unexpected results in during cross-link validation.
The configuration in apm-agent-android causes this error during an assembler build.
error::d.a.b.AssemblerBuilder:: An error occurred while resolving cross-link opentelemetry://reference/edot-sdks/android: 'reference/edot-sdks/android' is not a valid link in the 'opentelemetry' cross link index: https://elastic-docs-link-index.s3.us-east-2.amazonaws.com/elastic/opentelemetry/main/links.json
error::d.a.b.AssemblerBuilder:: An error occurred while resolving cross-link opentelemetry://reference/edot-sdks/android/getting-started: 'reference/edot-sdks/android/getting-started' is not a valid link in the 'opentelemetry' cross link index: https://elastic-docs-link-index.s3.us-east-2.amazonaws.com/elastic/opentelemetry/main/links.json
error::d.a.b.AssemblerBuilder:: An error occurred while resolving cross-link opentelemetry://reference/edot-sdks/android/troubleshooting: 'reference/edot-sdks/android/troubleshooting' is not a valid link in the 'opentelemetry' cross link index: https://elastic-docs-link-index.s3.us-east-2.amazonaws.com/elastic/opentelemetry/main/links.json
Proposed Solution
Validate the redirects.yml file and it's values.
Examples and Research
No response
Alternative Solutions
No response
Additional Context
No response
How important is this feature to you?
Nice to have
Metadata
Metadata
Assignees
Labels
ai-triagedIssue received an initial assessment through AI-powered current code and architecture checks.ai:eng-questionAI triage raised an architecture/engineering question.ai:writer-questionAI triage raised a question about authoring/writing workflow.enhancement
Activity
reakaleek commentedon Jul 8, 2025
This PR should fix the error.
cotti commentedon Jul 8, 2025
Linting rules:
/reference/...->reference/...)from) should not reference a different repository (other-repo://reference/...->reference/...)path/to/doc->path/to/doc.md)bmorelli25 commentedon Jul 11, 2025
Is this done?
KOTungseth commentedon May 14, 2026
@reakaleek did your PR close this issue?
cotti commentedon Jun 3, 2026
AI triage
Automated investigation against the current codebase. A human still needs to confirm before any code change.
Original concern
redirects.ymlaccepts malformed entries (e.g. targets without a.mdextension, absolute or cross-repo-prefixedfromkeys) that parse fine locally but blow up later during assembler cross-link resolution — so the request is to validate the inputs ofredirects.ymlup front.Findings
RedirectFile.cs:L55-L124— the parser reads eachfromkey verbatim into the dictionary. It does not reject absolute paths (/reference/...), cross-repo prefixes (other-repo://...), or keys missing a.mdextension, and there is no cycle / "source still exists" check. Unknown top-level keys only get a soft warning (L42-L44).DocumentationSet.ValidateRedirectsExists():L140-L194— validates only thetotarget: if it contains://it must be a well-formed URI, otherwise it must resolve to an existing markdown file ("does not exist" / "is not a markdown file"). This is the one place a.md-less target is caught, but it runs per single-repo build and never inspects thefromkey.LocalChangesService.ValidateRedirects():L23-L96(exposed as thediffcommand,DiffCommands.cs:L30-L41) — checks completeness (every deleted/renamed page has a redirect) and has one narrow shape rule that flags a root-relativefromkey vs a docset-relative one (L75-L80). It does not enforce the general input rules requested here.AssemblerBuilder.Resolve():L140-L157(mirrored inCodexBuildService.CollectRedirects) — at assemble time, keys/values that are well-formed absolute URIs are treated as cross-repo links and everything else as relative. This is exactly where theopentelemetry://reference/edot-sdks/androiderror in the report surfaces: a malformed entry becomes a cross-link that fails to resolve, with no upfrontredirects.ymlvalidation to catch it earlier.Verdict
Partially done
Target validation exists —
tomust point to an existing markdown file (or be a valid URI), and a separate diff check enforces that deleted/renamed pages have redirects. But none of the three input-linting rules called out in the thread are implemented: absolutefrompaths, cross-repo-prefixedfromkeys, and the file→file (.md) requirement on keys are all accepted silently at parse time, and there is no cycle / source-still-exists check. So the core ask (validate the inputs) is unmet.Proposal
The mechanical home for this is parse-time validation in
RedirectFile.ReadRedirects(emit errors via the existingYamlStreamReader), since that is where everyfrom/tois already in hand and thediff, single-repo, and assembler paths all flow through it. Concretely, per entry: reject keys starting with/(absolute), reject keys containing://(cross-repo), and require.md/.mdxonfromkeys; optionally detect trivial cycles (a.md -> a.md). Open questions for a human before coding:ai:writer-question): should violations be hard errors or warnings? Hard errors will break any repo whoseredirects.ymlcurrently contains a now-illegal entry (e.g. the apm-agent-android case) until it is fixed — is that acceptable, or does this need a deprecation/warning window + migration note? What exact wording should the error use so writers can self-correct?ai:eng-question): isRedirectFilethe right layer (vs. a dedicated validator invoked by thediffCI command), and should the same rule set run in both single-repo and assembler builds so the failure shows up at authoring time instead of at assemble time?Related issues
Part of the Link checks & Redirects cluster — meta #949 (open). Adjacent open redirect-validation gaps: #1920 (xref evades the deleted-page check), #736 (error-checking for removed files/URLs), #1181 (handling of absolute URL path references — overlaps the "no absolute paths" rule). Prior decisions in this area: #759, #1892, #1779 (all closed). No exact duplicate — #1538 is the only open issue scoped to validating
redirects.ymlinputs.Notes
redirects.yml, but it is a content fix in another repo — it does not add any validation to docs-builder, so this issue remains open on its merits.diffcheck (e.g. commitsfc84db91,223d560c, 2026-05-13) and excluded paths (#3095).