1
0
Fork 0
portfolio-optimiser-commons/examples/nav-golden-hierarchy
Kjell Tore Guttormsen b6417414c8 docs(examples): nav-golden fixture class — bundle → read-context goldens
New fixture class for the D4 step-0 split (commons-owned; delivered into
catalog's corpus/runner). A nav-golden case is bundle in / expected-read-
context out — the shape that expresses "two conformant implementations MUST
produce an identical read-context" (method-spec §3 Step 1).

- nav-golden-hierarchy/ (positive): depth-first first-seen order, both link
  forms (/ = bundle root vs relative), one segment per level, resolved-path
  dedup, cycle termination, recursive verdict exclusion, missing-index binds
  root alone, flat render.
- nav-golden-escape/ (negative, gate must go red): .. escapes and a
  /etc/passwd root-relative trap; conformant returns only valid.md.

Both expected-read-context.md verified byte-for-byte against a conformant
navigator implementing §3 Step 1; the negative case verified to diverge
under a naive navigator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VUCuNNvnCkayuUDy2WFgeU
2026-07-21 10:22:50 +02:00
..
bundle docs(examples): nav-golden fixture class — bundle → read-context goldens 2026-07-21 10:22:50 +02:00
expected-read-context.md docs(examples): nav-golden fixture class — bundle → read-context goldens 2026-07-21 10:22:50 +02:00
README.md docs(examples): nav-golden fixture class — bundle → read-context goldens 2026-07-21 10:22:50 +02:00

nav-golden-hierarchy — hierarchical navigation golden

Fixture class nav-golden (commons-owned, per the D4 step-0 split): bundle/ in, expected-read-context.md out. Unlike the ingest-golden class (ingest-spec §11, extraction-shaped: manifest.jsonexpected-bundle/), a nav-golden case is bundle → read-context — the only shape that can express the load-bearing property "two conformant implementations MUST produce an identical read-context from the same bundle" (method-spec §3 Step 1).

This positive case exercises every decision the Q3 navigation contract pins:

Decision (method-spec §3 Step 1) How this bundle exercises it
Hierarchy allowed; escape, not depth, forbidden a/, a/b/ are navigated; nothing escapes
Link syntax: leading / = bundle root, else relative index.md: relative overview.md + root-relative /a/index.md; a/index.md: relative b/index.md + root-relative /overview.md
Depth-first, first-seen order render order is overviewdoc-adoc-b
Dedup on resolved path /overview.md (from a/) resolves to the already-seen overview.md → one entry
Cycle termination a/b/index.md links back to /a/index.md (already seen) → stops
One segment per level each index links only its immediate children
Missing index.md binds the root alone c/ has no index.md and nothing links c/orphan.md; it is simply unreachable, not an error
Verdict exclusion = type check per reached file, recursive a/verdict-nested.md is reached but excluded
Flat render regardless of depth nested concepts render as the same ## {type}: {title} sections; no level heading; nested index bodies are navigation, not content, and are not rendered

Traversal trace: index.md (its body is the leading summary) → overview.md/a/index.mda/doc-a.mda/verdict-nested.md (reached, excluded) → a/b/index.mda/b/doc-b.md/a/index.md (seen, deduped) → /overview.md (seen, deduped). Unreachable: c/orphan.md.

Serialization the gate compares against: the root index body verbatim, then each non-index concept as ## {type}: {title} + blank line + the file body, sections separated by one blank line, file ending in exactly one trailing newline. The spec does not pin whitespace beyond this shape; a gate MAY compare byte-exact or after trailing-whitespace normalization. Only the root index body is the summary — nested index bodies (a/index.md, a/b/index.md) are navigation and do not appear.