Repository navigation
Conversation
…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.
Member
Author
|
Superseded: this branch conflicts with main after #666 landed. Its commits ship inside the follow-up PR for the explorer's 3D map and running-application view, which resolves the conflict and carries this PR's proof. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
docsSiteFile()now writes the model explorer as one browser app by default (output: "app"): a shell, the app, the theme, vendored Cytoscape 3.30.2 and three data files (explorer.json,explorer-model.js,explorer-stamp.js). The app draws each page on visit with the same page code and templates, runs fromfile://with no server, and addresses pages asindex.html#/<page>. It polls the stamp file about once a second and redraws the open page when the model changes on disk.output: "static"keeps the earlier page-per-screen site, also exposed asgenerateExplorerSite({ output: "static" }).explorer-app/(built byserver/typescript/packages/docs-site/scripts/build-app.ts).scripts/sync-explorer-app.shcopies it into each port's package, and theexplorer app copiesstep ofscripts/ci-local.sh --only gatesfails when a copy is stale. Non-TypeScript ports ship the files, but their docs-site generators do not yet write them.assetBasenow applies only to the static export. The app loads Cytoscape from the shipped copy, so graphs draw offline and the CDN notice is removed from the explorer. Generated-output change: the nextmeta genreplaces the explorer's pages with the app files. A project that ejected the theme on a 1.3.0 candidate must copydocs-site/assets/explorer.jsagain (meta eject docs-site --force), because the app callswindow.MO_THEME.Proof
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 weredrawn by the committed bundle (
assets/explorer-app.js) running in a Node VM, from theexplorer-model.jsthe new generator writes. Script tags that load Cytoscape are normalised,because the app's shell loads it once for every page.
test/explorer-app.test.tsrepeats this check for the three fixtures on every run, against the static export from the same sources.Headless Chrome from
file://(CDP)#/map.html?colour=claims#/model/acme/shop/Order.html#/model/acme/shop/Order.html#m-reference, scrolled to memberLive update
With the page open, the test rewrote
explorer-model.jsandexplorer-stamp.jswith a changed title and never touched the page.The poll interval is 1 s, so any delay up to about 1 s is expected.
The pipeline took 1 run, with two review fix rounds.
Validation
Risk Assessment
✅ Low: The fix-round changes are small and correct: the not-found Overview link now resolves to #/index.html, the rebuilt bundle carries the fix, and all four port copies are identical. The docs now say the app keeps only each drawn page's title and body. The rest of the change was reviewed in earlier rounds, and the tests hold the app's page output byte-for-byte to the static export.
Testing
Baseline
scripts/ci-local.sh --affected --strict-toolchainspassed at the target commit and was not re-run. I generated the app with the realgenerateExplorerSitefrom thefixtures/explorer-conformance/shopfixture into a scratch dir. Headless google-chrome then loaded it over file:// with no server. The overview rendered, the deep link#/model/acme/shop/Order.htmlrendered the real Order page, and a missing page showed "No such page" with an Overview link. That link resolves to#/index.htmlfrom a nested path, which is the root-relative fix. Model-change-on-disk following was not driven. Scratch output removed.Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
scripts/ci-local.sh:1514- Theexplorer app copiesgate is registered inrun_gates_offline. That group runs before thedependencies installedstep (bun_install, line 1775), and inlane_gatesit runs beforerun_gates_bun.gate_explorer_app_driftrunsbuild-app.ts --check, and that script callsBun.buildoverapp-src/main.ts. The build resolves workspace@metaobjectsdev/*packages (thebuncondition) and the third-partymustachedependency through node_modules. On a fresh CI checkout there is no node_modules yet. The bundle then fails to resolve, so the check is red there and green on warm dev machines. Or bun auto-installs and binds the published packages, which is worse: the check compares against a stale loader. The comment aboverun_gates_bun(ci-local.sh:1516-1523) records this exact failure class. Fix: move the step intorun_gates_bun, or intorun_drift_gatesbeside the other build-and-diff gates. Another option is to prefix it withbun_install &&.server/typescript/packages/docs-site/scripts/build-app.ts:28- The bundle inlines mustache.js (MIT, via@metaobjectsdev/render'srender.ts) and minifies it. The committedexplorer-app/assets/explorer-app.jshas no copyright or licence notice: a grep forCopyright|licensefinds 0 matches. This file ships in the npm package (app/), the Python wheel and the Java jar, and it is written into every adopter's generated site. MIT requires the copyright and permission notice in all copies or substantial portions. Cytoscape is handled correctly (the vendored file keeps its header, and the README cites it), but mustache.js is not. Fix: add abannerto theBun.buildcall with the mustache.js MIT notice. Add a matching row toexplorer-app/README.md's file table. Then rebuild and re-sync the four copies.server/typescript/packages/docs-site/assets/explorer.js:330- The app now needs a hook from the theme script: it callswindow.MO_THEMEonce per page it draws. A project that ranmeta eject docs-siteon a 1.3.0 RC has an ownedcodegen/docs-site/assets/explorer.jswithout that hook, because the explorer shipped in those candidates.generateExplorerSitewrites the owned copy in place of the packaged one (theme()in site.ts). Trace: the old IIFE runs once at shell load against theLoading the model…body and finds nothing. Thenshow()callsw.MO_THEME?.(), which is undefined. Search, the theme toggle, the map, the mini-maps and the trace all stop working on every page. Nothing errors, and the existingmeta genwarning only covers missing explorer files.meta eject docs-sitewithout--forcedoes not refresh a file that already exists. Smallest fix: inchangelog.d/explorer-app.md(the 'Generated-output change' sentence, line 14), tell owners of an ejectedexplorer.jsto re-copy it (meta eject docs-site --force) or add thewindow.MO_THEME = runhook. Make the same note indocs/features/explorer-site.md, 'Own the theme'.scripts/sync-explorer-app.sh:12- Simplification: the change commits three non-TypeScript copies of the app (about 490 KB each:server/python/.../explorer_app,server/java/codegen-base/.../explorer-app,server/csharp/MetaObjects.Codegen/ExplorerApp). It also adds a sync script and drift-gate loops to keep them current. No port's generator reads these copies yet; the changelog and docs say 'the other ports' docs-site generators are still to write them'. The intent says 'This task is the app itself', so these copies serve a future task. Meanwhile they add about 490 KB of unused JS to the Python wheel and the Java jar for 1.3.0. Recommend removing the three port copies, their entries insync-explorer-app.shandgate_explorer_app_drift, and the port table rows. Add them with the port generators that consume them.server/typescript/packages/docs-site/src/explorer/site.ts:159- Simplification: the intent says the app 'replaces the static per-port page loop that writes a page per screen'. The change instead keeps that loop as a second public mode:output: "static"ongenerateExplorerSiteanddocsSiteFile, theEXPLORER_OUTPUT_*constants, andassetBasenow scoped to that mode. The mode also adds new behavior: the vendored Cytoscape copy, and a mirror that ships no copy. The byte-identical test and Pagefind publishing justify keeping it, but no stated requirement needs a user-facing option. Confirm that the static export should stay a supported option. Otherwise, reduce it to an internal test path, or remove it with theassetBasebranch.server/typescript/packages/docs-site/app-src/main.ts:104- Most of the new app logic runs only in a browser, and no test executes it. That covers the hash-route parse and build, the per-page link rewrite, the anchor-onlyhashchangepath,replaceQuery, and the stamp-then-model poll handshake. The test file runs only theMoExplorer.explorerForpage table. The docs make claims about back, forward, new-tab links, keeping the scroll position and skipping a half-written model, and nothing checks them. A DOM-backed test (for example happy-dom) could drive#/model/acme/shop/Order.html#m-totaland a stamp change. That test would reject a link rewritten against the wrong base, or a model taken without its stamp. I traced the cases by hand and found no defect.🔧 Fix applied.
5 issues (3 warnings, 2 infos) still open:
scripts/sync-explorer-app.sh:12- Simplification: the change commits three non-TypeScript copies of the app (about 490 KB each:server/python/.../explorer_app,server/java/codegen-base/.../explorer-app,server/csharp/MetaObjects.Codegen/ExplorerApp). It also adds a sync script and drift-gate loops to keep them current. No port's generator reads these copies yet; the changelog and docs say 'the other ports' docs-site generators are still to write them'. The intent says 'This task is the app itself', so these copies serve a future task. Meanwhile they add about 490 KB of unused JS to the Python wheel and the Java jar for 1.3.0. Recommend removing the three port copies, their entries insync-explorer-app.shandgate_explorer_app_drift, and the port table rows. Add them with the port generators that consume them.server/typescript/packages/docs-site/src/explorer/site.ts:159- Simplification: the intent says the app 'replaces the static per-port page loop that writes a page per screen'. The change instead keeps that loop as a second public mode:output: "static"ongenerateExplorerSiteanddocsSiteFile, theEXPLORER_OUTPUT_*constants, andassetBasenow scoped to that mode. The mode also adds new behavior: the vendored Cytoscape copy, and a mirror that ships no copy. The byte-identical test and Pagefind publishing justify keeping it, but no stated requirement needs a user-facing option. Confirm that the static export should stay a supported option. Otherwise, reduce it to an internal test path, or remove it with theassetBasebranch.server/typescript/packages/docs-site/app-src/main.ts:104- Most of the new app logic runs only in a browser, and no test executes it. That covers the hash-route parse and build, the per-page link rewrite, the anchor-onlyhashchangepath,replaceQuery, and the stamp-then-model poll handshake. The test file runs only theMoExplorer.explorerForpage table. The docs make claims about back, forward, new-tab links, keeping the scroll position and skipping a half-written model, and nothing checks them. A DOM-backed test (for example happy-dom) could drive#/model/acme/shop/Order.html#m-totaland a stamp change. That test would reject a link rewritten against the wrong base, or a model taken without its stamp. I traced the cases by hand and found no defect.server/typescript/packages/docs-site/app-src/main.ts:127- The not-found page's 'Overview' link is written ashref="index.html".rewrite(doc, r.path, …)then resolves it against the missing page's own path, not the site root. The live view makes this easy to reach: the reader has#/model/acme/shop/Order.htmlopen, then renames or deletesOrderand runsmeta gen.show(true)redraws, and the page is not found. The 'Overview' link becomes#/model/acme/shop/index.html, which is the package index (Pages.packagePage), not the overview. If that package was also removed, the link leads to another 'No such page'. A stale bookmark or a link from a new tab hits the same problem. Fix: build the link relative to the root, for example"../".repeat(r.path.split("/").length - 1) + HOME, or use the samerelHrefthe pages use. Then rebuildexplorer-app/and runscripts/sync-explorer-app.shso all four port copies match. This code came from the original commit; the fix round did not touch it.docs/features/explorer-site.md:174- The docs say 'The app carries your templates inexplorer-model.jsand draws every page with them'. However,show()(app-src/main.ts:132-135) keeps only the drawn document's<title>, its<body>attributes and its body children. Everything else that an ownedexplorer-head.mustacheputs in<head>is discarded with no warning: an extra stylesheet<link>, a<style>block, a favicon,<meta>tags, and attributes on<html>. The static export keeps all of these. Fix the 'Own the theme' paragraph and the docs-site README sentence: say that the app uses only the title and body of each drawn page, so head additions belong in an ownedexplorer.cssorexplorer.js.🔧 Fix applied.
3 issues (2 warnings, 1 info) still open:
scripts/sync-explorer-app.sh:12- Simplification: the change commits three non-TypeScript copies of the app (about 490 KB each:server/python/.../explorer_app,server/java/codegen-base/.../explorer-app,server/csharp/MetaObjects.Codegen/ExplorerApp). It also adds a sync script and drift-gate loops to keep them current. No port's generator reads these copies yet; the changelog and docs say 'the other ports' docs-site generators are still to write them'. The intent says 'This task is the app itself', so these copies serve a future task. Meanwhile they add about 490 KB of unused JS to the Python wheel and the Java jar for 1.3.0. Recommend removing the three port copies, their entries insync-explorer-app.shandgate_explorer_app_drift, and the port table rows. Add them with the port generators that consume them.server/typescript/packages/docs-site/src/explorer/site.ts:159- Simplification: the intent says the app 'replaces the static per-port page loop that writes a page per screen'. The change instead keeps that loop as a second public mode:output: "static"ongenerateExplorerSiteanddocsSiteFile, theEXPLORER_OUTPUT_*constants, andassetBasenow scoped to that mode. The mode also adds new behavior: the vendored Cytoscape copy, and a mirror that ships no copy. The byte-identical test and Pagefind publishing justify keeping it, but no stated requirement needs a user-facing option. Confirm that the static export should stay a supported option. Otherwise, reduce it to an internal test path, or remove it with theassetBasebranch.server/typescript/packages/docs-site/app-src/main.ts:104- Most of the new app logic runs only in a browser, and no test executes it. That covers the hash-route parse and build, the per-page link rewrite, the anchor-onlyhashchangepath,replaceQuery, and the stamp-then-model poll handshake. The test file runs only theMoExplorer.explorerForpage table. The docs make claims about back, forward, new-tab links, keeping the scroll position and skipping a half-written model, and nothing checks them. A DOM-backed test (for example happy-dom) could drive#/model/acme/shop/Order.html#m-totaland a stamp change. That test would reject a link rewritten against the wrong base, or a model taken without its stamp. I traced the cases by hand and found no defect.✅ **Test** - passed
✅ No issues found.
scripts/ci-local.sh --affected --strict-toolchainsbun driver over generateExplorerSite (app output) from fixtures/explorer-conformance/shop into a scratch dir (28 pages, 8 files)google-chrome --headless screenshot file:///.../index.html (overview)google-chrome --headless screenshot file:///.../index.html#/model/acme/shop/Order.html (real model page)google-chrome --headless --dump-dom file:///.../index.html#/model/acme/shop/Nope.html (not-found Overview href)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.