Skip to content

feat(docs-site): ship the model explorer as one browser app with a 3D map - #668

Merged
dmealing merged 11 commits into
mainfrom
fm/mo-130-explorer-3d-live
Nov 28, 2026
Merged

dmealing merged 11 commits into
mainfrom
fm/mo-130-explorer-3d-live

Conversation

@dmealing

@dmealing dmealing commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Supersedes #667: that PR conflicted with main after #666 landed, so the explorer app ships here together with the 3D map and the running-application view.

What Changed

  • docs-site: the model explorer is one browser app. docsSiteFile() writes a shell, the app bundle (explorer-app/, copied into every port), Cytoscape 3.30.2, and three data files (explorer.json, explorer-model.js, explorer-stamp.js) in place of a page per screen. The app draws each page on visit, works from file://, and reloads when meta gen changes the model (stamp polled about once a second). output: "static" keeps the page-per-screen export.
  • docs-site: 3D model map. The map gets a View control that switches to a 3D view drawn from the same nodes, edges and colouring. 3d-force-graph 1.77.0 loads only when the reader picks 3D.
  • runtime-ts: GET {apiPrefix}/_meta/docs serves the loaded model's docs view. Opt-in on Fastify and Hono, with ETag and 304 support and optional allowOrigin. Open the app with index.html?source=<url> to follow a running application's model.

Generated-output change: regenerate with meta gen to replace the explorer pages. Ejected themes on 1.3.0 candidates need re-ejecting (meta eject docs-site --force). Building the explorer bundle requires Bun 1.3.14, which is now the declared package manager.

