Repository navigation
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Tests of fetch-failure diagnostics already go through public APIs. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@copilot resolve the merge conflicts in this pull request |
…ch-errors # Conflicts: # src/Elastic.Documentation.LinkIndex/GitLinkIndexReader.cs # src/Elastic.Documentation.Links/CrossLinks/DocSetConfigurationCrossLinkFetcher.cs Co-authored-by: reakaleek <16325797+reakaleek@users.noreply.github.com>
Resolved — I merged |
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/3894/ |
| if (crossLinks.FetchFailures.Count == 0) | ||
| return; | ||
|
|
||
| collector.EmitError(configurationPath, FormatSummary(crossLinks)); |
There was a problem hiding this comment.
Severity: P3 (Low)
This emits a hard error for every entry in FetchFailures, even when no page in the docset links to that repository. Before this change, a failed or missing link index for a declared cross_links repo only logged a warning, and errors appeared only when an actual cross-link failed to resolve. Now any declared repo that is missing from the link index or can't be fetched fails the build, including repos that are listed but unused, repos not yet published to the index, and transient S3/codex outages. Consider emitting the summary only when at least one cross-link to a failed repo was encountered, or downgrading it to a warning when nothing references the repo.
Generated by Libra. Specialist: libra-complexity. React with 👍 or 👎 to give feedback on this comment.
| var isCodexFailure = repositories.All(repository => | ||
| crossLinks.RegistryByRepository?.GetValueOrDefault(repository) is { } registry | ||
| && registry != DocSetRegistry.Public); | ||
| var distinctReasons = fetchFailures.Values.Distinct(StringComparer.Ordinal).ToArray(); | ||
| var heading = isCodexFailure && distinctReasons.Length == 1 | ||
| ? $"Could not fetch the Elastic Internal Docs link index from {CodexLinkIndexUrl}." |
There was a problem hiding this comment.
Severity: P3 (Low)
isCodexFailure is computed from each entry's declared Registry, not from the reader that was actually used. When useDualRegistry is false (no codex reader, or the docset registry is Public), non-public entries are fetched from the public S3 reader. If that fetch fails, the summary still says "Could not fetch the Elastic Internal Docs link index from https://github.com/elastic/codex-link-index", which sends users toward the wrong root cause. Use crossLinks.CodexRepositories (the repos actually routed to the codex reader) instead.
Generated by Libra. Specialist: libra-complexity. React with 👍 or 👎 to give feedback on this comment.
| if (fetchedCrossLinks.FetchFailures.ContainsKey(crossLinkUri.Scheme)) | ||
| return false; |
There was a problem hiding this comment.
Severity: P3 (Low)
Preserve incremental-build invalidation when suppressing these diagnostics. Failed resolution leaves the original repository-scheme URL in rendered HTML, but no longer marks the containing Markdown file as offending. The summary marks only docset.yml, so a subsequent local build skips unchanged Markdown even after index access is repaired and can succeed with broken links still in its output. Track affected files separately or invalidate generation state whenever a fetch is incomplete.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
| public class CrossLinkFetchFailureTests(ITestOutputHelper output) | ||
| { | ||
| [Fact] | ||
| public void TryResolve_WhenFetchFailed_DoesNotEmitPerLinkError() | ||
| { | ||
| var crossLinks = BuildCrossLinksWithFetchFailure("synthetics-service", "Git clone failed: auth error"); | ||
|
|
||
| string? emittedError = null; | ||
| var resolver = new IsolatedBuildEnvironmentUriResolver(); | ||
| var success = CrossLinkResolver.TryResolve( | ||
| s => emittedError = s, | ||
| crossLinks, | ||
| resolver, | ||
| new Uri("synthetics-service://index.md", UriKind.Absolute), | ||
| out _ | ||
| ); | ||
|
|
||
| success.Should().BeFalse(); | ||
| emittedError.Should().BeNull(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void EmitFetchFailures_EmitsOneSummaryForTheConfigurationFile() | ||
| { | ||
| var collector = new TestDiagnosticsCollector(output); | ||
| var crossLinks = BuildCrossLinksWithFetchFailure( |
There was a problem hiding this comment.
Severity: P2 (Medium)
These tests use xUnit APIs ([Fact], the ITestOutputHelper primary-constructor parameter), but the test projects run on TUnit. They also call new TestDiagnosticsCollector(output), and Elastic.Markdown.Tests.TestDiagnosticsCollector only has a parameterless constructor. The file won't compile, so it breaks the whole Elastic.Markdown.Tests project build and the new regression coverage never runs. Switch to [Test] and new TestDiagnosticsCollector().
Generated by Libra. Specialist: libra-complexity. React with 👍 or 👎 to give feedback on this comment.
| { | ||
| [repository] = DocSetRegistry.Internal | ||
| }.ToFrozenDictionary(), | ||
| FetchFailures = new Dictionary<string, string> { [repository] = failureReason }.ToFrozenDictionary() |
There was a problem hiding this comment.
Severity: P3 (Low)
Add regression coverage that obtains this result from DocSetConfigurationCrossLinkFetcher with a failing ILinkIndexReader. Both new tests populate FetchFailures manually, so they still pass if the production fetcher stops recording failures entirely. Cover a registry-wide exception and a repository-level failure alongside a successful repository, asserting the failure map, IsComplete, and diagnostic suppression from the actual fetched result.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
Why
elastic/codex-link-index.What
Notes
Made with Cursor