Skip to content
Open
Show file tree
Hide file tree
Changes from 162 commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
2c197f7
Add CLI command documentation drafts
Mpdreamz Sep 29, 2025
771b84b
organize cli command documentation
Mpdreamz Sep 30, 2025
f72e837
Merge remote-tracking branch 'origin/main' into feature/cli-documenta…
Mpdreamz Sep 30, 2025
335d7a6
stage changes
Mpdreamz Sep 30, 2025
9b65802
Finish documenting cli commands
Mpdreamz Sep 30, 2025
69bf2d2
Cleanup migration
Mpdreamz Sep 30, 2025
1daf6c8
touchups
Mpdreamz Sep 30, 2025
a030f85
stage
Mpdreamz Sep 30, 2025
8ed7a3b
stage
Mpdreamz Sep 30, 2025
0bfe134
First pass of claude over building blocks
Mpdreamz Sep 30, 2025
7887ee2
Expanded building blocks
Mpdreamz Oct 1, 2025
6d7f430
update building blocks
Mpdreamz Oct 1, 2025
9a9f20b
update building blocks
Mpdreamz Oct 1, 2025
0c617c5
Include navigation building blocks
Mpdreamz Oct 1, 2025
e593ff0
Small touchups
Mpdreamz Oct 1, 2025
2e0cfd4
update redirects
Mpdreamz Oct 1, 2025
ea39746
Apply suggestions from code review
Mpdreamz Oct 1, 2025
b3b5309
Sentence case
Mpdreamz Oct 1, 2025
eb5f50d
fix links
Mpdreamz Oct 1, 2025
73d827f
List items full stop
Mpdreamz Oct 1, 2025
9a0d94d
colons in list not dashes
Mpdreamz Oct 1, 2025
d552c73
fix test
Mpdreamz Oct 1, 2025
62e97f7
Start on isolated docset config reader
Mpdreamz Oct 1, 2025
855b2b6
Stage before invoking AI
Mpdreamz Oct 1, 2025
1b3aac0
Start on new isolated navigation building
Mpdreamz Oct 2, 2025
b55e06b
toc nesting restrictions
Mpdreamz Oct 2, 2025
011584c
Continue with documentation set navigation, generated a lot of tests,…
Mpdreamz Oct 2, 2025
0384945
Reorg tests
Mpdreamz Oct 2, 2025
c2d9780
chop of /index
Mpdreamz Oct 2, 2025
8a73ddb
encapsulate more rules
Mpdreamz Oct 2, 2025
273908b
explicitly return IndexFileRef when deserialzing the configuration fo…
Mpdreamz Oct 2, 2025
9a103cc
Read through nested toc.yml file definitions
Mpdreamz Oct 2, 2025
295c823
Brand new navigation.yml deserialization
Mpdreamz Oct 2, 2025
0b7a9b4
Initial version of SiteNavigation
Mpdreamz Oct 2, 2025
1fae41b
Post claude test fixes
Mpdreamz Oct 2, 2025
faf31ea
Start on SiteDocumentationNavigation tests
Mpdreamz Oct 2, 2025
3853d09
stage broken state
Mpdreamz Oct 2, 2025
26daf61
stage
Mpdreamz Oct 2, 2025
5835e21
stage
Mpdreamz Oct 2, 2025
14bcfeb
fix tests manually
Mpdreamz Oct 2, 2025
c23eb1b
path_prefix is required now and added more tests
Mpdreamz Oct 2, 2025
763121e
Stage work on path prefix providers
Mpdreamz Oct 2, 2025
ac68fe5
Stage work tests passing again
Mpdreamz Oct 2, 2025
f079581
Add failing test
Mpdreamz Oct 3, 2025
9345203
Refactor TOC navigation handling to simplify nested validation logic …
Mpdreamz Oct 3, 2025
3358f74
fix tests
Mpdreamz Oct 3, 2025
1f4ffc6
Merge remote-tracking branch 'origin/main' into refactor/navigation
Mpdreamz Oct 3, 2025
0cb96f1
dotnet format namespaces
Mpdreamz Oct 3, 2025
12ce150
dotnet format namespaces
Mpdreamz Oct 3, 2025
754b191
Merge remote-tracking branch 'origin/main' into refactor/navigation
Mpdreamz Oct 3, 2025
baeba6e
Add explicit YamlMember
Mpdreamz Oct 3, 2025
9227e26
inject creating IDocumentationFile
Mpdreamz Oct 3, 2025
c1d81d6
stage
Mpdreamz Oct 3, 2025
00f65d3
Preserve covariance of interface
Mpdreamz Oct 6, 2025
0c5c82a
Start on moving the new navigation into position
Mpdreamz Oct 6, 2025
21de5d8
Started on removing GlobalNavigation
Mpdreamz Oct 6, 2025
903d714
TocItem just reads path (dumb) its up to nav to preserve relative path
Mpdreamz Oct 6, 2025
5a777b8
commit failing test
Mpdreamz Oct 6, 2025
6a77e32
fix deeply linked children, especially those with a parent deep/linke…
Mpdreamz Oct 6, 2025
6a1671d
increased complexity of test
Mpdreamz Oct 6, 2025
916366e
Fix FileInfo property
Mpdreamz Oct 6, 2025
d24e490
Get rid od Markdown.Url, navigation builds urls
Mpdreamz Oct 7, 2025
cd42982
Remove TableOfContentsTree
Mpdreamz Oct 7, 2025
20b3abe
remove CrossLinkNavigationItem
Mpdreamz Oct 7, 2025
19b688b
remove FileNavigationItem
Mpdreamz Oct 7, 2025
d307260
Remove DocumentationGroup
Mpdreamz Oct 7, 2025
1f8e1bc
remove namespace usages
Mpdreamz Oct 7, 2025
d0ec3b0
Move new navigation into place
Mpdreamz Oct 7, 2025
5e46a28
fix compilation of ApiExplorer needs revisiting
Mpdreamz Oct 8, 2025
7cbb599
stage commit
Mpdreamz Oct 8, 2025
ad27f98
stage
Mpdreamz Oct 8, 2025
5871376
Simplify folder and TOC children validation logic
Mpdreamz Oct 8, 2025
3c80da9
Update tests
Mpdreamz Oct 8, 2025
10ab418
Refactor TOC path construction to support TemporaryNavigationPlaceholder
Mpdreamz Oct 8, 2025
154721e
add nested folder back
Mpdreamz Oct 8, 2025
f77d0a0
fix test
Mpdreamz Oct 8, 2025
70faf0b
fix test
Mpdreamz Oct 8, 2025
b6ef3ae
fix test
Mpdreamz Oct 8, 2025
e835527
fix test
Mpdreamz Oct 8, 2025
f2e34ed
Fixing markdown tests
Mpdreamz Oct 8, 2025
070b53a
Fixing markdown tests
Mpdreamz Oct 8, 2025
1056eb4
Esnure path prefix on build context is reflected in the urls
Mpdreamz Oct 8, 2025
d7bdc38
Fix test
Mpdreamz Oct 8, 2025
2b91770
fix typo
Mpdreamz Oct 8, 2025
a545f23
fix tests
Mpdreamz Oct 8, 2025
d6b9a45
fix test
Mpdreamz Oct 8, 2025
43bf080
Fix tests
Mpdreamz Oct 8, 2025
166c494
Fix navigation rendering
Mpdreamz Oct 8, 2025
f658863
Include node navigations in crosslink lookup
Mpdreamz Oct 8, 2025
4bdc904
Fix markdownlookup for nodes
Mpdreamz Oct 8, 2025
7bf47ab
load docs-content correctly
Mpdreamz Oct 9, 2025
6d67338
Remove table of contents old
Mpdreamz Oct 9, 2025
1e458b1
stage
Mpdreamz Oct 15, 2025
0e09f57
stage
Mpdreamz Oct 15, 2025
b09d31b
stage
Mpdreamz Oct 15, 2025
f3d51ad
Add `FileInfoValidationTests` for verifying file navigation items in …
Mpdreamz Oct 15, 2025
cff58f1
stage
Mpdreamz Oct 16, 2025
7f30c01
Focus on DocumentationSetFile Toc paths
Mpdreamz Oct 16, 2025
57755f8
Validate file references in PhysicalDocsetTests and clean up redundan…
Mpdreamz Oct 16, 2025
710b0f8
Validate no diagnostics are emitted in FileInfoValidationTests
Mpdreamz Oct 16, 2025
b945137
Refactor TOC and folder navigation logic in `DocumentationSetNavigati…
Mpdreamz Oct 16, 2025
2ece813
Add test to verify context resolution for TOC and file references in …
Mpdreamz Oct 16, 2025
14805cd
Refactor TOC navigation logic and improve error handling:
Mpdreamz Oct 16, 2025
8d42dc0
Refactor TOC navigation to simplify path handling and improve consist…
Mpdreamz Oct 16, 2025
e7acbe8
Update TOC path expectations and add comments for TOC children limita…
Mpdreamz Oct 16, 2025
8d3d474
stage
Mpdreamz Oct 16, 2025
de695f2
stage
Mpdreamz Oct 16, 2025
4dbcd15
stage
Mpdreamz Oct 16, 2025
9a9eaec
stage
Mpdreamz Oct 16, 2025
822c79c
stage
Mpdreamz Oct 20, 2025
41d7db7
stage
Mpdreamz Oct 20, 2025
3abc92a
Add support for combined folder and file path resolution in Documenta…
Mpdreamz Oct 20, 2025
4293e4f
Add FolderIndexFileRef to handle folder+file combinations:
Mpdreamz Oct 21, 2025
22382ff
Add README that can be used as context.
Mpdreamz Oct 21, 2025
dddf0e4
Emit hints for deep-linking virtual files during validation:
Mpdreamz Oct 21, 2025
f4904ef
Allow TOC references from narrative repository without requiring `pat…
Mpdreamz Oct 21, 2025
afd5456
Added explicit support for folder with an index field
Mpdreamz Oct 21, 2025
060520f
Merge remote-tracking branch 'origin/main' into refactor/navigation
Mpdreamz Oct 22, 2025
ee11a02
Hints and suppresshints
Mpdreamz Oct 22, 2025
c08ac2d
Normalize `sitePrefix` in `SiteNavigation`, update URL handling, and …
Mpdreamz Oct 22, 2025
b2798f9
Ensure documentationset passes path prefix to documentationsetnavigation
Mpdreamz Oct 22, 2025
18eea7a
stage
Mpdreamz Oct 27, 2025
33d65a5
stage
Mpdreamz Oct 28, 2025
e7418d4
stage
Mpdreamz Oct 28, 2025
9bfedf7
stage
Mpdreamz Oct 28, 2025
306941e
Simplify building nodes without intermediary nav items
Mpdreamz Oct 29, 2025
bcaa17f
stage
Mpdreamz Oct 29, 2025
c2700a0
update url logic to be relative conditionally
Mpdreamz Oct 29, 2025
41dc0f2
cache url
Mpdreamz Oct 29, 2025
34fd2cf
Merge remote-tracking branch 'origin/main' into refactor/navigation
Mpdreamz Oct 29, 2025
3051ae2
Index no longer part of NavigationItems
Mpdreamz Oct 29, 2025
bb3d23d
fix some more tests
Mpdreamz Oct 29, 2025
5c3aa55
Ensure nested toc nodes receive index and homeprovider
Mpdreamz Oct 30, 2025
2140ccd
fix some more tests
Mpdreamz Oct 30, 2025
9fa8bd4
stage
Mpdreamz Oct 30, 2025
8b9a01d
fix navigationbuilding integration test
Mpdreamz Oct 30, 2025
5c2af60
Merge remote-tracking branch 'origin/main' into refactor/navigation
Mpdreamz Oct 30, 2025
3589047
clean up
Mpdreamz Oct 30, 2025
67520cc
ensure urls end with / again
Mpdreamz Oct 30, 2025
5a183a5
TestDiagnosticsCollector improvements
Mpdreamz Oct 30, 2025
df73aac
fix test diagnostics compiler issue
Mpdreamz Oct 30, 2025
1cd37b1
fix authoring tests
Mpdreamz Oct 30, 2025
6e310f8
update synthetics tests
Mpdreamz Oct 30, 2025
76936f9
tackle windows test failures
Mpdreamz Oct 30, 2025
2cc020a
fix unit test to allow for windows paths
Mpdreamz Oct 30, 2025
42cf5c0
fix integration tests
Mpdreamz Oct 30, 2025
1d0ba78
fix navigation validation for clashes
Mpdreamz Oct 30, 2025
c3a8cd2
skip test on CI
Mpdreamz Oct 30, 2025
4581ca4
fix windows test
Mpdreamz Oct 30, 2025
3353d01
Fix DocumentationSet.Url for reporting first interesting url
Mpdreamz Oct 30, 2025
b3fdbb6
Allow skipping tests
Mpdreamz Oct 30, 2025
ced9b59
fix windows test
Mpdreamz Oct 30, 2025
65a445e
fix EnsureIsSubpathOf
Mpdreamz Oct 31, 2025
234055b
Fix remaining covariance issues
Mpdreamz Oct 31, 2025
98439f9
Additional cleanups and test fixtures
Mpdreamz Oct 31, 2025
c5f5b15
reorg
Mpdreamz Oct 31, 2025
1c7917a
touchups
Mpdreamz Oct 31, 2025
b182e2f
start on navigation documentation
Mpdreamz Nov 3, 2025
6dcd072
moar docs
Mpdreamz Nov 3, 2025
dcd2c67
moar docs
Mpdreamz Nov 3, 2025
298b6af
Merge remote-tracking branch 'origin/main' into refactor/navigation
Mpdreamz Nov 3, 2025
eb735f8
fix test
Mpdreamz Nov 3, 2025
805101d
fix local build docs errors
Mpdreamz Nov 3, 2025
5ca4d6e
fix cross links
Mpdreamz Nov 3, 2025
bc87360
Fix tests expecting crosslink navigation item
Mpdreamz Nov 3, 2025
9ffca0b
fix bad test assertion
Mpdreamz Nov 3, 2025
368b45e
Merge remote-tracking branch 'origin/main' into refactor/navigation
Mpdreamz Nov 6, 2025
02c9b4a
post merge fixes
Mpdreamz Nov 6, 2025
ae1431e
post merge fixes
Mpdreamz Nov 6, 2025
a463915
Ensure url has no trailing slash
Mpdreamz Nov 6, 2025
74ec7ab
Give SiteNavigation a fixed navigation title
Mpdreamz Nov 6, 2025
79fc59b
Fix smoke test check for trailing slash
Mpdreamz Nov 6, 2025
3c579d4
fix tests expecting trailing slash
Mpdreamz Nov 6, 2025
8afb87e
Re-enable the detection rule extension.
Mpdreamz Nov 7, 2025
2b5132f
assembler build fixes for detection rule files
Mpdreamz Nov 7, 2025
f6cc9c2
Clean up configuration folder
Mpdreamz Nov 7, 2025
acbc5cc
Fix tests
Mpdreamz Nov 7, 2025
1a1c899
Implementsome of copilots feedback
Mpdreamz Nov 7, 2025
73c2d1e
Merge remote-tracking branch 'origin/main' into refactor/navigation
Mpdreamz Nov 7, 2025
985b848
remove left over bad imports
Mpdreamz Nov 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
<PackageVersion Include="Amazon.Lambda.S3Events" Version="3.1.0" />
<PackageVersion Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
<PackageVersion Include="Amazon.Lambda.SQSEvents" Version="2.2.0" />
<PackageVersion Include="AngleSharp" Version="1.1.2" />
<PackageVersion Include="Aspire.Hosting" Version="9.5.2" />
<PackageVersion Include="Aspire.Hosting.Testing" Version="9.4.2" />
<PackageVersion Include="AWSSDK.Core" Version="4.0.1.2" />
<PackageVersion Include="AWSSDK.SQS" Version="4.0.0.1" />
<PackageVersion Include="AWSSDK.S3" Version="4.0.7.14" />
<PackageVersion Include="Elastic.OpenTelemetry" Version="1.1.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
<PackageVersion Include="Generator.Equals" Version="3.2.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageVersion Include="KubernetesClient" Version="17.0.14" />
<PackageVersion Include="Elastic.Aspire.Hosting.Elasticsearch" Version="9.3.0" />
<PackageVersion Include="Elastic.Clients.Elasticsearch" Version="9.1.4" />
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# docs-builder
#ocs-builder

