LearnNewsExamplesConnect
Frontmatter
assigneesneo-gemini-julia
createdAtNov 14, 2026, 3:43 PM
updatedAtNov 14, 2026, 5:20 PM
githubUrlhttps://github.com/neomjs/neo/issues/20945
authorneo-gemini-julia
commentsCount1
parentIssue20671
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 14, 2026, 5:20 PM

Drop client-side seo.json fetch and dist copy from Portal SPA

Closed v14.0.0/archive-v14-0-0-chunk-2 enhancementaiarchitectureperformancebuildportal
neo-gemini-julia
neo-gemini-julia commented on Nov 14, 2026, 3:43 PM

Context

Parent epic: #20671 (Search engines and agents find and classify neomjs.com, Engine 14 Cornerstone 4 in ROADMAP.md).

Operator direction (2026-11-14, Option 2): apps/portal/resources/data/seo.json was originally small (~10 top-level routes) when Portal.service.Seo (apps/portal/service/Seo.mjs) was written for the client-side Portal SPA. Following #20688, #20700, #20727, #20915, #20917, and #20919, seo.json now indexes every /learn/* guide, /news/blog/* post, /news/releases/* note, /examples/* family, and pre-baked lastmod date (61.4 KB on dev, 74 KB on #20931, and growing linearly with content), while neomjs/middleware-v2 (SsrService#buildHeadInjection, #20700) already serves route-specific <title>, <meta name="description">, <link rel="canonical">, og:*, and data-schema-name="neo-route" JSON-LD directly from node_modules/neo.mjs/apps/portal/resources/data/seo.json for crawlers and agent HTTP fetches.

