LearnNewsExamplesConnect
Frontmatter
assigneesneo-gemini-julia
createdAtNov 11, 2026, 12:47 PM
updatedAtNov 11, 2026, 3:57 PM
githubUrlhttps://github.com/neomjs/neo/issues/20774
authorneo-gemini-julia
commentsCount0
parentIssue20671
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 11, 2026, 3:57 PM

Fail-closed SEO/LLM artifact verification and tree/childapp/release sync

Closed v14.0.0/archive-v14-0-0-chunk-1 enhancementaitestingbuildportal
neo-gemini-julia
neo-gemini-julia commented on Nov 11, 2026, 12:47 PM

Context

Engine 13.5 Cornerstone #4 (#20671, Search engines and agents find and classify neomjs.com) requires the sitemap index, seo.json, and llms*.txt surfaces to stay structurally coherent and fail closed on drift across every release and content-sync rebuild (buildScripts/docs/rebuildContentIndexesAndSeo.mjs).

After ai/scripts/lint/* (#12247, #12522) moved out of neomjs/neo during the Brain repository split, the Engine's own SEO/LLM derivation bundle has no pre-write cross-artifact verifier, and direct source inspection of buildScripts/docs/ surfaces four live defects:

  1. Silent missing-leaf skips in learn/tree.json: Unlike collectBlogRoutes (buildScripts/docs/seo/generate.mjs:671-673), which throws naming a missing blog.json markdown file, collectRoutesFromTree (generate.mjs:537-540), getLlmsFullTxt (generate.mjs:1300-1305), and getSeoJson (buildScripts/docs/seo/seoJson.mjs:456-461) silently continue when a learn/tree.json content leaf (isLeaf !== false && !node.route) points at a non-existent learn/<id>.md.
  2. Process-global ROOT_DIR reads in generate.mjs: generate.mjs:32-39 hardcodes ROOT_DIR = process.cwd() (LEARN_DIR, PORTAL_DIR, TREE_FILE_PATH, RELEASES_PATH, BLOG_INDEX_PATH), so collectAllRoutes, getSitemapXml, and getLlmsTxt read process.cwd() files even when rebuildContentIndexesAndSeo({root, ...}) passes an explicit root.
  3. Singular /childapp/ popup windows leaking into sitemap-core.xml and llms.txt: collectExampleRoutes (generate.mjs:591) filters !file.includes('childapps') (plural only), leaking singular multi-window popup helper entrypoints (examples/component/multiWindowCoronaGallery/childapp/index.html and examples/component/multiWindowHelix/childapp/index.html, live at apps/portal/llms.txt:75,77) that cannot run standalone.
  4. Literal : Update placeholder titles & unverified interleaved writes: createReleaseIndex (buildScripts/docs/index/release.mjs:42,100-105) declares @property {String} title in JSDoc yet never extracts frontmatter.title || frontmatter.name or the H1 # ... heading into releases.json, causing getLlmsTxt (generate.mjs:1108) to emit - [v13.3.1 (2026-10-23): Update](...) (apps/portal/llms.txt:29). Meanwhile, rebuildContentIndexesAndSeo (rebuildContentIndexesAndSeo.mjs:124-178) writes each of the 7 outputs interleaved without validating cross-artifact invariants first.

Design authority: Cornerstone #4 epic #20671 and ROADMAP.md (Engine 13.5 — The Front Door). Excluded from good first issue: steward-owned Cornerstone #4 pipeline gate claimed for immediate implementation in this session.

The Problem

When rebuildContentIndexesAndSeo runs in publish.mjs or data-sync-pipeline.yml, any drift between learn/tree.json, seo.json, sitemap-core.xml, sitemap-archive.xml, sitemap.xml, and llms*.txt — or a failure midway through generating the 7 outputs — either ships broken URLs/generic metadata to neomjs.com or leaves half-written artifacts on disk.

The Architectural Reality

  • buildScripts/docs/seo/generate.mjs is already 1,462 lines (near check-file-sizes.mjs's 1,500-line yellow threshold; #20688 extracted seoJson.mjs for this reason), so the cross-artifact verifier belongs in a dedicated sibling module buildScripts/docs/seo/verify.mjs.
  • learn/tree.json contains 126 leaf records (isLeaf !== false), 125 of which resolve to learn/<id>.md and 1 of which ({id: 'ApiDocs', name: 'API Docs', route: '/docs'} at learn/tree.json:146) is an intentional top-level route redirect (Boolean(node.route)). Fail-closed leaf validation must require learn/<id>.md iff node.isLeaf !== false && !node.route.
  • .github/RELEASE_NOTES/v13.4.0.md stores its release title in frontmatter.name (Neo.mjs v13.4.0 Release Notes) and # Neo.mjs v13.4.0 Release Notes.
  • test/playwright/unit/buildScripts/docs/RebuildContentIndexesAndSeo.spec.mjs injects synthetic stub strings ('sitemap-result', '<xml />', 'llms') via *Fn seams on root: '/repo' to test orchestration order, so rebuildContentIndexesAndSeo should expose a verifySeoArtifactsFn seam (defaulting to verifySeoArtifacts when default SEO generators run, or when explicitly supplied/enabled via verifyArtifacts) while buffering all 7 writeFileSync calls until generation and verification complete.

Pre-Flight (structural fast-path): authoring buildScripts/docs/seo/verify.mjs matches sibling pattern of buildScripts/docs/seo/seoJson.mjs and buildScripts/docs/seo/generate.mjs in buildScripts/docs/seo/; sibling-file-lift applies; no novel directory choice. Pre-Flight (structural fast-path): authoring test/playwright/unit/buildScripts/docs/seo/Verify.spec.mjs matches sibling pattern of test/playwright/unit/buildScripts/docs/seo/Generate.spec.mjs in test/playwright/unit/buildScripts/docs/seo/; sibling-file-lift applies; no novel directory choice.

The Fix

  1. buildScripts/docs/seo/generate.mjs & buildScripts/docs/seo/seoJson.mjs:
    • Fail closed (throwing an Error naming node.id and expected markdown path) when any learn/tree.json leaf without node.route (node.isLeaf !== false && !node.route) lacks learn/<id>.md across collectRoutesFromTree, getLlmsFullTxt, and getSeoJson, while skipping redirect leaves carrying node.route.
    • Thread root (and optional learnDir, treeFilePath, blogIndexPath, releasesPath) through collectAllRoutes, collectTopLevelRoutes, collectRoutesFromTree, collectExampleRoutes, collectBlogRoutes, getSitemapXml, and getLlmsTxt instead of reading process.cwd() globals.
    • Tighten collectExampleRoutes child-window exclusion from !file.includes('childapps') to !/\/childapps?\//.test(file) (and normalized relative segments !(?:^|\/)childapps?(?:\/|$)/) so singular /childapp/ popup helper HTML files are excluded alongside /childapps/.
  2. buildScripts/docs/index/release.mjs:
    • Extract title from frontmatter.title || frontmatter.name or the first # ... markdown heading (parsed.content) and include ...(title && {title}) on emitted release leaf records so getLlmsTxt renders real release titles in ## Latest Updates instead of : Update.
  3. buildScripts/docs/seo/verify.mjs & buildScripts/docs/rebuildContentIndexesAndSeo.mjs:
    • Author verifySeoArtifacts validating in memory:
      • sitemap-core.xml and llms.txt contain zero archive routes (/news/{tickets,pulls,discussions}/) and zero duplicate <loc> entries; sitemap-archive.xml contains exclusively archive routes with zero duplicates; sitemap.xml references both child sitemaps.
      • Every non-static-file Portal route in sitemap-core.xml (excluding static .html app/example entrypoints) has an entry in seo.json with non-empty title and description, and deep routes (pathname !== '/' && pathname !== '/home') never fall back to bare 'Neo.mjs'.
      • Every ${baseUrl}/raw/*.md link in llms.txt and llms-full.txt (and llms-all.txt when supplied) resolves to an existing markdown file under root (learn/**), releaseNotesRoot (raw/news/releases/<ver>.md -> v<ver>.md / <ver>.md, including chunk-* subfolders), or corpusRoot (raw/news/{tickets,pulls,discussions}/<id>.md -> {issues,pulls,discussions} or archive/**).
    • Update rebuildContentIndexesAndSeo.mjs to pass root to getSitemapXmlFn and getLlmsTxtFn, generate all 7 artifacts in memory, run verifySeoArtifactsFn, and execute the 7 writeFileSync calls only after verification succeeds.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
verifySeoArtifacts(options) in buildScripts/docs/seo/verify.mjs This ticket (#20671 leaf) Validates seoJson, sitemapCoreXml, sitemapArchiveXml, sitemapIndexXml, llmsTxt, llmsFullTxt, and optional llmsAllTxt against archive separation, seo.json coverage, and /raw/*.md target existence; throws actionable Error on violation None (fail-closed) Module/function JSDoc (@summary) Verify.spec.mjs + RebuildContentIndexesAndSeo.spec.mjs
rebuildContentIndexesAndSeo(options) in buildScripts/docs/rebuildContentIndexesAndSeo.mjs buildScripts/docs/rebuildContentIndexesAndSeo.mjs:74-190 Buffers all 7 generated outputs, runs verifySeoArtifactsFn before writing when default generators or verifyArtifacts: true are active, and writes zero SEO files if any generator or verification check fails Test seams overriding SEO generators skip real-filesystem verification unless verifyArtifacts: true or verifySeoArtifactsFn is passed JSDoc on rebuildContentIndexesAndSeo RebuildContentIndexesAndSeo.spec.mjs
collectRoutesFromTree / getLlmsFullTxt / getSeoJson generate.mjs:533,1284, seoJson.mjs:413 Throws naming leaf id and expected path when a learn/tree.json leaf (isLeaf !== false && !node.route) lacks learn/<id>.md; honors options.root Redirect leaves with node.route (e.g. ApiDocs) are intentionally skipped JSDoc updates Generate.spec.mjs
createReleaseIndex(options) in buildScripts/docs/index/release.mjs buildScripts/docs/index/release.mjs:60-106 Populates title on release leaf records from frontmatter.title || frontmatter.name or # ... H1 Omits title when neither frontmatter nor H1 exists @typedef ReleaseNote JSDoc ReleaseIndex.spec.mjs + Generate.spec.mjs

Decision Record impact: none

Acceptance Criteria

  • AC-1: collectRoutesFromTree, getLlmsFullTxt, and getSeoJson throw naming the leaf id when any learn/tree.json leaf without node.route (isLeaf !== false && !node.route) lacks learn/<id>.md (while preserving redirect leaves with node.route such as ApiDocs), and generate.mjs resolves root, learnDir, treeFilePath, blogIndexPath, and releasesPath from options instead of hardcoded process.cwd() globals.
  • AC-2: collectExampleRoutes excludes singular /childapp/ as well as plural /childapps/ popup helper windows (examples/component/multiWindow*/childapp/index.html no longer appear in generated sitemap-core.xml or llms.txt), and createReleaseIndex populates title from frontmatter.title || frontmatter.name or the H1 heading so getLlmsTxt emits real release titles instead of : Update.
  • AC-3: buildScripts/docs/seo/verify.mjs exports verifySeoArtifacts enforcing: (a) archive separation and duplicate-free <loc> URLs across sitemap-core.xml, sitemap-archive.xml, sitemap.xml, and llms.txt; (b) non-empty seo.json title + description coverage (and non-bare 'Neo.mjs' titles on deep routes) for every non-static-file Portal route in sitemap-core.xml; and (c) filesystem existence of every ${baseUrl}/raw/*.md target across root, releaseNotesRoot, and corpusRoot.
  • AC-4: rebuildContentIndexesAndSeo buffers all 7 SEO/LLM file writes until generation and verifySeoArtifacts succeed (writing nothing on failure), and unit tests in Verify.spec.mjs, Generate.spec.mjs, ReleaseIndex.spec.mjs, and RebuildContentIndexesAndSeo.spec.mjs cover positive and negative cases plus a real-checkout fixture run.

Out of Scope

  • Regenerating or hand-editing committed pipeline outputs (apps/portal/sitemap*.xml, apps/portal/llms*.txt, apps/portal/resources/data/seo.json, apps/portal/resources/data/releases.json), which are updated by data-sync-pipeline.yml and publish.mjs against the external conversation corpus (#19501).
  • Re-introducing learn/tree.json nav-group cohesion/phantom-group lints (#12247, hosted in neomjs/neo-agent-brain).
  • Deciding index, follow vs noindex, follow policy for /news/{tickets,pulls}/* crawler snapshots (tracked as an open question on #20671 pending Search Console coverage exports).

Avoided Traps

  • Adding verification logic directly to buildScripts/docs/seo/generate.mjs: generate.mjs is already 1,462 lines (#20688); keeping cross-artifact validation in buildScripts/docs/seo/verify.mjs preserves clean single-responsibility boundaries and stays well clear of check-file-sizes.mjs.
  • Treating ApiDocs (route: '/docs') in learn/tree.json as a missing markdown file: learn/tree.json:146 carries {id: 'ApiDocs', route: '/docs'} with no learn/ApiDocs.md; checking !node.route avoids false positives on redirect leaves.
  • Reading frontmatter.title only in release.mjs: Engine release notes (.github/RELEASE_NOTES/v13.4.0.md) stamp name: Neo.mjs v13.4.0 Release Notes in frontmatter rather than title:.

Related

  • Parent Epic: #20671 (Engine 13.5 Cornerstone #4)
  • Completed Sibling Leaves: #20688, #20700, #20715, #20727
  • Historical Predecessors (pre-Brain split): #12247, #12522, #19501, #20089

Live latest-open + closed sweep: checked latest 20 open (#20696–#20773, 36 open total — orange band, folded as single-PR sub-issue under existing Cornerstone #4 epic #20671) + closed search (sitemap childapp OR verifySeoArtifacts OR tree.json missing leaf, Out of Scope / Avoided Traps read on #12522, #12247, #19501) at 2026-11-11T11:45Z; no equivalent open ticket or prior exclusion found (#12247/#12522 lived in ai/scripts/lint/ before the Brain split and excluded generate.mjs). A2A sweep: list_messages({status: 'all', projection: 'compact', limit: 30}) checked at 2026-11-11T11:44Z; zero overlapping [lane-claim] or [lane-intent]. MC sweep: "learn tree.json missing markdown leaf childapp index.html Latest Updates Update raw link" (5 results) + ask_knowledge_base (type: 'ticket'), no prior exclusion found. Own-assignment sweep: 3 open (#20762 & #20757 both in APPROVED PRs #20764 & #20763 awaiting human merge; parent epic #20671), none overlapping.

Origin Session ID: 3b4d3f8f-c078-4cee-8876-b0db074a5c04 Retrieval Hint: "verifySeoArtifacts rebuildContentIndexesAndSeo tree.json missing leaf childapp release title Update"

tobiu referenced in commit 560776b - "feat(seo): add pre-write artifact verifier and sync tree/childapp/release routes (#20774) (#20775) on Nov 11, 2026, 3:57 PM
tobiu closed this issue on Nov 11, 2026, 3:57 PM