From fcc321e13f24c0f13279e7a84fa39bde3f282cd4 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Thu, 22 Oct 2026 16:10:14 +0200 Subject: [PATCH 1/2] Stop hardcoding DeepLinkingVirtualFile suppression for docs-content tocs The nested toc.yml files in docs-content now declare `suppress:` themselves, so the temporary path list in `DocumentationSetFile` is dead weight. Co-Authored-By: Claude Sonnet 5.5 --- .../Toc/DocumentationSetFile.cs | 19 --------- .../Isolation/ValidationTests.cs | 42 +++++++++++++++++++ 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs b/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs index 21ec8313cc..e3b537e528 100644 --- a/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs +++ b/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs @@ -368,25 +368,6 @@ private static TableOfContents ResolveTableOfContents( var tocYaml = fileSystem.File.ReadAllText(tocFilePath); var nestedTocFile = TableOfContentsFile.Deserialize(tocYaml, collector, tocFilePath); - // this is temporary after this lands in main we can update these files to include - // suppress: - // - DeepLinkingVirtualFile - string[] skip = - [ - "docs-content/solutions/toc.yml", - "docs-content/manage-data/toc.yml", - "docs-content/explore-analyze/toc.yml", - "docs-content/deploy-manage/toc.yml", - "docs-content/troubleshoot/toc.yml", - "docs-content/troubleshoot/ingest/opentelemetry/toc.yml", - "docs-content/reference/security/toc.yml" - ]; - - var path = tocFilePath.OptionalWindowsReplace(); - // Hardcode suppression for known problematic files - if (skip.Any(f => path.Contains(f, StringComparison.OrdinalIgnoreCase))) - _ = nestedTocFile.SuppressDiagnostics.Add(HintType.DeepLinkingVirtualFile); - // Recursively resolve children with the FULL TOC path as the parent path // This ensures all file paths within the TOC include the TOC directory path // The context for children is the toc.yml file that defines them diff --git a/tests/Navigation.Tests/Isolation/ValidationTests.cs b/tests/Navigation.Tests/Isolation/ValidationTests.cs index 1bc45a6b1a..920b66670b 100644 --- a/tests/Navigation.Tests/Isolation/ValidationTests.cs +++ b/tests/Navigation.Tests/Isolation/ValidationTests.cs @@ -207,6 +207,48 @@ public async Task ValidationEmitsHintForDeepLinkingVirtualFiles() ); } + [Test] + public async Task NestedToc_UnderFormerlyHardcodedPathWithoutSuppress_EmitsDeepLinkingHint() + { + var diagnostics = await LoadNestedDeepLinkingToc(suppress: false); + + diagnostics.Should().Contain( + d => d.Severity == Severity.Hint && d.File.EndsWith("solutions/toc.yml") && d.Message.Contains( + "a/b/overview.md" + ) && d.Message.Contains("deep-linking") + ); + } + + [Test] + public async Task NestedToc_UnderFormerlyHardcodedPathWithSuppress_DoesNotEmitDeepLinkingHint() + { + var diagnostics = await LoadNestedDeepLinkingToc(suppress: true); + + diagnostics.Should().NotContain(d => d.Message.Contains("deep-linking")); + } + + private async Task> LoadNestedDeepLinkingToc(bool suppress) + { + var suppressYaml = suppress ? "suppress:\n - DeepLinkingVirtualFile\n" : ""; + var tocYaml = suppressYaml + "toc:\n" + " - file: a/b/overview.md\n" + " children:\n" + " - file: a/b/setup.md\n"; + + var fileSystem = new MockFileSystem(); + fileSystem.AddDirectory("/docs-content"); + fileSystem.AddFile("/docs-content/solutions/toc.yml", new MockFileData(tocYaml)); + var context = CreateContext(fileSystem); + var docSet = DocumentationSetFile.LoadAndResolve( + context.Collector, + "project: 'test-project'\ntoc:\n - toc: solutions\n", + fileSystem.NewDirInfo("docs-content") + ); + _ = context.Collector.StartAsync(TestContext.Current!.Execution.CancellationToken); + + _ = new DocumentationSetNavigation(docSet, context, GenericDocumentationFileFactory.Instance); + + await context.Collector.StopAsync(TestContext.Current!.Execution.CancellationToken); + return context.Diagnostics; + } + [Test] public async Task ValidationEmitsHintForNestedPathVirtualFiles() { From 9275a61a69306c7ffa57d5a7bfa41e6a00ed4086 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 4 Nov 2026 19:35:51 +0100 Subject: [PATCH 2/2] Match the toc file path in a separator-agnostic way in the hint test The Windows build reports `solutions\toc.yml`, so the `EndsWith("solutions/toc.yml")` check failed there. The test now normalises backslashes before comparing. Co-Authored-By: Claude Sonnet 5.5 --- tests/Navigation.Tests/Isolation/ValidationTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Navigation.Tests/Isolation/ValidationTests.cs b/tests/Navigation.Tests/Isolation/ValidationTests.cs index 920b66670b..26545b8ab2 100644 --- a/tests/Navigation.Tests/Isolation/ValidationTests.cs +++ b/tests/Navigation.Tests/Isolation/ValidationTests.cs @@ -213,7 +213,7 @@ public async Task NestedToc_UnderFormerlyHardcodedPathWithoutSuppress_EmitsDeepL var diagnostics = await LoadNestedDeepLinkingToc(suppress: false); diagnostics.Should().Contain( - d => d.Severity == Severity.Hint && d.File.EndsWith("solutions/toc.yml") && d.Message.Contains( + d => d.Severity == Severity.Hint && d.File.Replace('\\', '/').EndsWith("solutions/toc.yml") && d.Message.Contains( "a/b/overview.md" ) && d.Message.Contains("deep-linking") );