You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2026/09/20 14:21:44 UTC
(skywalking-ai-sessionizer) 14/23: Hold docs/menu.yml to the pages it indexes
This is an automated email from the ASF dual-hosted git repository.
wu-sheng pushed a commit to branch langchain-harness
in repository https://gitbox.apache.org/repos/asf/skywalking-ai-sessionizer.git
commit 6643ee6e446fcbe06cc13facbb14daea806fa99e
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Sun Sep 20 20:39:05 2026 +0800
Hold docs/menu.yml to the pages it indexes
The website builds its navigation from that file, so an entry with no page is
a broken link for every reader, and a page in no entry is one nobody can reach
from the site at all. Neither appears in a build here: the pages are Markdown,
nothing compiles them, and the mistake only shows once the documentation is
published.
The test reads it both ways and was checked against both mistakes: dropping an
entry, and pointing one at a name that is not there.
---
tests/docs_test.go | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/tests/docs_test.go b/tests/docs_test.go
index 8124e7d..cc54cef 100644
--- a/tests/docs_test.go
+++ b/tests/docs_test.go
@@ -18,8 +18,10 @@
package tests_test
import (
+ "io/fs"
"os"
"path/filepath"
+ "strings"
"testing"
"time"
@@ -76,3 +78,53 @@ func TestDocumentExampleIsCurrent(t *testing.T) {
t.Fatalf("%s is not what the fixture scenario produces now; run make asz-view-example and commit the result", path)
}
}
+
+// TestTheMenuAndThePagesAgree holds the index to the pages, both ways.
+//
+// docs/menu.yml is what the website builds its navigation from, so an entry
+// with no page is a broken link for every reader, and a page with no entry is
+// one nobody can reach from the site at all. Neither shows up in a build here:
+// the pages are Markdown, nothing compiles them, and the failure only appears
+// once the documentation is published.
+func TestTheMenuAndThePagesAgree(t *testing.T) {
+ raw, err := os.ReadFile(filepath.Join("..", "docs", "menu.yml"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ // One path per line, which is how the file is written and how the
+ // website reads it. A full YAML parse would add a dependency for the one
+ // field this needs.
+ listed := map[string]bool{}
+ for _, line := range strings.Split(string(raw), "\n") {
+ _, value, ok := strings.Cut(strings.TrimSpace(line), "path:")
+ if !ok {
+ continue
+ }
+ path := strings.TrimSpace(value)
+ if path == "" || path == "/readme" {
+ continue
+ }
+ page := filepath.Join("..", "docs", filepath.FromSlash(path)+".md")
+ if _, err := os.Stat(page); err != nil {
+ t.Errorf("the menu lists %s, and %s is not there", path, page)
+ continue
+ }
+ listed[page] = true
+ }
+ if len(listed) == 0 {
+ t.Fatal("the menu lists no page")
+ }
+ err = filepath.WalkDir(filepath.Join("..", "docs", "en"), func(path string, d fs.DirEntry, err error) error {
+ if err != nil || d.IsDir() || !strings.HasSuffix(path, ".md") {
+ return err
+ }
+ if !listed[path] {
+ t.Errorf("%s is a page nobody can reach: it is in no menu entry", path)
+ }
+ return nil
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Logf("%d pages, each listed once and each present", len(listed))
+}