[![ci](https://github.com/elastic/docs-builder/actions/workflows/ci.yml/badge.svg?branch=main&event=push)](https://github.com/elastic/docs-builder/actions/workflows/ci.yml)

Expand Down
2 changes: 2 additions & 0 deletions config/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
phantoms:
- toc: elasticsearch://reference
- toc: docs-content://release-notes
- toc: docs-content://release-notes/elasticsearch-clients
- toc: docs-content://release-notes/apm-agents
- toc: docs-content://
- toc: cloud://release-notes

Expand Down
304 changes: 298 additions & 6 deletions docs-builder.sln

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/_docset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ toc:
- file: index.md
- file: req.md
- folder: nested
children:
- file: index.md
- file: cross-links.md
children:
- title: "Getting Started Guide"
Expand Down
331 changes: 331 additions & 0 deletions docs/development/navigation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,331 @@
# Navigation Documentation

Welcome to the documentation for `Elastic.Documentation.Navigation`, the library that powers documentation navigation for Elastic's documentation sites.

## What This Is

This library builds hierarchical navigation trees for documentation sites with a unique capability: navigation built for isolated repositories can be **efficiently re-homed** during site assembly without rebuilding the entire tree.

**Why does this matter?**

Individual documentation teams can build and test their docs in isolation with URLs like `/api/overview/`, then those same docs can be assembled into a unified site with URLs like `/elasticsearch/api/overview/` - with **zero tree reconstruction**. It's an O(1) operation.

## Documentation Map

Start with any document based on what you want to learn:

### 🎯 [navigation.md](navigation.md) - Start Here
**Overview of the navigation system**

Read this first to understand:
- The two build modes (isolated vs assembler)
- Core concepts at a high level
- Quick introduction to re-homing
- Links to detailed documentation

### 🎨 [visual-walkthrough.md](visual-walkthrough.md) - See It In Action
**Visual tour with diagrams showing navigation structures**

Read this to understand:
- What different node types look like in the tree
- How isolated builds differ from assembler builds visually
- How the same content appears with different URLs
- How to split and reorganize documentation across sites
- Common patterns for multi-repository organization
- Includes actual tree diagrams from this repository

### 🧭 [first-principles.md](first-principles.md) - Design Philosophy
**Core principles that guide the architecture**

Read this to understand:
- Why two-phase loading (configuration → navigation)
- Why URLs are calculated dynamically, not stored
- Why navigation roots can be re-homed
- Design patterns used (factory, provider, visitor)
- Performance characteristics and invariants

### 🔄 [two-phase-loading.md](two-phase-loading.md) - The Loading Process
**Deep dive into Phase 1 (configuration) and Phase 2 (navigation)**

Read this to understand:
- What happens in Phase 1: Configuration resolution
- What happens in Phase 2: Navigation construction
- Why these phases are separate
- Data flow diagrams
- How to test each phase independently

### 🏠 [home-provider-architecture.md](home-provider-architecture.md) - The Re-homing Magic
**How O(1) re-homing works**

Read this to understand:
- The problem: naive re-homing requires O(n) tree traversal
- The solution: HomeProvider pattern with indirection
- How `INavigationHomeProvider` and `INavigationHomeAccessor` work
- Why URLs are lazily calculated and cached
- Detailed examples of re-homing in action
- Performance analysis

**This is the most important technical concept in the system.**

### 📦 [node-types.md](node-types.md) - Node Type Reference
**Complete reference for every navigation node type**

Read this to understand:
- All 7 node types in detail:
- **Leaves**: FileNavigationLeaf, CrossLinkNavigationLeaf
- **Nodes**: FolderNavigation, VirtualFileNavigation
- **Roots**: DocumentationSetNavigation, TableOfContentsNavigation, SiteNavigation
- Constructor signatures
- URL calculation for each type
- Factory methods
- Model types (IDocumentationFile)

### 🔨 [assembler-process.md](assembler-process.md) - Building Unified Sites
**How multiple repositories become one site**

Read this to understand:
- The assembler build process step-by-step
- How `SiteNavigation` works
- Re-homing in practice during assembly
- Path prefix requirements
- Phantom nodes
- Nested re-homing
- Error handling

## Suggested Reading Order

**If you're new to the codebase:**
1. [navigation.md](navigation.md) - Get the overview
2. [visual-walkthrough.md](visual-walkthrough.md) - See it visually
3. [first-principles.md](first-principles.md) - Understand the why
4. [home-provider-architecture.md](home-provider-architecture.md) - Understand the how
5. [node-types.md](node-types.md) - Reference as needed

**If you're debugging an issue:**
1. [node-types.md](node-types.md) - Find the node type
2. [home-provider-architecture.md](home-provider-architecture.md) - Understand URL calculation
3. [two-phase-loading.md](two-phase-loading.md) - Check which phase

**If you're adding a feature:**
1. [first-principles.md](first-principles.md) - Ensure design consistency
2. [node-types.md](node-types.md) - See existing patterns
3. [two-phase-loading.md](two-phase-loading.md) - Determine which phase
4. [assembler-process.md](assembler-process.md) - Consider assembler impact

**If you're optimizing performance:**
1. [home-provider-architecture.md](home-provider-architecture.md) - Understand caching
2. [first-principles.md](first-principles.md) - See performance characteristics
3. [two-phase-loading.md](two-phase-loading.md) - Find expensive operations

## Key Concepts Summary

### Two Build Modes

1. **Isolated Build**
- Single repository
- URLs relative to `/`
- `DocumentationSetNavigation` is the root
- Fast iteration for doc teams

2. **Assembler Build**
- Multiple repositories
- Custom URL prefixes
- `SiteNavigation` is the root
- Docsets/TOCs are re-homed

### Two-Phase Loading

1. **Phase 1: Configuration** (`Elastic.Documentation.Configuration`)
- Parse YAML files
- Resolve all relative paths to absolute paths from docset root
- Validate structure and file references
- Load nested `toc.yml` files
- Output: Fully resolved configuration

2. **Phase 2: Navigation** (`Elastic.Documentation.Navigation`)
- Build tree from resolved configuration
- Establish parent-child relationships
- Set up home providers
- Calculate navigation indexes
- Output: Complete navigation tree

### Home Provider Pattern

The secret to O(1) re-homing:

```csharp
// Provider defines URL context
public interface INavigationHomeProvider
{
string PathPrefix { get; }
IRootNavigationItem<...> NavigationRoot { get; }
}

// Accessor references provider
public interface INavigationHomeAccessor
{
INavigationHomeProvider HomeProvider { get; set; }
}

// Nodes calculate URLs from current provider
public string Url =>
$"{_homeAccessor.HomeProvider.PathPrefix}/{_relativePath}/";
```

**Re-homing:**
```csharp
// Change provider → all URLs update instantly!
node.HomeProvider = new NavigationHomeProvider("/new-prefix", newRoot);
```

### Node Types

7 types organized by capabilities:

**Leaves** (no children):
- `FileNavigationLeaf<TModel>` - Markdown file
- `CrossLinkNavigationLeaf` - External link

**Nodes** (have children):
- `FolderNavigation<TModel>` - Directory
- `VirtualFileNavigation<TModel>` - File with YAML-defined children

**Roots** (can be re-homed):
- `DocumentationSetNavigation<TModel>` - Docset root
- `TableOfContentsNavigation<TModel>` - Nested TOC
- `SiteNavigation` - Assembled site root

## Code Organization

The library is organized into:

### `Elastic.Documentation.Navigation/`
Root namespace - shared types:
- `IDocumentationFile.cs` - Base interface for documentation files
- `NavigationModels.cs` - Common model types (CrossLinkModel, SiteNavigationNoIndexFile)

### `Elastic.Documentation.Navigation/Isolated/`
Isolated build navigation:
- `DocumentationSetNavigation.cs` - Docset root
- `TableOfContentsNavigation.cs` - Nested TOC
- `FolderNavigation.cs` - Folder nodes
- `FileNavigationLeaf.cs` - File leaves
- `VirtualFileNavigation.cs` - Virtual file nodes
- `CrossLinkNavigationLeaf.cs` - Crosslink leaves
- `DocumentationNavigationFactory.cs` - Factory for creating nodes
- `NavigationArguments.cs` - Constructor argument records
- `NavigationHomeProvider.cs` - Home provider implementation

### `Elastic.Documentation.Navigation/Assembler/`
Assembler build navigation:
- `SiteNavigation.cs` - Unified site root

### Supporting Files
- `README.md` - High-level overview (in src/)
- `url-building.md` - URL building rules (in src/)

## Testing

Tests are in `tests/Navigation.Tests/`:

**Isolated build tests:**
- `Isolation/ConstructorTests.cs` - Basic navigation construction
- `Isolation/FileNavigationTests.cs` - File leaf behavior
- `Isolation/FolderIndexFileRefTests.cs` - Folder navigation
- `Isolation/PhysicalDocsetTests.cs` - Real docset loading

**Assembler build tests:**
- `Assembler/SiteNavigationTests.cs` - Site assembly
- `Assembler/SiteDocumentationSetsTests.cs` - Multiple docsets
- `Assembler/ComplexSiteNavigationTests.cs` - Complex scenarios

**Test pattern:**
```csharp
[Fact]
public void FeatureUnderTest_Scenario_ExpectedBehavior()
{
// Arrange: Create mock file system and configuration
var fileSystem = new MockFileSystem();
var config = CreateConfig(...);

// Act: Build navigation
var nav = new DocumentationSetNavigation<IDocumentationFile>(...);

// Assert: Verify behavior
Assert.Equal("/expected/url/", nav.Index.Url);
}
```

## Common Tasks

### Adding a New Node Type

1. Create class in `Isolated/` namespace
2. Implement appropriate interface (`ILeafNavigationItem` or `INodeNavigationItem`)
3. Add factory method if needed
4. Update `ConvertToNavigationItem` in `DocumentationSetNavigation`
5. Add tests in `Isolation/`
6. Update [node-types.md](node-types.md)

### Changing URL Calculation

1. Review [first-principles.md](first-principles.md) - ensure consistency
2. Update `FileNavigationLeaf.Url` property
3. Consider cache invalidation
4. Update tests
5. Update [home-provider-architecture.md](home-provider-architecture.md)

### Modifying Configuration

1. Update classes in `Elastic.Documentation.Configuration`
2. Update `LoadAndResolve` methods
3. Update Phase 2 consumption in navigation classes
4. Update tests for both phases
5. Update [two-phase-loading.md](two-phase-loading.md)

### Debugging Re-homing Issues

1. Check `HomeProvider` assignments in [assembler-process.md](assembler-process.md)
2. Verify `PathPrefix` values
3. Check `NavigationRoot` points to correct root
4. Look for cache issues (HomeProvider ID changed?)
5. Review [home-provider-architecture.md](home-provider-architecture.md)

## Related Documentation

- `Elastic.Documentation.Configuration` - Phase 1 (configuration resolution)
- `Elastic.Documentation.Links` - Cross-link resolution
- `Elastic.Markdown` - Markdown processing

## Source Reference

For the actual implementation, see:
- Library: `src/Elastic.Documentation.Navigation/`
- Tests: `tests/Navigation.Tests/`
- Configuration: `src/Elastic.Documentation.Configuration/`

## Contributing

When making changes:

1. **Maintain invariants** from [first-principles.md](first-principles.md)
2. **Keep phases separate** - don't mix configuration and navigation
3. **Preserve O(1) re-homing** - don't add tree traversals
4. **Add tests** for both isolated and assembler scenarios
5. **Update documentation** in this directory
6. **Run all 111+ tests** - they should all pass

## Questions?

- **"How do URLs get calculated?"** → [home-provider-architecture.md](home-provider-architecture.md)
- **"Why two phases?"** → [two-phase-loading.md](two-phase-loading.md)
- **"What is re-homing?"** → [navigation.md](navigation.md) then [home-provider-architecture.md](home-provider-architecture.md)
- **"Which node type do I need?"** → [node-types.md](node-types.md)
- **"How does the assembler work?"** → [assembler-process.md](assembler-process.md)
- **"What are the design principles?"** → [first-principles.md](first-principles.md)

---

**Welcome to Elastic.Documentation.Navigation!**

The library that makes it possible to build documentation in isolation and efficiently assemble it into unified sites with custom URL structures - no rebuilding required. 🚀
Loading
Loading