mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Boot the whole application on the stub renderer, headless, in CI
- dev/stub-app/main.js starts the standalone application on the stub renderer with only the contract's required members (?capabilities=all gives it every capability) and steps its frames. - npm run qa:stub-boot serves the application's own page with that entry, and fails when any Cesium module or asset is requested (the stylesheet the build's Cesium plugin links into every page is reported), on a page or console error, or when a data layer fails to turn on or off. A feed's failed response and the dev server client's own errors are reported; --strict also fails a layer that drew nothing. - The browser CI job runs it. - RENDERER-CONTRACT.md and CURRENT-STATE.md describe the application on the stub and the boot check.
This commit is contained in:
1 parent
ae4fbb5053
commit
8a4867b1b7
7 files changed
+524
-9
No files matched your search
+40
-2
@@ -6853,8 +6853,7 @@ easier to meet (detection is now on more often), but does not create it.
|
||||
`src/render/contract/` types the renderer contract, version `0`: nine ports
|
||||
(frame, globe, draw, camera, query, input, effects, credits and quality),
|
||||
plus the renderer itself. `PORTS` lists every member at run time, and
|
||||
`contract.test.mjs` keeps that list and the types in step. The application
|
||||
does not yet draw through the contract: it still drives Cesium directly.
|
||||
`contract.test.mjs` keeps that list and the types in step.
|
||||
`src/render/stub/` is a renderer that draws nothing, with the default
|
||||
camera's exact maths. `src/render/conformance/` is the suite: logic checks
|
||||
in Node, plus camera traces recorded from Cesium's own `Camera` into
|
||||
@@ -6862,6 +6861,45 @@ in Node, plus camera traces recorded from Cesium's own `Camera` into
|
||||
checked against `goldens/visual/` on the `/dev/conformance/` page. See
|
||||
[RENDERER-CONTRACT.md](RENDERER-CONTRACT.md).
|
||||
|
||||
### The application and its renderer
|
||||
|
||||
The application starts on whichever `RendererPlugin` it is given
|
||||
(`createStandaloneApplication({ renderer })`), and on Cesium when none is.
|
||||
`src/app/scene.js` loads the Cesium adapter (`src/render/cesium/application.js`)
|
||||
only then, with `import()`; the standalone page starts that load as it
|
||||
starts, beside its own setup. Outside `src/render/` no code reaches a
|
||||
renderer's own objects: the record of files that still did,
|
||||
`src/render/viewerAccessAllowList.json`, is empty.
|
||||
|
||||
- What every layer and tool is handed is the scene object
|
||||
(`createSceneHost`), bound to the renderer: its container, and whether it
|
||||
is destroyed. Everything else goes through the renderer's ports.
|
||||
- What a renderer's own plugin adds beside the contract (stale draw-command
|
||||
trims, inline panel drawing, the zoom-out guard, its own map engine, what
|
||||
QA scripts read) it hands through `src/render/applicationHooks.js`; the
|
||||
application uses each where given and does without where not.
|
||||
Renderer-only startup (Cesium's free-look limit, credit keyboard access)
|
||||
runs in that plugin's `create`.
|
||||
- The map stacks switch through the plugin's map engine, else the globe
|
||||
port (`src/maps/globeEngine.js`): Esri and OSM as `xyz` imagery, Cesium
|
||||
ion imagery as `world` imagery, terrain as `world` terrain, or the
|
||||
ellipsoid where no keyless terrain is offered, and photoreal as the port's
|
||||
photoreal base. A photoreal base that fails to come back leaves the globe
|
||||
shown.
|
||||
- The renderer follows its container's size (`Renderer.resize`, from a
|
||||
`ResizeObserver`).
|
||||
|
||||
`npm run qa:stub-boot` boots the whole application on the stub with only
|
||||
the contract's required members (`dev/stub-app/main.js`, served in place of
|
||||
`src/main.js` on the application's own page), headless. It fails if
|
||||
Cesium's code is requested (the one stylesheet `vite-plugin-cesium` links
|
||||
into every page is reported), on any page or console error, or if a data
|
||||
layer (flights, transit, traffic, CCTV, AIS vessels, weather radar and
|
||||
satellite, wind, satellites, FIRMS, wildlife) fails to turn on or off. A
|
||||
feed's failed response (no key, no network) is reported, not failed;
|
||||
`--strict` also fails a layer that drew nothing, and `--all-capabilities`
|
||||
gives the stub every capability. CI runs it in the browser job.
|
||||
|
||||
`src/geo/` (export `./geo`) is the Cesium-free maths: WGS84, ECEF and
|
||||
geodetic conversions, surface normals and east-north-up frames, as plain
|
||||
`{x, y, z}` objects. It follows Cesium's formulas step for step, and
|
||||
|
||||
@@ -170,13 +170,15 @@ back to Cesium. Both lists only ever shrink.
|
||||
when it no longer drives Cesium at all; nothing is added. The list is
|
||||
empty: no file outside the adapter reaches Cesium. Two files name
|
||||
the adapter by design and are not on it: the application scene
|
||||
(`src/app/scene.js`), the composition root that picks the Cesium renderer,
|
||||
may import `src/render/cesium/application.js` and nothing else of the
|
||||
adapter; the conformance page (`dev/conformance/main.js`) may import the
|
||||
(`src/app/scene.js`), the composition root that picks the default renderer
|
||||
when it is given none, may import `src/render/cesium/application.js` (only
|
||||
then, so a page on the stub never loads Cesium) and nothing else of
|
||||
the adapter; the conformance page (`dev/conformance/main.js`) may import the
|
||||
adapter's harness and scene renderer. The test names both
|
||||
(`ADAPTER_ENTRIES`), and that list is never grown.
|
||||
- `src/render/viewerAccessAllowList.json` counts, per file off that list,
|
||||
the Cesium-shaped accesses through the viewer it still makes
|
||||
the Cesium-shaped accesses through the viewer it still makes (none: the
|
||||
list is empty, so no file may make one)
|
||||
(`src/render/viewerAccess.test.mjs`): the viewer's `entities`,
|
||||
`dataSources`, `scene`, `camera`, `clock`, `imageryLayers`,
|
||||
`terrainProvider`, `trackedEntity` and `canvas`, and the scene's
|
||||
@@ -194,10 +196,50 @@ back to Cesium. Both lists only ever shrink.
|
||||
`--check` to see what it would change): it lowers counts and drops
|
||||
entries, and never adds or raises one.
|
||||
|
||||
## The application and its renderer
|
||||
|
||||
The application runs on a renderer with only the contract's required
|
||||
members (the stub proves it below); nothing outside `src/render/<renderer>/` asks which renderer it runs
|
||||
on (no `renderer.id`, no engine type, no engine object's presence).
|
||||
|
||||
- **The scene object.** `createApplicationScene` (`src/app/scene.js`) takes a
|
||||
`RendererPlugin`, or a promise of one (default: Cesium, imported only then;
|
||||
`loadDefaultRenderer` starts that import as the standalone page starts),
|
||||
creates the renderer in the page's container, and hands every layer and
|
||||
tool the application's own scene object (`createSceneHost` in
|
||||
`src/render/rendererOf.js`): the container and `isDestroyed()`, bound to
|
||||
the renderer. Code reaches the renderer's
|
||||
ports through it (`findCamera`, `drawOf`, `canvasOf`...).
|
||||
- **What only the Cesium renderer needs at startup** is done in its
|
||||
`create`: for Cesium, the free-look height limit and keyboard access to its
|
||||
credits' expand link (`src/render/cesium/appRenderer.js`).
|
||||
- **What a plugin may hand the application beside the contract** goes through
|
||||
`provideApplicationHooks(renderer, hooks)` (`src/render/applicationHooks.js`),
|
||||
each hook optional and used only where given: a map engine of its own,
|
||||
stale command trimming, inline panel rendering, whether an entity is its
|
||||
own, the zoom-out guard, and what QA scripts read from
|
||||
`window.__godsEyeView` (Cesium's viewer there, for the scripts that drive
|
||||
it). None is a contract member, and a renderer without them runs the
|
||||
application without that behaviour.
|
||||
- **The map stacks** switch through the renderer's own map engine when its
|
||||
plugin hands one, else through its globe port (`src/maps/globeEngine.js`);
|
||||
see `docs/CURRENT-STATE.md` § Map source factories and coordination.
|
||||
- **The proof.** `npm run qa:stub-boot` (`scripts/qa-stub-boot.mjs`) serves
|
||||
the application's page with `dev/stub-app/main.js` as its entry: the whole
|
||||
application on the stub with no capability at all. It fails when the page
|
||||
requests any Cesium module or asset, on a page or console error, or when a
|
||||
data layer (flights, transit, traffic, CCTV, vessels, weather, wind,
|
||||
satellites, FIRMS, wildlife) fails to turn on or off; `--strict` also fails
|
||||
a layer that draws nothing on the stub (it needs the live feeds).
|
||||
`src/app/scene.test.mjs` runs the scene itself on the stub in Node.
|
||||
|
||||
## The stub renderer
|
||||
|
||||
`createStubRenderer({ capabilities, viewport, time })` implements every port
|
||||
in memory and draws nothing. It has:
|
||||
`createStubRenderer({ capabilities, viewport, time, container })` implements
|
||||
every port in memory and draws nothing. Given a `container` (in a page), its
|
||||
canvas is a real canvas filling it, which `resize()` follows; otherwise a
|
||||
stand-in that takes event listeners. `createStubRendererPlugin(options,
|
||||
onCreate)` is the stub as a `RendererPlugin`. It has:
|
||||
|
||||
- the default camera's exact maths: views, `lookAt`, flights with their
|
||||
height arc and easing, `changed` thresholds and follows;
|
||||
|
||||
Reference in new issue
Block a user