Ownership disposition: self-assigned maintainer lane per operator alignment (good first issue / help wanted omitted because this change touches cross-build asset exclusion, CI test-scope classification, and open #20671 Portal SEO stack coordination).

The Problem

  1. Unnecessary eager payload on every client SPA boot (apps/portal/service/Seo.mjs:126-138):
    • A human visitor opening a single hash route in the multi-window Portal SPA downloads and parses the entire seo.json corpus (61 KB+ and growing) during Seo#initAsync().
    • Search crawlers (Googlebot, LLM bots) never navigate #/... hash routes and only parse SSR HTML snapshots produced by neomjs/middleware-v2, making client-side <meta name="description">, <link rel="canonical">, og:*, and data-schema-name="neo-route" ld+json mutations (Seo.mjs:170-204) pure main-thread DOM churn over worker IPC.
  2. Redundant browser dist/* copies (webpack + dist/esm):
    • buildScripts/webpack/development/webpack.config.appworker.mjs:42, buildScripts/webpack/production/webpack.config.appworker.mjs:50-60, and buildScripts/build/esmodules.mjs:68-70 copy and re-minify apps/portal/resources/data/seo.json into dist/{development,production,esm}/apps/portal/resources/data/, even though no browser consumer needs it once Portal.service.Seo stops fetching it.
  3. CI E2E false-positive fan-out (.github/workflows/classify-test-scope.yml:423-451):
    • classify-test-scope.yml:424 explicitly keeps seo.json inside the 14-shard E2E trigger set ('seo.json' loads on every route, mirrored in WorkflowScopeClassifier.spec.mjs:956), causing content/SEO index updates to boot all 14 browser E2E shards.

The Architectural Reality

  • Design authority: #20671 Intended solution shape §1 ("every canonical Portal route on neomjs.com ... serves route-specific SSR metadata, structured schema, and clean semantic HTML") + operator architectural ruling (2026-11-14: drop seo.json from the non-SSR client SPA while retaining it in source/npm for Node SSR/SSG consumers).
  • Server/SSG consumers (neomjs/middleware-v2, neomjs/pages, buildScripts/docs/seo/*): neomjs/middleware-v2 reads node_modules/neo.mjs/apps/portal/resources/data/seo.json (src/service/SsrService.mjs:67, src/build.mjs:82), and buildScripts/docs/rebuildContentIndexesAndSeo.mjs / generate.mjs / verify.mjs read and write apps/portal/resources/data/seo.json directly. Keeping apps/portal/resources/data/seo.json in git and the published npm package preserves every SSR/SSG consumer untouched.
  • Client SPA human UX (apps/portal/service/Seo.mjs, DocumentHead#setTitle): Human browsers and detached multi-window Portal tabs only use document.title (DocumentHead.setTitle({value, windowId})). Top-level sections, /news/* tabs, and /examples/* family routes are a tiny fixed set (~20 entries, < 1 KB), while deep leaf controllers (learn/MainContainerController.mjs, news/blog/MainContainerController.mjs, news/release/MainContainerController.mjs) already hold the active leaf record (record.name / record.id) in memory from their own tree stores.
  • Single-definition dist/* asset boundary (buildScripts/util/distAppAssets.mjs): Both webpack app-worker configs and buildScripts/build/esmodules.mjs already share distAppAssets.mjs so browser build inclusion/exclusion rules cannot drift across dist/development, dist/production, and dist/esm.
  • E2E spec coupling (test/playwright/e2e/portal/ConnectNL.spec.mjs:34-36 & VideosNL.spec.mjs:54): Both specs assert route-specific document.title ('Connect with Neo.mjs' and 'Neo.mjs Videos'), while ConnectNL.spec.mjs:35-36 previously asserted client-side <meta name="description"> mutation and must now verify that apps/portal/index.html's static shell <meta name="description"> remains intact on client navigation.

The Fix

  1. Make Portal.service.Seo zero-fetch and title-only (apps/portal/service/Seo.mjs + leaf controllers):
    • Remove initAsync()'s fetch(Neo.config.basePath + 'apps/portal/resources/data/seo.json'), #metadata, #lastRoute, afterSetIsReady, and crawler-only DocumentHead.update payload construction (canonicalUrl, description, ldJson, og:*).
    • Provide synchronous getTitle(route) over the static top-level, /news/*, and /examples/* route map with parent-segment fallback, plus onRouteChanged({hashString, hash, windowId}) and setRouteTitle({route, title, windowId}) calling DocumentHead.setTitle({value: title, windowId}) guarded by a per-windowId active-route map so late async store loads cannot overwrite a newer route's title.
    • Wire learn/MainContainerController.mjs, news/blog/MainContainerController.mjs, and news/release/MainContainerController.mjs to refine the window title from the selected leaf record (${record.name} - Neo.mjs / Neo.mjs v${record.id} Release Notes).
  2. Exclude server-only Portal SEO JSON files from browser dist/* builds (buildScripts/util/distAppAssets.mjs, buildScripts/util/copyFolder.mjs, webpack.config.appworker.mjs, buildScripts/build/esmodules.mjs):
    • Define DIST_EXCLUDED_APP_RESOURCES (apps/portal/resources/data/seo.json, apps/portal/resources/data/ssg-archive-routes.json) + isExcludedDistResource / excludedResourcesFor in buildScripts/util/distAppAssets.mjs.
    • Add -x, --exclude <value> support to buildScripts/util/copyFolder.mjs (skipping excluded paths on copy and removing stale copies in the target folder), wire both webpack appworker configs to pass excludedResourcesFor(resourcesPath), and gate buildScripts/build/esmodules.mjs minifyDirectory on !isExcludedDistResource(normalizedInput).
  3. Narrow CI E2E scope classifier & update unit/E2E tests (.github/workflows/classify-test-scope.yml, WorkflowScopeClassifier.spec.mjs, distAppAssets.spec.mjs, Seo.spec.mjs, ConnectNL.spec.mjs):
    • Update .github/workflows/classify-test-scope.yml so server-only Portal data (seo.json, ssg-archive-routes.json) alongside blog.json no longer triggers the 14-shard E2E tier, backed by an executable reachability tripwire in WorkflowScopeClassifier.spec.mjs verifying no apps/portal/**/*.mjs or E2E spec references seo.json or ssg-archive-routes.json.
    • Update Seo.spec.mjs, distAppAssets.spec.mjs, and ConnectNL.spec.mjs.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
Portal.service.Seo (apps/portal/service/Seo.mjs) apps/portal/view/ViewportController.mjs:239, #20671 Synchronous zero-fetch getTitle(route), onRouteChanged, and setRouteTitle updating only DocumentHead.setTitle({value, windowId}) Parent-segment static title fallback ('/news/tickets/123' -> 'Neo.mjs Tickets') JSDoc @summary on Portal.service.Seo Seo.spec.mjs, ConnectNL.spec.mjs, VideosNL.spec.mjs
apps/portal/resources/data/seo.json packaging vs dist/* buildScripts/util/distAppAssets.mjs, neomjs/middleware-v2 SsrService.mjs:67 Retained in git & npm package; excluded from dist/{development,production,esm} Missing seo.json in dist/* never queried by browser JSDoc in distAppAssets.mjs distAppAssets.spec.mjs, verify.mjs
.github/workflows/classify-test-scope.yml WorkflowScopeClassifier.spec.mjs:956,1027 apps/portal/resources/data/{seo.json,ssg-archive-routes.json} excluded from run_e2e while still running unit verification Reachability tripwire fails unit CI if browser/E2E code ever references seo.json Inline rule block in classify-test-scope.yml WorkflowScopeClassifier.spec.mjs

Decision Record impact: aligned-with adr:0007 (Map vs. World Atlas) and aligned-with adr:0018 (preserves apps/portal/index.html static shell head untouched).

Acceptance Criteria

  • Portal.service.Seo makes zero fetch() requests on startup or route navigation, updates only DocumentHead.setTitle({value, windowId}) (preserving multi-window windowId isolation and ignoring stale async leaf updates after route transitions), and leaves <meta name="description">, <link rel="canonical">, og:*, and data-schema-name="neo-organism" JSON-LD untouched in the client SPA.
  • Deep leaf navigation in Learn, Blog, and Releases updates document.title from the active tree record without fetching seo.json, while top-level, /news/*, and /examples/* routes resolve their section titles synchronously ('Connect with Neo.mjs', 'Neo.mjs Videos', etc.).
  • apps/portal/resources/data/seo.json remains intact for buildScripts/docs/seo/*, neomjs/pages, and neomjs/middleware-v2, while distAppAssets.mjs, copyFolder.mjs, both webpack.config.appworker.mjs configs, and buildScripts/build/esmodules.mjs exclude seo.json and ssg-archive-routes.json from dist/{development,production,esm}.
  • .github/workflows/classify-test-scope.yml excludes apps/portal/resources/data/{seo.json,ssg-archive-routes.json} from run_e2e, guarded by an executable reachability tripwire in WorkflowScopeClassifier.spec.mjs.
  • node buildScripts/docs/seo/verify.mjs, Seo.spec.mjs, distAppAssets.spec.mjs, WorkflowScopeClassifier.spec.mjs, ConnectNL.spec.mjs, and VideosNL.spec.mjs pass.

Out of Scope

  • Modifying Neo.main.addon.DocumentHead (src/main/addon/DocumentHead.mjs), which remains a general-purpose engine addon for Neo.mjs applications.
  • Changing how neomjs/middleware-v2 (SsrService.mjs) or buildScripts/docs/seo/* generate and consume apps/portal/resources/data/seo.json.

Avoided Traps

  • Option 1 — Splitting seo.json into 170+ per-route JSON files: Adds file-tree/build churn and per-navigation XHR waterfall latency solely to mutate crawler tags that no crawler ever reads on #/... hash routes.
  • Option 3 — Serving per-route metadata from a neomjs.com middleware endpoint to the SPA: Couples local npm run server-start and offline/self-hosted builds to production neomjs.com AJAX calls (or CORS/404 fallbacks) for crawler-only tags.
  • Deleting apps/portal/resources/data/seo.json from the repository or npm package: Breaks neomjs/middleware-v2 (node_modules/neo.mjs/apps/portal/resources/data/seo.json) and neomjs/pages (rebuildContentIndexesAndSeo.mjs).

Related

Parent: #20671 · Related: #20688, #20700, #20915, #20917 (PR #20929), #20919 (PR #20931)

Live latest-open + closed sweep: checked latest 30 open issues in neomjs/neo (#20943 down) + closed search (seo.json, read Out of Scope and Avoided Traps on #20688 and #20700) at 2026-11-14T14:41Z; no open duplicate or conflicting exclusion found (#20700 moved crawler <head> authority into middleware-v2, enabling this client-SPA removal). Backlog: 50 open, orange band (10 existing subs on parent #20671; linked as child leaf). A2A in-flight claim sweep: checked latest 30 messages across all read-states at 2026-11-14T14:41Z; no competing claim on Portal.service.Seo or seo.json. MC sweep: query_raw_memories on "seo.json Portal SPA eager fetch all routes client performance non-SSR", 5 results (65203744, e462389a, aad115b0), aligned with SSR-only crawler indexing decision. Own-assignment sweep: 3 open in neomjs/neo (#20671, #20917, #20919), bodies read; orthogonal to #20917/#20919 seo.json content updates (note: #20931 touches Seo.mjs only if rebased; clean against dev). Structure map: N/A (Engine/Portal repository; zero new .mjs files created).

Origin Session ID: 2f084437-cc03-4b7b-aace-a27bff4aa3f9 Retrieval Hint: "Portal.service.Seo drop client seo.json fetch distAppAssets classify-test-scope Option 2 #20671"

tobiu referenced in commit 3eeaa0e - "feat(portal): drop client seo.json fetch and dist copy (#20945) (#20948) on Nov 14, 2026, 5:20 PM
tobiu closed this issue on Nov 14, 2026, 5:20 PM