Skip to content

Commit 9337910

Browse files
Mpdreamzclaude
andcommitted
fix(tests): remove cli/* redirects; update tests for schema-driven CLI
CLI reference pages are volatile by nature (generated from schema) and were never shipped to production, so their redirects have no value. - Remove all cli/* entries from _redirects.yml - Revert Setup.fs to File.Exists guard (unconditional stubs broke other tests) - Update LinkReferenceFile.fs snapshot to remove stale CLI entries - Update PhysicalDocsetTests to check for CliReferenceRef instead of FolderRef for the cli TOC entry - Skip synthetic files in Move.ProcessMarkdownFile — they have no physical content and ReadAllTextAsync would throw FileNotFoundException Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent c580b57 commit 9337910

5 files changed

Lines changed: 17 additions & 94 deletions

File tree

docs/_redirects.yml

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,6 @@
11
redirects:
22
'migration/freeze/gh-action.md' : 'index.md'
33
'migration/freeze/index.md' : 'index.md'
4-
'cli/mcp.md': 'index.md'
5-
# Legacy cli/release/* redirects — now point to generated changelog command pages
6-
'cli/release/changelog-add.md': 'cli/changelog/add.md'
7-
'cli/release/changelog-evaluate-artifact.md': 'index.md'
8-
'cli/release/changelog-evaluate-pr.md': 'cli/changelog/evaluate-pr.md'
9-
'cli/release/changelog-bundle.md': 'cli/changelog/bundle.md'
10-
'cli/release/changelog-bundle-amend.md': 'cli/changelog/bundle-amend.md'
11-
'cli/release/changelog-gh-release.md': 'cli/changelog/gh-release.md'
12-
'cli/release/changelog-init.md': 'cli/changelog/init.md'
13-
'cli/release/changelog-prepare-artifact.md': 'index.md'
14-
'cli/release/changelog-remove.md': 'cli/changelog/remove.md'
15-
'cli/release/changelog-render.md': 'cli/changelog/render.md'
16-
'cli/release/index.md': 'cli/changelog/index.md'
17-
'cli/docset/index.md': 'cli/index.md'
18-
'cli/docset/build.md': 'cli/build.md'
19-
'cli/docset/diff-validate.md': 'cli/diff.md'
20-
'cli/docset/format.md': 'cli/format.md'
21-
'cli/docset/index-command.md': 'cli/cmd-index.md'
22-
'cli/docset/mv.md': 'cli/mv.md'
23-
'cli/docset/serve.md': 'cli/serve.md'
24-
'cli/assembler/assemble.md': 'cli/assemble.md'
25-
'cli/assembler/assembler-build.md': 'cli/assembler/build.md'
26-
'cli/assembler/assembler-clone.md': 'cli/assembler/clone.md'
27-
'cli/assembler/assembler-config-init.md': 'cli/assembler/config/init.md'
28-
'cli/assembler/assembler-content-source-match.md': 'cli/assembler/content-source/match.md'
29-
'cli/assembler/assembler-content-source-validate.md': 'cli/assembler/content-source/validate.md'
30-
'cli/assembler/assembler-deploy-apply.md': 'cli/assembler/deploy/apply.md'
31-
'cli/assembler/assembler-deploy-plan.md': 'cli/assembler/deploy/plan.md'
32-
'cli/assembler/assembler-deploy-update-redirects.md': 'cli/assembler/deploy/update-redirects.md'
33-
'cli/assembler/assembler-index.md': 'cli/assembler/index.md'
34-
'cli/assembler/assembler-navigation-validate.md': 'cli/assembler/navigation/validate.md'
35-
'cli/assembler/assembler-navigation-validate-link-reference.md': 'cli/assembler/navigation/validate-link-reference.md'
36-
'cli/assembler/assembler-serve.md': 'cli/assembler/serve.md'
37-
'cli/links/index.md': 'cli/inbound-links/index.md'
38-
'cli/links/inbound-links-validate.md': 'cli/inbound-links/validate.md'
39-
'cli/links/inbound-links-validate-all.md': 'cli/inbound-links/validate-all.md'
40-
'cli/links/inbound-links-validate-link-reference.md': 'cli/inbound-links/validate-link-reference.md'
414
'testing/redirects/4th-page.md': 'testing/redirects/5th-page.md'
425
'testing/redirects/9th-page.md': '!testing/redirects/5th-page.md'
436
'testing/redirects/6th-page.md':
@@ -60,4 +23,4 @@ redirects:
6023
"yy": "bb"
6124
'testing/redirects/third-page.md':
6225
anchors:
63-
'removed-anchor':
26+
'removed-anchor':

src/authoring/Elastic.Documentation.Refactor/Move.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ private bool ValidateInputs(string source, string target, out IFileInfo[] fromFi
235235

236236
private async Task ProcessMarkdownFile(ChangeSet changeSet, MarkdownFile value, Cancel ctx)
237237
{
238+
// Synthetic files (e.g. CLI reference pages generated from a schema) have no physical content.
239+
if (!value.SourceFile.Exists)
240+
return;
241+
238242
var source = changeSet.From.FullName;
239243
var target = changeSet.To.FullName;
240244

tests/Elastic.Documentation.Configuration.Tests/PhysicalDocsetTests.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using AwesomeAssertions;
66
using Elastic.Documentation.Configuration.Toc;
7+
using Elastic.Documentation.Configuration.Toc.CliReference;
78

89
namespace Elastic.Documentation.Configuration.Tests;
910

@@ -86,9 +87,12 @@ public void PhysicalDocsetContainsExpectedFolders()
8687
folderNames.Should().Contain("building-blocks");
8788
folderNames.Should().Contain("configure");
8889
folderNames.Should().Contain("syntax");
89-
folderNames.Should().Contain("cli");
9090
folderNames.Should().Contain("migration");
9191
folderNames.Should().Contain("testing");
92+
93+
// cli is a CliReferenceRef (schema-driven), not a FolderRef
94+
var cliRef = docSet.TableOfContents.OfType<CliReferenceRef>().FirstOrDefault();
95+
cliRef.Should().NotBeNull();
9296
}
9397

9498
[Fact]
@@ -108,12 +112,9 @@ public void PhysicalDocsetHasValidNestedStructure()
108112
nestedFolders.Should().Contain("site");
109113
nestedFolders.Should().Contain("content-set");
110114

111-
// Test the cli folder has nested folders
112-
var cliFolder = docSet.TableOfContents.OfType<FolderRef>().First(f => f.PathRelativeToDocumentationSet == "cli");
113-
var cliNestedFolders = cliFolder.Children.OfType<FolderRef>().Select(f => f.PathRelativeToDocumentationSet).ToList();
114-
cliNestedFolders.Should().Contain("docset");
115-
cliNestedFolders.Should().Contain("assembler");
116-
cliNestedFolders.Should().Contain("links");
115+
// cli is a CliReferenceRef (schema-driven), not a FolderRef — verify it has children
116+
var cliRef = docSet.TableOfContents.OfType<CliReferenceRef>().First();
117+
cliRef.Children.Should().NotBeEmpty();
117118
}
118119

119120
[Fact]

tests/authoring/Framework/Setup.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ navigation_title: Stub
162162
let destPath = Path.Combine(mockDocsRoot, normalized)
163163

164164
// Tests supply their own minimal pages; do not replace them with production content.
165-
// Always add a stub for any local redirect target not already present — this covers both
166-
// physical pages and synthetic pages (e.g. CLI reference pages generated from a schema).
167-
// Actual redirect correctness is validated by the production build, not authoring tests.
168165
if not (fileSystem.File.Exists destPath) then
169-
fileSystem.AddFile(destPath, MockFileData(stubMarkdown)))
166+
let sourcePath = Path.Combine(repoRoot, "docs", normalized)
167+
168+
if File.Exists sourcePath then
169+
fileSystem.AddFile(destPath, MockFileData(stubMarkdown)))
170170

171171
[<AutoOpen>]
172172
type TestFile =

tests/authoring/Generator/LinkReferenceFile.fs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,6 @@ Through various means $$$including-this-inline-syntax$$$
6464
},
6565
"url_path_prefix": "",
6666
"links": {
67-
"cli/changelog/add.md": {},
68-
"cli/changelog/bundle-amend.md": {},
69-
"cli/changelog/bundle.md": {},
70-
"cli/changelog/evaluate-pr.md": {},
71-
"cli/changelog/gh-release.md": {},
72-
"cli/changelog/index.md": {},
73-
"cli/changelog/init.md": {},
74-
"cli/changelog/remove.md": {},
75-
"cli/changelog/render.md": {},
7667
"file.md": {},
7768
"index.md": {
7869
"anchors": [
@@ -102,42 +93,6 @@ Through various means $$$including-this-inline-syntax$$$
10293
"migration/freeze/index.md": {
10394
"to": "index.md"
10495
},
105-
"cli/mcp.md": {
106-
"to": "index.md"
107-
},
108-
"cli/release/changelog-add.md": {
109-
"to": "cli/changelog/add.md"
110-
},
111-
"cli/release/changelog-evaluate-artifact.md": {
112-
"to": "index.md"
113-
},
114-
"cli/release/changelog-evaluate-pr.md": {
115-
"to": "cli/changelog/evaluate-pr.md"
116-
},
117-
"cli/release/changelog-bundle.md": {
118-
"to": "cli/changelog/bundle.md"
119-
},
120-
"cli/release/changelog-bundle-amend.md": {
121-
"to": "cli/changelog/bundle-amend.md"
122-
},
123-
"cli/release/changelog-gh-release.md": {
124-
"to": "cli/changelog/gh-release.md"
125-
},
126-
"cli/release/changelog-init.md": {
127-
"to": "cli/changelog/init.md"
128-
},
129-
"cli/release/changelog-prepare-artifact.md": {
130-
"to": "index.md"
131-
},
132-
"cli/release/changelog-remove.md": {
133-
"to": "cli/changelog/remove.md"
134-
},
135-
"cli/release/changelog-render.md": {
136-
"to": "cli/changelog/render.md"
137-
},
138-
"cli/release/index.md": {
139-
"to": "cli/changelog/index.md"
140-
},
14196
"testing/redirects/4th-page.md": {
14297
"to": "testing/redirects/5th-page.md"
14398
},

0 commit comments

Comments
 (0)