Proof (carried from #667: the explorer app)

Page-for-page equality against the old static site

The old site was built with main's code at 86a0b03 (an archive of the base commit). The new pages were
drawn by the committed bundle (assets/explorer-app.js) running in a Node VM, from the
explorer-model.js the new generator writes. Script tags that load Cytoscape are normalised,
because the app's shell loads it once for every page.

Model Old pages Identical explorer.json identical Map data identical Files written, old → app
shop (explorer-conformance) 28 28/28 yes yes 32 → 8
crm (explorer-conformance) 22 22/22 yes yes 26 → 8
fitness (persistence canonical) 71 71/71 yes yes 75 → 8
a downstream adopter estate (143 metadata files) 838 838/838 yes yes 842 → 8

test/explorer-app.test.ts repeats this check for the three fixtures on every run, against the static export from the same sources.

Headless Chrome from file:// (CDP)

Check shop adopter estate
First draw 63 ms 136 ms
Nav-bar link → map, Cytoscape canvases drawn 3 canvases, 8 nodes 3 canvases, 190 nodes
Map control writes query into route #/map.html?colour=claims same
Model index → package → object (real link clicks) yes, object mini-map drawn yes
Back, back, forward correct page each time correct page each time
Search box → result click 17 results → #/model/acme/shop/Order.html 25 results, hit opens
Cross-page member link #/model/acme/shop/Order.html#m-reference, scrolled to member n/a
Unknown route "No such page" same
Console errors / exceptions none none

Live update

With the page open, the test rewrote explorer-model.js and explorer-stamp.js with a changed title and never touched the page.

shop adopter estate
Edit visible after 204 ms 769 ms
Route kept yes yes
Scroll kept yes (400 → 400) yes (400 → 400)
Revert visible after ~1.0 s ~1.1 s

The poll interval is 1 s, so any delay up to about 1 s is expected.

Proof (this PR: the 3D map and the running-application view)

A TypeScript fixture application (Fastify, mountMetaRoute + mountMetaDocsRoute under /api, the shop model from fixtures/explorer-conformance/, allowOrigin: "*") ran on localhost. The explorer app was opened from file:// as index.html?source=http://127.0.0.1:<port>/api/_meta/docs in headless Chrome, driven over CDP with real mouse events. This covers the browser scenario the Test step's table marks untested.

3D toggle

Check Result
App live on the endpoint 63 ms, 8 nodes; corner note "Following the running application at …/api/_meta/docs"
View control choices 2D, 3D; opens in 2D
Switch to 3D drawn in 64 ms; #cy hidden, #g3d shown with a WebGL canvas, 4 nodes and 1 link in the default slice; route #/map.html?colour=cap&view=3d; the 3D library loaded on demand (no script tag in the page)
One click on the Order node side panel shows acme::shop · entity and its claims; route unchanged
Second click on the same node opened #/model/acme/shop/Order.html in 51 ms
Back #/map.html?colour=cap&view=3d, 3D drawn again
Switch back to 2D #/map.html?colour=cap; Cytoscape canvas shown, 3D view hidden and emptied

The toggle was also driven with chrome-devtools-axi (open, set View to 3D, inspect): canvas present, 4 nodes, 1 link, route view=3d.

Following a running application

Step Result
Stop the fixture application corner note turned to "Cannot read …/api/_meta/docs (Failed to fetch), showing the model it last served; trying again every second" after 1.0 s; the open page (model/index.html) kept
Add an entity Coupon to the model, restart the application page showed Coupon 768 ms after the restart, with no reload (navigation entries 1); nodes 8 → 9; route kept
Open the Coupon page heading Coupon, its description shown
curl the route 200 with ETag, Cache-Control: no-cache and the CORS headers; repeated with If-None-Match → 304, 0 bytes

The route serves the model the application loaded and never re-reads metadata files; following edits on disk is the file app's job (above), and a reload of the running application is the host's (a watcher or restart), which the app follows.

The pipeline took 1 run: three review rounds (two fix rounds) and one Test fix round (docs only).

Validation

Risk Assessment

✅ Low: The only change since the last review is a one-line edit: root packageManager now declares bun@1.3.14, matching every workflow pin and EXPLORER_APP_BUN, plus a changelog fragment in the correct format. Nothing else reads packageManager, and the earlier fixes (F4 fixture oracle, F7 optional ETag in the contract, F8 ?title= removal) are confirmed in the current code.

Testing

Baseline affected-lanes run passed. Live, against the real runtime-ts route on a disposable Fastify server bound to localhost: the docs body matches the independent model-alone oracle byte for byte, a poll with the current ETag returns 304, and a restarted server serves an edited model copy. Edit-without-restart was not tested because the operator decided it is out of scope. The browser explorer app (file:// and ?source=) was not driven, so it is untested. Servers were stopped, the worktree is clean, and no processes remain.

  • Live validation: ✅ go - 3 of 4 scenarios driven live against the product
Scenario Result Live Evidence
GET /_meta/docs on a loaded model-alone project returns the docs view, byte-identical to the independent oracle fixtures/explorer-conformance/model-alone/expected.json ✅ pass live docs-route-model-alone.json (cmp identical); docs-route-headers.txt
Poll with the current ETag gets 304 Not Modified ✅ pass live curl -H If-None-Match with the ETag from docs-route-headers.txt returned 304
After a model edit, a restarted application serves the new model (Author renamed Writer) ✅ pass live docs-route-after-restart.json contains acme::library::Writer and no acme::library::Author
Browser explorer app reads /_meta/docs via ?source= and renders from file:// ⏸️ untested no No browser was driven in this turn to load explorer-app index.html with ?source=. The route itself was driven live. The browser step is needed to close the intent's app-level scenario.
Evidence: Docs route body, model-alone (live, served by runtime-ts route)
{
  "format": "metaobjects-docs-view/1",
  "sources": {
    "requirements": false,
    "files": false,
    "routes": false
  },
  "counts": {
    "nodes": 3,
    "packages": 1,
    "requirements": 0,
    "functional": 0,
    "architectural": 0,
    "byStatus": [
      {
        "status": "planned",
        "count": 0
      },
      {
        "status": "live",
        "count": 0
      },
      {
        "status": "partial",
        "count": 0
      },
      {
        "status": "retired",
        "count": 0
      }
    ],
    "claims": 0,
    "files": 0,
    "routes": 0,
    "undecided": 0,
    "coverageMeasured": false,
    "entitiesClaimed": 0,
    "entitiesTotal": 0
  },
  "packages": [
    {
      "name": "acme::library",
      "count": 3,
      "groups": [
        {
          "type": "object",
          "subType": "entity",
          "count": 3,
          "nodes": [
            {
              "label": "Author",
              "id": "acme::library::Author",
              "path": "model/acme/library/Author.html",
              "kind": "object.entity",
              "unresolved": false
            },
            {
              "label": "BaseEntity",
              "id": "acme::library::BaseEntity",
              "path": "model/acme/library/BaseEntity.html",
              "kind": "object.entity",
              "unresolved": false
            },
            {
              "label": "Book",
              "id": "acme::library::Book",
              "path": "model/acme/library/Book.html",
              "kind": "object.entity",
              "unresolved": false
            }
          ]
        }
      ]
    }
  ],
  "nodes": [
    {
      "id": "acme::library::Author",
      "name": "Author",
      "package": "acme::library",
      "type": "object",
      "subType": "entity",
      "order": 1,
      "path": "model/acme/library/Author.html",
      "title": "",
      "description": "",
      "summary": "",
      "abstract": false,
      "extends": {
        "label": "BaseEntity",
        "id": "acme::library::BaseEntity",
        "path": "model/acme/library/BaseEntity.html",
        "kind": "object.entity",
        "unresolved": false
      },
      "attrs": [],
      "memberGroups": [
        {
          "type": "field",
          "count": 2,
          "members": [
            {
              "id": "acme::library::Author.id",
              "name": "id",
              "type": "field",
              "subType": "uuid",
              "order": 0,
              "anchor": "m-id",
              "path": "model/acme/library/Author.html#m-id",
              "abstract": false,
              "isArray": false,
              "extends": null,
              "declaredOn": {
                "label": "BaseEntity",
                "id": "acme::library::BaseEntity",
                "path": "model/acme/library/BaseEntity.html",
                "kind": "object.entity",
                "unresolved": false
              },
              "attrs": [],
              "refs": [],
              "claims": [],
              "memberGroups": []
            },
            {
              "id": "acme::library::Author.name",
              "name": "name",
              "type": "field",
              "subType": "string",
              "order": 2,
              "anchor": "m-name",
              "path": "model/acme/library/Author.html#m-name",
              "abstract": false,
              "isArray": false,
              "extends": null,
              "declaredOn": null,
              "attrs": [
                {
                  "name": "required",
                  "value": true,
                  "values": [
                    {
                      "text": "true",
                      "link": null
                    }
                  ]
                }
              ],
              "refs": [],
              "claims": [],
              "memberGroups": []
            }
          ]
        },
        {
          "type": "identity",
          "count": 1,
          "members": [
            {
              "id": "acme::library::Author.pk",
              "name": "pk",
              "type": "identity",
              "subType": "primary",
              "order": 1,
              "anchor": "m-identity-pk",
              "path": "model/acme/library/Author.html#m-identity-pk",
              "abstract": false,
              "isArray": false,
              "extends": null,
              "declaredOn": {
                "label": "BaseEntity",
                "id": "acme::library::BaseEntity",
                "path": "model/acme/library/BaseEntity.html",
                "kind": "object.entity",
                "unresolved": false
              },
              "attrs": [
                {
                  "name": "fields",
                  "value": [
                    "id"
                  ],
                  "values": [
                    {
                      "text": "id",
                      "link": null
                    }
                  ]
                }
              ],
              "refs": [],
              "claims": [],
              "memberGroups": []
            }
          ]
        },
        {
          "type": "source",
          "count": 1,
          "members": [
            {
              "id": "acme::library::Author.db",
              "name": "db",
              "type": "source",
              "subType": "rdb",
              "order": 3,
              "anchor": "m-source-db",
              "path": "model/acme/library/Author.html#m-source-db",
              "abstract": false,
              "isArray": false,
              "extends": null,
              "declaredOn": null,
              "attrs": [
                {
                  "name": "table",
                  "value": "authors",
                  "values": [
                    {
                      "text": "authors",
                      "link": null
                    }
                  ]
                }
              ],
              "refs": [],
              "claims": [],
              "memberGroups": []
            }
          ]
        }
      ],
      "refs": [
        {
          "attr": "extends",
          "via": null,
          "target": {
            "label": "BaseEntity",
            "id": "acme::library::BaseEntity",
            "path": "model/acme/library/BaseEntity.html",
            "kind": "object.entity",
            "unresolved": false
          }
        }
      ],
      "referencedBy": [
        {
          "attr": "references",
          "from": {
            "label": "Book",
            "id": "acme::library::Book",
            "path": "model/acme/library/Book.html",
            "kind": "object.entity",
            "unresolved": false
          },
          "via": {
            "label": "Book.authorRef",
            "id": "acme::library::Book.authorRef",
            "path": "model/acme/library/Book.html#m-identity-authorRef",
            "kind": "identity.reference",
            "unresolved": false
          },
          "target": {
            "label": "Author",
            "id": "acme::library::Author",
            "path": "model/acme/library/Author.html",
            "kind": "object.entity",
            "unresolved": false
          }
        }
      ],
      "claims": [],
      "files": [],
      "routes": [],
      "unclaimed": false,
      "counts": {
        "members": 4,
        "refs": 1,
        "referencedBy": 1,
        "claims": 0,
        "files": 0,
        "routes": 0
      }
    },
    {
      "id": "acme::library::BaseEntity",
      "name": "BaseEntity",
      "package": "acme::library",
      "type": "object",
      "subType": "entity",
      "order": 0,
      "path": "model/acme/library/BaseEntity.html",
      "title": "",
      "description": "",
      "summary": "",
      "abstract": true,
      "extends": null,
      "attrs": [],
      "memberGroups": [
        {
          "type": "field",
          "count": 1,
          "members": [
            {
              "id": "acme::library::BaseEntity.id",
              "name": "id",
              "type": "field",
              "subType": "uuid",
              "order": 0,
              "anchor": "m-id",
  

... [3212 bytes truncated] ...

",
        "unresolved": false
      },
      "attrs": [],
      "memberGroups": [
        {
          "type": "field",
          "count": 3,
          "members": [
            {
              "id": "acme::library::Book.id",
              "name": "id",
              "type": "field",
              "subType": "uuid",
              "order": 0,
              "anchor": "m-id",
              "path": "model/acme/library/Book.html#m-id",
              "abstract": false,
              "isArray": false,
              "extends": null,
              "declaredOn": {
                "label": "BaseEntity",
                "id": "acme::library::BaseEntity",
                "path": "model/acme/library/BaseEntity.html",
                "kind": "object.entity",
                "unresolved": false
              },
              "attrs": [],
              "refs": [],
              "claims": [],
              "memberGroups": []
            },
            {
              "id": "acme::library::Book.title",
              "name": "title",
              "type": "field",
              "subType": "string",
              "order": 2,
              "anchor": "m-title",
              "path": "model/acme/library/Book.html#m-title",
              "abstract": false,
              "isArray": false,
              "extends": null,
              "declaredOn": null,
              "attrs": [
                {
                  "name": "required",
                  "value": true,
                  "values": [
                    {
                      "text": "true",
                      "link": null
                    }
                  ]
                }
              ],
              "refs": [],
              "claims": [],
              "memberGroups": []
            },
            {
              "id": "acme::library::Book.authorId",
              "name": "authorId",
              "type": "field",
              "subType": "uuid",
              "order": 3,
              "anchor": "m-authorId",
              "path": "model/acme/library/Book.html#m-authorId",
              "abstract": false,
              "isArray": false,
              "extends": null,
              "declaredOn": null,
              "attrs": [],
              "refs": [],
              "claims": [],
              "memberGroups": []
            }
          ]
        },
        {
          "type": "identity",
          "count": 2,
          "members": [
            {
              "id": "acme::library::Book.pk",
              "name": "pk",
              "type": "identity",
              "subType": "primary",
              "order": 1,
              "anchor": "m-identity-pk",
              "path": "model/acme/library/Book.html#m-identity-pk",
              "abstract": false,
              "isArray": false,
              "extends": null,
              "declaredOn": {
                "label": "BaseEntity",
                "id": "acme::library::BaseEntity",
                "path": "model/acme/library/BaseEntity.html",
                "kind": "object.entity",
                "unresolved": false
              },
              "attrs": [
                {
                  "name": "fields",
                  "value": [
                    "id"
                  ],
                  "values": [
                    {
                      "text": "id",
                      "link": null
                    }
                  ]
                }
              ],
              "refs": [],
              "claims": [],
              "memberGroups": []
            },
            {
              "id": "acme::library::Book.authorRef",
              "name": "authorRef",
              "type": "identity",
              "subType": "reference",
              "order": 4,
              "anchor": "m-identity-authorRef",
              "path": "model/acme/library/Book.html#m-identity-authorRef",
              "abstract": false,
              "isArray": false,
              "extends": null,
              "declaredOn": null,
              "attrs": [
                {
                  "name": "fields",
                  "value": [
                    "authorId"
                  ],
                  "values": [
                    {
                      "text": "authorId",
                      "link": null
                    }
                  ]
                },
                {
                  "name": "references",
                  "value": "acme::library::Author",
                  "values": [
                    {
                      "text": "acme::library::Author",
                      "link": {
                        "label": "Author",
                        "id": "acme::library::Author",
                        "path": "model/acme/library/Author.html",
                        "kind": "object.entity",
                        "unresolved": false
                      }
                    }
                  ]
                }
              ],
              "refs": [
                {
                  "attr": "references",
                  "via": {
                    "label": "Book.authorRef",
                    "id": "acme::library::Book.authorRef",
                    "path": "model/acme/library/Book.html#m-identity-authorRef",
                    "kind": "identity.reference",
                    "unresolved": false
                  },
                  "target": {
                    "label": "Author",
                    "id": "acme::library::Author",
                    "path": "model/acme/library/Author.html",
                    "kind": "object.entity",
                    "unresolved": false
                  }
                }
              ],
              "claims": [],
              "memberGroups": []
            }
          ]
        },
        {
          "type": "source",
          "count": 1,
          "members": [
            {
              "id": "acme::library::Book.db",
              "name": "db",
              "type": "source",
              "subType": "rdb",
              "order": 5,
              "anchor": "m-source-db",
              "path": "model/acme/library/Book.html#m-source-db",
              "abstract": false,
              "isArray": false,
              "extends": null,
              "declaredOn": null,
              "attrs": [
                {
                  "name": "table",
                  "value": "books",
                  "values": [
                    {
                      "text": "books",
                      "link": null
                    }
                  ]
                }
              ],
              "refs": [],
              "claims": [],
              "memberGroups": []
            }
          ]
        }
      ],
      "refs": [
        {
          "attr": "extends",
          "via": null,
          "target": {
            "label": "BaseEntity",
            "id": "acme::library::BaseEntity",
            "path": "model/acme/library/BaseEntity.html",
            "kind": "object.entity",
            "unresolved": false
          }
        },
        {
          "attr": "references",
          "via": {
            "label": "Book.authorRef",
            "id": "acme::library::Book.authorRef",
            "path": "model/acme/library/Book.html#m-identity-authorRef",
            "kind": "identity.reference",
            "unresolved": false
          },
          "target": {
            "label": "Author",
            "id": "acme::library::Author",
            "path": "model/acme/library/Author.html",
            "kind": "object.entity",
            "unresolved": false
          }
        }
      ],
      "referencedBy": [],
      "claims": [],
      "files": [],
      "routes": [],
      "unclaimed": false,
      "counts": {
        "members": 6,
        "refs": 2,
        "referencedBy": 0,
        "claims": 0,
        "files": 0,
        "routes": 0
      }
    }
  ],
  "requirements": [],
  "advisories": [],
  "slices": [
    {
      "id": "package:acme::library",
      "kind": "package",
      "anchor": "acme::library",
      "nodes": [
        "acme::library::Author",
        "acme::library::BaseEntity",
        "acme::library::Book"
      ]
    }
  ]
}
Evidence: Docs route response headers (ETag, Cache-Control)
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
ETag: "4c8c-0068e2ba"
Cache-Control: no-cache
Date: Sat, 28 Nov 2026 00:23:17 GMT
Content-Length: 19596

  • Evidence: Docs route body after restart on edited model: contains acme::library::Writer and no acme::library::Author (kept with the run, not attached)
Evidence: Driver script used to serve the route
import { join } from "node:path";
import { MetaDataLoader, buildDocsView, serializeDocsView } from "{run-worktree}/server/typescript/packages/metadata/src/index.ts";
import { mountMetaDocsRoute } from "{run-worktree}/server/typescript/packages/runtime-ts/src/fastify/index.ts";
import Fastify from "fastify";
const WT = "{run-worktree}";
const project = process.argv[2];
const port = Number(process.argv[3]);
const loaded = await MetaDataLoader.fromDirectory(join(project, "metaobjects"), { strict: true });
const root = loaded.root ?? loaded;
const app = Fastify();
mountMetaDocsRoute({ fastify: app as any, root: root as any });
await app.listen({ port, host: "127.0.0.1" });
console.log("LISTENING", port);
  • Outcome: 🔧 2 issues found → auto-fixed ✅ across 2 runs (14m47s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 5 issues (2 warnings, 3 infos)
  • ℹ️ server/typescript/packages/codegen-ts/src/generators/docs-site-file.ts:69 - Inline fix. The assetBase doc comment said a static explorer loads only Cytoscape from the mirror. site.ts also loads 3d-force-graph.min.js from that base and ships neither copy. The comment now names both libraries.
  • ℹ️ server/typescript/packages/runtime-ts/src/meta-endpoint.ts:52 - Inline fix. The metaDocsJson JSDoc said the body is "the same bytes as the explorer.json a docs-site build writes". A meta gen docs-site build passes the verify ledger and the run's generation manifest into buildDocsView, so its explorer.json differs whenever the project has requirements or other generators. The comment now says the two match only when the build had neither.
  • ⚠️ scripts/ci-local.sh:1128 - Two checks compare the committed bundle byte for byte against a fresh Bun.build({ minify: true }): gate_explorer_app_drift (build-app.ts --check) and the ts-unit test "explorer-app/ is what the sources build" (server/typescript/packages/docs-site/test/explorer-app.test.ts:89). Minified output follows the Bun version. The workflows pin 1.3.14, but root package.json declares packageManager: bun@1.3.8 and engines.bun &gt;=1.3.0. A contributor on the declared 1.3.8 who touches nothing in the explorer can therefore get a red gate and a red unit test whenever the two minifiers disagree. I did not reproduce a difference; the coupling is the risk. Remedy: make the bundle independent of the Bun version, for example build it unminified for the check, or pin one Bun version for the check and fail with a clear message on any other.
  • ℹ️ server/typescript/packages/runtime-ts/test/meta-docs-route.test.ts:16 - Weak oracle under the test-quality rule. The body tests compare metaDocsJson(root) to serializeDocsView(buildDocsView({ root })), which is the implementation's own expression copied. The mount tests compare the response to metaDocsJson(root), so they inherit the same oracle. If the docs view builder or serializer went wrong, every one of these would still pass. metadata-api.md names an independent oracle for this cross-port body: fixtures/explorer-conformance/&lt;case&gt;/expected.json. Load that case's model, mount the route, and compare the served body to the fixture (with no routes passed, as the fixture's model-alone view).
  • ⚠️ scripts/sync-explorer-app.sh:12 - Simplification. The change commits three copies of the app (about 2 MB each: the bundle, Cytoscape, 3d-force-graph) into the Python, Java and C# packages, plus the explorer app copies gate that keeps them in step. No code in those ports reads them; the changelog says "the other ports' docs-site generators are still to write them". Hatch includes server/python/src/metaobjects/documentation/explorer_app/ in the PyPI wheel, and the Java copy ships in the codegen-base jar, so each published artifact grows by about 2 MB of unused files. The intent requires the app and its TypeScript writer, not port copies with no consumer. Recommendation: drop the three port copies and their gate entries until a port's generator writes the app. Keep only explorer-app/ and the TypeScript package copy.
  • ⚠️ server/typescript/packages/docs-site/src/explorer/site.ts:146 - Simplification. The intent takes Option 4, "the explorer becomes one browser app over the docs view ..., replacing the static per-port page loop". The change keeps that loop as a second mode, output: &#34;static&#34; (on generateExplorerSite and docsSiteFile). It also keeps the explorer-data.js writer and the assetBase mirror branch that applies only to this mode. The intent does not require it. The stated reasons are Pagefind and publishing without scripts, and several tests use it as their oracle. Recommendation: confirm with the user that the static export should survive in 1.3.0. If not, remove it and its static-only options.
  • ⚠️ server/typescript/packages/runtime-ts/src/meta-endpoint.ts:61 - Simplification. The docs view route adds ETag generation (metaDocsEtag), If-None-Match matching with 304 (etagMatches), and Access-Control-Expose-Headers: ETag. metadata-api.md then makes the ETag and the 304 part of the cross-port contract every other port must serve. The intent asks only that the explorer follow a running application, and the app already detects change by comparing bodies (text !== last in app-src/main.ts). The 304 saves bandwidth on a once-a-second poll of what can be a large view, so it is a reasonable optimisation, but it is not required. Narrower form: serve the body with Cache-Control: no-cache only, and keep ETag out of the cross-port contract (or make it optional).
  • ⚠️ server/typescript/packages/docs-site/app-src/main.ts:239 - Simplification. The ?title= query parameter (params.get(&#34;title&#34;) ?? base?.title ?? url.host) is an extra input that no intent requirement asks for. The model file already supplies the title, and the host is the fallback. Recommendation: remove the parameter, and the sentence in docs/features/explorer-site.md that describes it.

🔧 Fix applied.
6 issues (3 warnings, 3 infos) still open:

  • ℹ️ server/typescript/packages/codegen-ts/src/generators/docs-site-file.ts:69 - Inline fix. The assetBase doc comment said a static explorer loads only Cytoscape from the mirror. site.ts also loads 3d-force-graph.min.js from that base and ships neither copy. The comment now names both libraries.
  • ℹ️ server/typescript/packages/runtime-ts/src/meta-endpoint.ts:52 - Inline fix. The metaDocsJson JSDoc said the body is "the same bytes as the explorer.json a docs-site build writes". A meta gen docs-site build passes the verify ledger and the run's generation manifest into buildDocsView, so its explorer.json differs whenever the project has requirements or other generators. The comment now says the two match only when the build had neither.
  • ⚠️ scripts/sync-explorer-app.sh:12 - Simplification. The change commits three copies of the app (about 2 MB each: the bundle, Cytoscape, 3d-force-graph) into the Python, Java and C# packages, plus the explorer app copies gate that keeps them in step. No code in those ports reads them; the changelog says "the other ports' docs-site generators are still to write them". Hatch includes server/python/src/metaobjects/documentation/explorer_app/ in the PyPI wheel, and the Java copy ships in the codegen-base jar, so each published artifact grows by about 2 MB of unused files. The intent requires the app and its TypeScript writer, not port copies with no consumer. Recommendation: drop the three port copies and their gate entries until a port's generator writes the app. Keep only explorer-app/ and the TypeScript package copy.
  • ⚠️ server/typescript/packages/docs-site/src/explorer/site.ts:146 - Simplification. The intent takes Option 4, "the explorer becomes one browser app over the docs view ..., replacing the static per-port page loop". The change keeps that loop as a second mode, output: &#34;static&#34; (on generateExplorerSite and docsSiteFile). It also keeps the explorer-data.js writer and the assetBase mirror branch that applies only to this mode. The intent does not require it. The stated reasons are Pagefind and publishing without scripts, and several tests use it as their oracle. Recommendation: confirm with the user that the static export should survive in 1.3.0. If not, remove it and its static-only options.
  • ⚠️ server/typescript/packages/docs-site/scripts/build-app.ts:44 - This fix-round code came from round 1's F3 fix. The pin EXPLORER_APP_BUN = &#34;1.3.14&#34; makes buildExplorerApp() throw on any other Bun. Root package.json:36 still declares &#34;packageManager&#34;: &#34;bun@1.3.8&#34;, and engines.bun is &gt;=1.3.0. A contributor on the declared Bun 1.3.8 who touches nothing in the explorer now always fails two checks. The first is the ts-unit test explorer-app/ is what the sources build (server/typescript/packages/docs-site/test/explorer-app.test.ts:89), which calls buildExplorerApp(). The second is the explorer app copies gate (scripts/ci-local.sh:1128). Before the fix, failure was possible; now it is certain on any Bun other than 1.3.14. CI and this machine use 1.3.14, so hosted runs stay green. The cause is that the repository declares two Bun versions. Remedy: set root packageManager to bun@1.3.14, the version every workflow pins. integration-tests.yml:96 already records that 1.3.8 segfaults on exit. Because this is a repo-wide toolchain declaration, confirm it with the user. The alternative is to make the unit test skip with the version message while the gate stays strict.
  • ℹ️ explorer-app/README.md:19 - Inline fix. The rebuild instructions did not say that build-app.ts now runs only on the pinned Bun. I added a paragraph that names EXPLORER_APP_BUN (1.3.14) and says any other Bun stops with an error. The copies gate excludes README.md, so the port copies are unaffected.

🔧 Fix applied.
5 issues (2 warnings, 3 infos) still open:

  • ℹ️ server/typescript/packages/codegen-ts/src/generators/docs-site-file.ts:69 - Inline fix. The assetBase doc comment said a static explorer loads only Cytoscape from the mirror. site.ts also loads 3d-force-graph.min.js from that base and ships neither copy. The comment now names both libraries.
  • ℹ️ server/typescript/packages/runtime-ts/src/meta-endpoint.ts:52 - Inline fix. The metaDocsJson JSDoc said the body is "the same bytes as the explorer.json a docs-site build writes". A meta gen docs-site build passes the verify ledger and the run's generation manifest into buildDocsView, so its explorer.json differs whenever the project has requirements or other generators. The comment now says the two match only when the build had neither.
  • ⚠️ scripts/sync-explorer-app.sh:12 - Simplification. The change commits three copies of the app (about 2 MB each: the bundle, Cytoscape, 3d-force-graph) into the Python, Java and C# packages, plus the explorer app copies gate that keeps them in step. No code in those ports reads them; the changelog says "the other ports' docs-site generators are still to write them". Hatch includes server/python/src/metaobjects/documentation/explorer_app/ in the PyPI wheel, and the Java copy ships in the codegen-base jar, so each published artifact grows by about 2 MB of unused files. The intent requires the app and its TypeScript writer, not port copies with no consumer. Recommendation: drop the three port copies and their gate entries until a port's generator writes the app. Keep only explorer-app/ and the TypeScript package copy.
  • ⚠️ server/typescript/packages/docs-site/src/explorer/site.ts:146 - Simplification. The intent takes Option 4, "the explorer becomes one browser app over the docs view ..., replacing the static per-port page loop". The change keeps that loop as a second mode, output: &#34;static&#34; (on generateExplorerSite and docsSiteFile). It also keeps the explorer-data.js writer and the assetBase mirror branch that applies only to this mode. The intent does not require it. The stated reasons are Pagefind and publishing without scripts, and several tests use it as their oracle. Recommendation: confirm with the user that the static export should survive in 1.3.0. If not, remove it and its static-only options.
  • ℹ️ explorer-app/README.md:19 - Inline fix. The rebuild instructions did not say that build-app.ts now runs only on the pinned Bun. I added a paragraph that names EXPLORER_APP_BUN (1.3.14) and says any other Bun stops with an error. The copies gate excludes README.md, so the port copies are unaffected.
🔧 **Test** - 2 issues found → auto-fixed ✅
  • ⚠️ server/typescript/packages/runtime-ts/src/fastify/index.ts - Live check: /_meta/docs serves the model loaded at mount. A model edit on disk is not visible until the backend restarts (no reload hook in mountMetaDocsRoute). The intent says the explorer follows model changes on disk, so this scenario fails. Decide whether the in-app endpoint must reload, or whether reload is the host's job. The static file:// path was not driven live here.
  • 🚨 live validation verdict: no-go (3 of 4 scenarios were driven live against the product); failed: Model edited on disk is followed by the running endpoint without restart
  • Live validation: ❌ no-go - 3 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Explorer app bundle matches its sources (build-app --check) ⏸️ untested no Prior payload recorded this as pass with live=false. A build-tool command run is not a live product scenario, so it is untested here. The check did exit 0.
Live docs endpoint serves the cross-port docs view of the model alone, byte-identical to the corpus oracle ✅ pass live served-docs-model-alone.json; cmp against fixtures/explorer-conformance/model-alone/expected.json
Conditional GET: matching ETag returns 304, non-matching returns 200 ✅ pass live curl If-None-Match against the running server: 304 and 200
Model edited on disk is followed by the running endpoint without restart ❌ fail live Appended Publisher entity to meta.library.json; refetch showed 0 hits; after restart 9 hits
  • scripts/ci-local.sh --affected --strict-toolchains
  • bun scripts/build-app.ts --check in server/typescript/packages/docs-site (exit 0)
  • bun test test/meta-docs-route.test.ts in server/typescript/packages/runtime-ts (8 pass)
  • Live: Fastify server on 127.0.0.1 with mountMetaDocsRoute over fixtures/explorer-conformance/model-alone copy; GET /api/_meta/docs; cmp against expected.json (byte identical)
  • Live: If-None-Match with matching ETag -> 304; non-matching -> 200
  • Live: edited model file on disk while server running, refetched -> no Publisher entity served; restarted server -> Publisher present

🔧 Fix applied.
✅ Re-checked - no issues remain.

  • Live validation: ✅ go - 3 of 4 scenarios driven live against the product
Scenario Result Live Evidence
GET /_meta/docs on a loaded model-alone project returns the docs view, byte-identical to the independent oracle fixtures/explorer-conformance/model-alone/expected.json ✅ pass live docs-route-model-alone.json (cmp identical); docs-route-headers.txt
Poll with the current ETag gets 304 Not Modified ✅ pass live curl -H If-None-Match with the ETag from docs-route-headers.txt returned 304
After a model edit, a restarted application serves the new model (Author renamed Writer) ✅ pass live docs-route-after-restart.json contains acme::library::Writer and no acme::library::Author
Browser explorer app reads /_meta/docs via ?source= and renders from file:// ⏸️ untested no No browser was driven in this turn to load explorer-app index.html with ?source=. The route itself was driven live. The browser step is needed to close the intent's app-level scenario.
  • scripts/ci-local.sh --affected --strict-toolchains
  • Fastify app with mountMetaDocsRoute (runtime-ts src) on fixtures/explorer-conformance/model-alone/project, loaded with MetaDataLoader.fromDirectory strict; curl GET /_meta/docs headers and body
  • cmp served body against fixtures/explorer-conformance/model-alone/expected.json (independent oracle, byte-identical)
  • curl -H &#39;If-None-Match: &lt;current ETag&gt;&#39; /_meta/docs returns 304
  • Copy of model-alone project in $DEV_SCRATCH: rename Author to Writer in metaobjects/meta.library.json, restart server, body contains acme::library::Writer and no acme::library::Author
  • Baseline scripts/ci-local.sh --affected --strict-toolchains already passed at this commit; not re-run (no source changes in this turn)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…view

docsSiteFile() now writes the explorer as a single-page app instead of a
page per screen: a shell, the bundled page code and templates, the theme,
a vendored Cytoscape 3.30.2 (MIT), and three data files (explorer.json,
explorer-model.js, explorer-stamp.js). Pages are drawn on visit by the
same code the static export runs (src/explorer/core.ts), so they are byte
for byte the old pages. It runs from file:// with hash routes and follows
the model on disk by polling the stamp file.

output: "static" keeps the page-per-screen export from the same code;
assetBase now applies to it only. The app's files live once at
explorer-app/ with a committed copy in every port's package, refreshed by
scripts/sync-explorer-app.sh and held by the `explorer app copies` gate.
…mo-130-explorer-3d-live

# Conflicts:
#	server/typescript/packages/codegen-ts/src/generators/docs-site-file.ts
#	server/typescript/packages/docs-site/src/link-check.ts
…plication

The explorer map gains a 2D/3D View control. The 3D mode draws the same nodes, edges,
slice and colouring with 3d-force-graph 1.77.0 (MIT, bundling three.js, licences in the
file header), vendored into explorer-app/ and every port's copy and loaded only when a
reader first chooses 3D. Click a node for the side panel, click again to open its page.

runtime-ts serves the loaded model's docs view at GET {apiPrefix}/_meta/docs
(mountMetaDocsRoute, mountMetaDocsRouteHono, metaDocsJson), opt-in beside /_meta, with
an ETag, 304 on If-None-Match, and an allowOrigin opt-in for cross-origin reads. The
explorer app opened as index.html?source=<url> reads that route instead of the model
file and follows it once a second. The route's shape is documented as a cross-port
contract in docs/features/metadata-api.md.
@dmealing
dmealing merged commit 4ac256b into main Nov 28, 2026
11 checks passed
@dmealing
dmealing deleted the fm/mo-130-explorer-3d-live branch November 28, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant