Maintenance Notes¶
This page collects the repository rules that are easy to break silently —
hand-written mirrors of unexported upstream constants, coverage and audit gates,
publishing layouts, and generated files. CLAUDE.md links here rather than
restating any of it.
If you are just getting set up, read Contributing first.
Dependency bumps that need a manual check¶
Several features depend on values or DOM contracts that upstream packages do not export, so GeoLibre mirrors them by hand. Drift usually produces no build error — the feature just stops working. After bumping any of the packages below (including Dependabot PRs), do the listed check and run the frontend suite.
tests/upstream-contracts.test.ts checks the installed package for the
exact shape each mirror below relies on — a class name in the published files,
a private field on a real instance, a constant, a snippet of a method body — and
its failure message names the section here to read. Mirrors with a dedicated
real-package test of their own (named in their section) are not repeated there.
Packages that touch the DOM or WebGL at import are checked against their
published files' text rather than imported. A test there passing is not the
whole check: semantics the shape cannot show (ordering, pixels, network
behaviour) still need the manual steps listed. When you add a mirror, add its
contract there too.
Patched packages (patches/)¶
postinstall applies the patch-package patches in patches/, and each patch
file names the exact version it was made against. A bump that moves a patched
package past that version fails npm install in CI. Regenerate the patch
against the new version (or drop it if upstream fixed the bug), rename the patch
file, and update package-lock.json in the same PR.
@carbonplan/zarr-layer is declared with an exact version (no ^) in both
apps/geolibre-desktop and packages/plugins. It carried a patch until 0.10.0,
which shipped the same non-throwing uniform lookups upstream (the layer vanished
at zoom >= 12 on Mesa GPUs without them). Before bumping it, confirm
createShaderProgram in its dist/index.js still looks up shift_x,
shift_y and u_worldXOffset with gl.getUniformLocation, not
mustGetUniformLocation (tests/upstream-contracts.test.ts checks this).
geolibre-wasm (packages/processing/package.json)¶
- Processing menu catalog.
ProcessingMenu.tsxrenders from a checked-in, auto-generated catalog,apps/geolibre-desktop/src/lib/whitebox-menu-catalog.ts(do not hand-edit). Runnode scripts/gen-whitebox-menu-catalog.mjsand commit the result, or new/renamed WASM tools silently miss the menu. The Processing dialog lists tools dynamically, so the gap only shows in the menu. Whitebox translations are optional external packs inopengeos/geolibre-language-packs, not entries generated into GeoLibre's bundled locale JSON. MAX_VECTOR_PMTILES_ZOOM(packages/processing/src/wasm-convert.ts) mirrors the deepest zoomvector_to_pmtilesaccepts (18 — past it the tool exits withvalidation error: max_zoom must be <= 18). The cap lives inside the WASM binary and is not exported. If it drifts, the browser's Vector to PMTiles either refuses a zoom the tiler would now accept, or accepts one it will reject after the user has waited. This is not the sidecar's cap: freestiler allows 24 (MAX_PMTILES_ZOOMinConversionDialog.tsx, mirroringbackend/geolibre_server/geolibre_server/app/conversion.py), and the dialog validates against whichever engine is about to run.tests/wasm-convert.test.tsfails if the mirror drifts.RoutingGraphmirrors the JS network search. The local network tools (packages/processing/src/local-network.ts) run their Dijkstra, A* and turn-rule searches in geolibre-wasm'sRoutingGraphwhen it loads (local-network-wasm.ts) and fall back toLocalNetwork.searchJsotherwise. The Rust search copies the JS one step for step (heap, tie order, budget charging, the weighted stop), so the two must change together: a search change in either repo needs the same change in the other.tests/local-network-wasm.test.tsruns randomized networks and the whole routing suite through both engines and fails on any difference; it skips itself only when the installed geolibre-wasm has noRoutingGraph.DISTANCE_SEGMENTS/NON_DISTANCE_NAMES(apps/geolibre-desktop/src/lib/whitebox-distance-params.ts) decide, by parameter name, which Whitebox parameters are ground distances and so get the Processing dialog's metric unit picker (GeoLibre#1540). The segments are generic (tolerance,radius,length,resolution), so a tool can carry a matching name that is not a length —corridor_toleranceis a 0–1 fraction. Those are safe today only because the picker is confined to tools whose every dataset input is a vector layer, and the colliding names happen to sit on imagery/LiDAR tools; that is a coincidence, not a guarantee. Scan the new catalog for adoublematching the rule whose description reads as a fraction, ratio, angle or weight, and add it toNON_DISTANCE_NAMES. If one is missed, that tool's field offers metres and silently converts a dimensionless number as if it were a distance.
geotiff (packages/processing/package.json) — private actualizedFields¶
readRasterData (packages/processing/src/raster-client.ts) pads a
SampleFormat tag shorter than SamplesPerPixel so geotiff.js can decode
band 2+ of such files (older geolibre-wasm COGs carry one). geotiff.js reads
the tag from several places, so the pad replaces the parsed value in the
image's private fileDirectory.actualizedFields map (keyed by tag number, 339).
If a bump renames or reshapes that map, the pad stops working and those files
fail again with "Unsupported data format/bitsPerSample";
readRasterData warns when the map is missing, and
tests/upstream-contracts.test.ts checks the map and key on a real image.
maplibre-gl¶
MapLibre is pinned to an exact version (6.19.0, style spec 26.9.0, both also
in the root overrides). Dependabot does not move the overrides, so a bump PR
that leaves them behind nests a second maplibre-gl and fails the build with
... is not assignable to parameter of type 'IControl'; move all of them
together.
- The camera has no transform from 6.19. MapLibre 6.19 removed its
Transformclasses:map._camerakeeps its state in a store and derives a read-onlyprojectedCamera, and the per-projection camera math (getCameraAltitude,isLocationOccluded, ...) is no longer reachable from the map. Three places stand in for it, each with a test against the installed engine: map-transform-compat.tsgives@deck.gl/mapboxamap.transformthat readsheight,elevationand_nearZ/_farZfrom the liveprojectedCamera(tests/map-transform-compat.test.ts). Without it deck.gl overlays throw every frame once terrain is on.cameraAltitudeFromProjectedCamera(same file) mirrors MapLibre'sgetCameraAltitudefor the Eye alt readout; its test compares it with the installed engine's own camera math on Mercator and globe cameras.globe-popup-occlusion.tsreads the opacity MapLibre's ownPopup._updateOpacitywrites, since there is no transform left to ask (tests/globe-popup-occlusion.test.ts).- Blend composites follow the renderer, not just the spec. Style spec 26.9
lists
fill-extrusion-layer-opacity, but GL JS does not implement it yet (itssdk-supportis maplibre-gl-js#4492), soCOMPOSITE_LAYER_TYPESstays fill and line.tests/layer-blend-modes.test.tscounts only the*-layer-opacityproperties the reference JSON marks as supported in js, so it fails once extrusions can composite and the caveat can be lifted. -
Print-capture pole visibility uses public projection/unprojection in production.
tests/print-visible-poles.test.tsalso exercises the installed package's private camera modules (src/camera/*: a globe camera view state,projectCamera,getCameraMath) with a pitched southern camera that sees only the North Pole. Keep this test aligned with the installed engine on upgrades. A pole projected inside the viewport can still be occluded; capture metadata requires an unprojection round trip and records image pixels so layout crops can exclude the pole correctly. -
GLOBE_CONTROL_TOGGLE_SELECTOR(packages/map/src/globe-control-toggle.ts) mirrors the class names MapLibre's ownGlobeControlputs on its toggle button —maplibregl-ctrl-globeandmaplibregl-ctrl-globe-enabled, swapped on every projection change.MapCanvaspersists a projection change from a click on that button rather than from theprojectiontransitionevent, because style initialization and project reconciliation emit that event too and a stale one overwrites the projection of a project that has just loaded.tests/globe-control-toggle.test.tsbuilds a realGlobeControland fails if the mirror stops matching. - Per-layer blend modes (
packages/map/src/layer-blend-modes.ts) wrap three unexportedmaplibre-glinternals, because MapLibre renders every layer into one canvas and ships no per-layer blend API (upstream draft: maplibre/maplibre-gl-js#8073). The wrappers arePainter.prototype.renderLayer(brackets one layer's draws),Painter.prototype.useProgram(tells the layer-opacity composite draw, programlayerCompositesince maplibre-gl 6.18 andlayerOpacitybefore, from the draws feeding it), andContext.prototype.setColorMode(the single place every draw resolves GL blend state). Fill and line layers additionally getfill-layer-opacity/line-layer-opacitypinned just under 1 bystyle-mapper, which elects MapLibre 6's render-to-texture composite so a layer blends as a whole rather than once per overlapping polygon.installLayerBlendModesfeature-detects every seam and disables the feature (hiding the Style-panel control) rather than breaking the map, so drift fails quietly — which is whytests/layer-blend-modes.test.tsasserts the seams ande2e/blend-modes.spec.tsasserts real pixels. Run both on a bump.
See Adding a blend mode before extending the list.
DEFAULT_MARKER_OFFSET_Y(apps/geolibre-desktop/src/components/storymap/storymap-engine.ts) mirrors the-14px vertical offsetmaplibregl.Markerapplies to its default pin.createStoryMapMarker(also reused by Field Collection's capture marker inapps/geolibre-desktop/src/lib/field-collection-map.ts) positions that pin by hand on every engine (Mapbox, Cesium, ArcGIS, and MapLibre alike), so if a bump changes the default pin's anchor or offset, story markers drift off their coordinate with no error.tests/upstream-contracts.test.tsreads the default offset out of the published bundle and fails if it moves; still play a story on a non-MapLibre renderer if the pin's anchor changed.- Map CRS (
packages/map/src/map-crs.ts, issue #1128) usesaddProjection,importScriptInWorkersand the workers'setProjectionHandler, all@experimentalupstream, so a minor release may change them. The handler script is proj4's UMD build (proj4/dist/proj4.js, read with?raw) followed by onesetProjectionHandlercall: MapLibre fetches it from ablob:URL and evaluates it witheval, which both CSPs allow (connect-src blob:,'unsafe-eval'). If upstream starts loading worker scripts as modules or byimportScripts, or proj4 drops its UMD build, GeoJSON on a custom CRS map silently draws in the wrong place (MapLibre only warns). After a bump, runtests/map-crs.test.tsand pick a preset under Settings → Map with a GeoJSON layer on the map. - Map CRS fits (
MapController.guardMapCrsFits, issue #3516) replacefitBoundson the map instance so fits that plugin controls make directly (the PMTiles panel) stay on a custom CRS's tile grid. They assume MapLibre clamps the camera center to the grid, draws the grid 512 px wide at zoom 0 (cameraForMapCrsBox), and thatfitBoundsstays an own-instance-overridable method that MapLibre itself does not rely on internally. The guard also covers the frame applied when a CRS is entered (applyMapCrsfits the preset'sbounds), so a new preset whose box straddles its grid edge is framed on the clipped part. After a bump, runtests/map-crs-fit.test.ts, then on?crs=earth-arcticaddhttps://data.geolibre.app/knoxville_buildings.pmtiles: the camera must stay on the Arctic view and Zoom to layer must explain why it cannot move.
mapbox-gl¶
Mapbox is pinned to an exact version (3.35.2, checked against Mapbox Standard
with a valid access token). Keep the npm version, CDN version, and integrity
hashes together, and repeat the e2e/mapbox-*.spec.ts run with MAPBOX_TOKEN
set before taking the next upgrade.
Mapbox GL JS v2+ is proprietary, so it must never enter a build: the app loads
it from Mapbox's CDN (packages/map/src/mapbox-gl-loader.ts) and the npm package
is there only for types. A bump must update MAPBOX_GL_VERSION and both
*_INTEGRITY hashes in that file; tests/mapbox-gl-loader.test.ts computes the
expected values from the installed package and fails until they match. A
runtime import of mapbox-gl, direct or transitive, fails the build
(thirdPartyLicensePlugin in apps/geolibre-desktop/vite.config.ts). The
script runs under script-src, which lists the CDN path; the stylesheet is
fetched and inlined because style-src lists no external host. Playwright's
vite preview sends no CSP, so the e2e suite cannot catch a policy mismatch. A
GEOLIBRE_NO_EXTERNAL_CDN=1 build refuses to load the renderer.
MapLibre and Mapbox both use a _classRegistryKey property, and MapLibre sets it
permanently on the global Set and Error, which stops every Mapbox tile from
loading. apps/geolibre-desktop/vite-plugins/isolate-maplibre-registry.ts renames
MapLibre's copy at build time. A CI run can't see this failure without a real
Mapbox token, so after a bump of either package, load a Mapbox style with one.
The Mapbox engine's plugin-layer mirror (mirrorPluginLayerState in
packages/map/src/mapbox-engine.ts) identifies a plugin's native layer by the
style's own layer object, style.getOwnLayer(id), an internal, because
map.getLayer returns a fresh serialize() copy on every call.
OwnedPaintResets keys what GeoLibre wrote on that object, so a cleared dash
or blur resets only GeoLibre's own value. Without getOwnLayer nothing is
owned and dashes on plugin layers stop resetting to solid, silently;
tests/upstream-contracts.test.ts checks both halves in the bundle.
@deck.gl/mapbox and @deck.gl/maplibre¶
bridgeArcgisDeckControl (packages/plugins/src/plugins/arcgis-deck/control-adapter.ts)
reads each overlay's private _props field so ArcGIS can transfer its initial
layers into a native ArcgisDeckOverlay without mounting the MapLibre control.
The cast hides upstream changes from TypeScript. After either deck.gl package is
bumped, run tests/arcgis-control-adapters.test.ts and confirm the overlay still
exposes _props with the initial DeckProps object.
@loaders.gl/tiles (via @deck.gl/geo-layers) — tile cache cap¶
applyThreeDTilesTilesetMemoryLimit (packages/plugins/src/plugins/arcgis-i3s-tiles.ts)
works around Tileset3D trimming its tile cache against a maximumMemoryUsage
field it never copies from the load options, so the cap stays at 32 MB and
every camera move evicts the tiles just drawn (issue #2560). The same PR turned
memoryAdjustedScreenSpaceError off because it ratchets the level of detail
down once that cache fills. After bumping deck.gl or loaders.gl, run
tests/arcgis-i3s-tiles.test.ts: its real-Tileset3D case fails if the field
is renamed or no longer starts at 32 MB. If upstream starts honouring the
option, the helper can go.
@deck.gl/geo-layers — I3S mesh layer replaced¶
deck.gl's Tile3DLayer draws ArcGIS I3S nodes with its own MeshLayer, which
shades them through luma.gl's PBR material module. From deck.gl 9.4 / luma.gl
9.4 that draws nothing on WebGL (every fragment transparent, no error), so no
I3S scene layer rendered from the 9.3 → 9.4 bump (#2395) until GeoLibre
replaced the layer. packages/plugins/src/plugins/i3s-mesh-layer.ts is deck.gl
9.3's I3S mesh layer without the PBR module, passed to Tile3DLayer as
_subLayerProps.mesh.type in arcgis-i3s-tiles.ts.
After bumping deck.gl or luma.gl, load Add data → 3D Tiles layer → Load sample
data → San Francisco Buildings (ArcGIS I3S) on the Positron background (Liberty
draws its own 3D buildings, which look like I3S ones) and check the textured
buildings draw. To see whether upstream fixed its layer, drop the
_subLayerProps override and check again; if it draws, delete
i3s-mesh-layer.ts.
@maplibre/maplibre-gl-style-spec¶
propertySpecFor (packages/core/src/expressions.ts) fabricates the
unexported StylePropertySpecification shape that createExpression uses for
expected-result-type enforcement (the Expression Builder's filter → boolean /
color checks). The cast hides any contract change from the compiler, so run the
frontend suite — the "enforces an expected result type" test in
tests/expressions.test.ts fails if the shape stops being honored.
cssColor (packages/map/src/feature-style.ts) turns the Color
object a compiled colour expression evaluates to into CSS by reading its
toString() and accepting an rgba( or # prefix. That format is how the
spec's Color happens to print, not a documented contract: if a bump changes
it, the globe silently paints every classified feature the flat fallback colour
rather than failing. The "classifies by a categorical field" test in
tests/cesium-feature-style.test.ts goes through a real compiled expression,
so run the frontend suite after a bump and re-verify a categorized layer on the
globe.
SPEC_DEFAULT_COLOR (packages/map/src/mapbox-style-import.ts) mirrors the
spec's default for fill-color, line-color and circle-color — #000000
for all three — which is the colour a stacked class layer naming none is
imported as.
It is hard-coded rather than read from the spec because @geolibre/map is a
published package and does not depend on it (only packages/core does). The
frontend suite guards both directions: a test in
tests/mapbox-style-import.test.ts asserts the spec still says
SPEC_DEFAULT_COLOR, and the behavioural tests beside it assert an imported
colourless class renders that colour, so a change to either side fails.
COLOR_OVERRIDING_PAINT in the same file mirrors the other half of that
lookup: the paint properties that draw the feature themselves, so that the
colour default does not apply. The spec encodes it as line-color's
requires: [{ "!": "line-pattern" }], which the same test asserts. fill-pattern
and line-gradient are listed for the same reason but the spec does not encode
it, so only the line-pattern entry is a mirror a test can guard; the other two
rest on how MapLibre renders them. A class using any of them is not imported as
black — it declines the stack.
Web Services control packages (packages/plugins/package.json)¶
- Docked panel DOM bridge.
dockable-map-control.tsadaptsmaplibre-gl-fema-wms,maplibre-gl-nasa-earthdata,maplibre-gl-enviroatlas, andmaplibre-gl-national-mapby calling the control lifecycle directly and moving the panel element thatonAdd()appends to the map container into GeoLibre's native right-panel host. Vantor returns a wrapper instead, so the bridge selects its.vantor-paneldescendant. The scoped CSS inindex.cssmirrors each package's panel, header, toggle, close, and resize-handle class names;tests/upstream-contracts.test.tslists them per package and fails when a package stops rendering one (orindex.cssstops styling it). After bumping any of these packages, activate every migrated Web Services plugin and verify that its catalog renders, resizing the GeoLibre dock preserves the content, and no vendor panel remains under the map container. - NASA Earthdata panel Add date fallback. GeoLibre turns on the control's
defaultDateFallbackoption (0.2.0+), so a panel Add of a time-enabled layer probes the zoom-0 tile at its default date and adds the newest earlier date with imagery (#3259). This used to be a GeoLibre wrapper around the instance'saddLayer. The probe's behaviour (de-duplicating a repeat Add, passing adds with adateorkeystraight through, adding nothing afteronRemove, which deactivating the plugin runs) is upstream's and tested there;tests/nasa-earthdata-options.test.tschecks GeoLibre turns it on.
maplibre-gl-components (packages/plugins/package.json)¶
MAP_PANEL_SELECTOR(apps/geolibre-desktop/src/components/layout/RecordVideoDialog.tsx) mirrors the rendered control class names —maplibre-gl-html-control,maplibre-gl-legend,maplibre-gl-colorbar— so Record Video's "Include map panels" option can rasterize those on-map overlays into the recording. These are the display elements, deliberately not the*-gui-controlauthoring editors. If a class drifts, the option silently stops burning that panel into the video (or the checkbox never appears) with no build error;tests/upstream-contracts.test.tsfails instead.- The PMTiles control's layer ids (
pmtilesControlLayerId/pmtilesIdsForSourceLayers/pmtilesIdNamesSourceLayer,packages/map/src/pmtiles-layer.ts, read fromlayer-sync.tsandpackages/plugins/src/plugins/components/pmtiles.ts) mirror an unexported fact aboutPMTilesLayerControl: it names its MapLibre layers${sourceId}-${name}-${kind}from the raw source-layer name, wherepmtilesVectorLayerIdpercent-encodes it. The two agree for every name needing no encoding, so a store layer carrying the control's own ids — the archive kept whole, or a split part, which keeps the ids naming its own source layer — is recognised under the encoded scheme alone until a name holds a/, a space or non-ASCII. Thenlayer-syncdecides the source layer has no native layer and adds a second fill/line/circle trio on top of the control's: drawn twice, and only the control's copy answers the panel. Both schemes are therefore matched, and only ids naming a source layer the store actually holds are kept.
What the user ticked is deliberately not inferred from those ids:
selectedSourceLayers is a documented field of the exported
PMTilesLayerControlState handed to every handler, so pmtilesLayerOptions
reads it and the compiler checks it — the rules for a stale selection, and for
the archive ids the control reuses across a panel close, are written at that
function and at addPMTilesArchive. A reused id is the one case GeoLibre cannot
repair: two archives then name one MapLibre source, the first to sync wins it
and the other draws nothing, so addPMTilesArchive warns rather than pretending
otherwise — while an archive that takes a layer over outright is drawn
correctly, keeping the name, folder and styling of the one it replaced.
tests/pmtiles-control-contract.test.ts drives a real control against a
real archive, through the real layeradd handler into the store, and fails if
the id scheme moves or the selection stops reaching the handler.
-
Line decorations on a PMTiles archive. Flow arrows on a vector archive are a GeoLibre-owned symbol layer on the control's source, and MapLibre refuses to remove a source a style layer still reads. Since 0.32 every way the control drops an archive removes the other style layers reading its source first, so GeoLibre no longer wraps the private
_removeLayer.tests/pmtiles-control-contract.test.tsdrives the real control on MapLibre- and Mapbox-shaped maps and fails if the decoration strands the source again. -
The AddVectorControl's layer id rule (
upstreamUrlLayerId/flatGeobufLayerName,packages/plugins/src/plugins/components/flatgeobuf.ts) mirrors how the FlatGeobuf panel'sAddVectorControlnames a layer: the trimmed Layer Name field, else the URL's last path segment without its extension, else a generatedaddvec-*id. The typed name is not onAddVectorLayerInfo, so GeoLibre reads it from the field and, failing that, from an id that is not the URL-derived one. If the rule drifts, a typed name still wins while the field holds it, but a URL-named layer shows its raw id (undecoded) instead of the file name.tests/flatgeobuf-layer-name.test.tsuses a fake control, so after a bump add a FlatGeobuf URL with and without a Layer Name and check the Layers panel. - The MeasureControl's panel and source id come from its public
getPanelElement()andgetSourceId()(0.32+), read throughmeasurePanelElement/measureSourceId(packages/plugins/src/plugins/terrain-measure.ts): the panel carries GeoLibre's Terrain (3D)/heading sections and the resize styling, and the source id is howlidar-measure-mirror.tsfinds the geometry it redraws above a LiDAR point cloud (#2533). Since 0.32 the control also re-adds its measured line and polygon onstyle.loaditself, which GeoLibre used to heal after a basemap swap (#3471). After a bump, still confirm the Terrain section appears, a measured line shows inside a point cloud, and a measured line survives a basemap change. - The measure paint (
MEASURE_LINE_COLOR/MEASURE_LINE_WIDTH/MEASURE_FILL_COLOR,packages/plugins/src/plugins/lidar-measure-mirror.ts) is passed to the control explicitly rather than left to its defaults, because the deck.gl mirror has to repaint the same geometry in the same colour. Change one form and change the RGBA twin beside it;tests/lidar-measure-mirror.test.tsasserts the pair agrees. - Theme defaults for GUI-created overlays (
themeHtmlControlOutputs,themeLegendControlOutputs,themeColorbarControlOutputsinpackages/plugins/src/plugins/components/{html,legend,colorbar}.ts) call each GUI control's publicsetOutputStyle(0.32+) withGEOLIBRE_GUI_OUTPUT_STYLE(var(--geolibre-bg)/var(--geolibre-fg)), so the on-map legend/colorbar/HTML surfaces follow the app theme; the GUI constructor'sbackgroundColor/fontColoroptions only style the editor panel.createComponentsControl(maplibre-components.ts) applies the same to the ControlGrid's internally created children, and still wraps each child'sonAddto add the standalonegeolibre-*theme class plusgeolibre-grid-child. After a bump, toggle the app theme with a legend, colorbar and HTML overlay on the map, from both the Controls menu and the Components grid. - Theme overrides in
index.cssassume the component/Layer Control/Street View stylesheets may load afterindex.css(they arrive with lazily imported chunks), so a same-specificity override loses. Overrides of single-class vendor rules are prefixed withhtmlto win regardless of order; keep that when adding new ones. - The Zarr layer popup table class (
maplibre-gl-zarr-layer-popup-table) is re-themed inindex.css: upstream hardcodes#555/#333cell text and#eeerow rules for a white popup, which is near-invisible on the dark popover.tests/upstream-contracts.test.tschecks the class still ships; after a bump, click a Zarr layer in dark mode and confirm the popup reads. - The PMTiles feature-picking popup classes (
maplibre-gl-pmtiles-popup*) are re-themed inindex.cssthe same way: upstream hardcodes a white table with a#f0f0f0header.tests/upstream-contracts.test.tschecks the classes still ship; after a bump, enable feature picking on a PMTiles layer, click a feature in dark mode and confirm the table follows the theme.
maplibre-gl-basemap-control (packages/plugins/package.json)¶
BASEMAP_PANEL_SELECTOR / BASEMAP_ROW_SELECTOR / BASEMAP_ROW_ID_ATTR
(packages/plugins/src/plugins/basemap-thumbnails.ts) copy the DOM names the
control renders and exports (0.15.0 and later): .basemap-control-panel,
.basemap-control-result and data-basemap-id, which the Basemaps panel's
thumbnails hook into to find rows and join each one back to its catalog entry.
They stay copies so the thumbnails module does not pull the control's chunk;
a renamed class would fail nothing at build time, so
tests/basemap-thumbnails.test.ts compares them with the package's exports and
builds a real control to assert its rendered panel.
The same file's hasUnresolvedPlaceholder deliberately matches the complement
of the tile tokens it substitutes rather than mirroring that package's credential
placeholders ({api-key}, {aws-region}), so a new provider's placeholder is
skipped instead of being fetched literally. Keep it that way rather than
enumerating placeholder names.
maplibre-gl-vector (packages/plugins/package.json)¶
MAX_VECTOR_BYTES (packages/plugins/src/plugins/remote-file-formats.ts) copies
MAX_REMOTE_FILE_BYTES, which that package exports from 0.12.0 (2 GiB:
DuckDB-WASM holds remote file sizes in 32 bits). It stays a copy so the browse
panels never import the control's chunk. If it drifts, the remote-browse panels
(Source Cooperative, Hugging Face) silently block GeoParquet the engine could
now open, or offer an Add that is certain to fail. Updating the constant is
enough: the limit the user is shown is rendered from it, not written into the
copy. tests/upstream-contracts.test.ts compares it with the export.
remote-file-formats.ts is the single home for this and the other
format/reader/size rules those panels share — a per-panel copy would miss this
check, so add new browse panels against that module rather than duplicating it
(source-coop-api.ts re-exports it under its own names for compatibility).
Adoption (adoptVectorControlLayers in vector-layer-sync.ts, #2715) hands the
control's small GeoJSON-mode layers to GeoLibre, and leans on three things the
package documents as API since 0.12.0. getLayerGeoJSON must return the whole
collection for a renderMode: "geojson", ingestMode: "table" layer. removeLayer must drop
the layer's DuckDB table as well as its map source, or adoption keeps two copies
of the data (the drop is asynchronous and unreported). And KML_ICON_PROPERTY
copies the exported KML_ICON_URL_PROPERTY, the feature property the control's
KML/KMZ icon layer filters on (__geolibre_kml_icon_url); a layer carrying it
stays with the control, so a rename upstream would adopt KML layers and drop
their icons. Re-check all three on a bump (the contract test compares
KML_ICON_PROPERTY with the export).
maplibre-gl-lidar (packages/plugins/package.json) — half checked by the compiler¶
The space-effects engine raises the MapLibre canvas to z-index: 4 so its
starfield canvases can sit underneath. That package renders point clouds into an
overlaid deck.gl canvas which it parks in the canvas container, directly
after the map canvas, tagged DECK_CANVAS_CLASS
(maplibre-gl-lidar-canvas). effectsOverlayCss()
(packages/plugins/src/plugins/maplibre-effects.ts) hands that wrapper the
canvas's own z-index. Drop the rule and the wrapper falls below the raised
canvas, hiding the point cloud outright; drop the re-parenting upstream and the
wrapper goes back to covering the Measure/Colorbar/Legend/HTML/Bookmark panels
(#2530).
lidar-measure-mirror.ts draws the Measure tool's line/polygon into that same
overlay (LidarControl.getDeckOverlay()) with depthTest: false, the trick the
plugin's own cross-section line uses to sit above the points. It is added with
addLayer(id, layer, { overlay: true }) (0.21+), which draws it after every
point cloud chunk, including chunks that stream in later; the point cloud
annotator's highlight, box and vector layers use the same flag. One thing is not
compiler checked: the geometry is read from the MapLibre/Mapbox geojson
source's _data field, since neither library exposes a public reader. Losing it
costs only the mirror — the measured line goes back to being hidden inside the
cloud, which is what #2533 was. tests/upstream-contracts.test.ts checks both
shapes against the real libraries (a real MapLibre GeoJSONSource, and the
mapbox-gl bundle's setData).
The class is a hand-kept copy of the package's DECK_CANVAS_CLASS, not an
import: maplibre-gl-lidar builds into its own lazy chunk, and importing even
this one string would pull that chunk onto the startup path.
tests/effects-settings.test.ts builds its expected selector from the package
export, so a rename upstream fails npm run test:frontend. The placement
is not visible to the compiler, so
e2e/lidar-canvas-stacking.spec.ts mounts the real control and asserts the
resulting DOM order and z-indices — run it on a bump
(npx playwright test e2e/lidar-canvas-stacking.spec.ts --project=features).
The point cloud annotator's Full detail in view calls loadRegion /
clearPinnedRegion (0.20+) and decides whether a cloud qualifies without an
upstream flag: a streamed COPC is one whose source contains .copc. and whose
nodeRanges carry octree keys rather than "file"
(canLoadFullDetail in point-cloud-annotation/index.ts). Its saved labels
also assume a pinned region's nodes keep their octree keys, so a bump that
changes node keys or pinning semantics must rerun
e2e/point-cloud-annotation.spec.ts ("loads the view at full detail").
The annotator's label encoding (delta-varint point index, then a class byte or a
varint instance id, raw DEFLATE, base64; label-store.ts) is decoded in three
places the compiler cannot link: geolibre.project (Python reader),
geolibre.pointcloud (pre-labels and labelled-file rewrites) and the embedded
job script in backend/geolibre_server/geolibre_server/app/pointcloud.py
(/pointcloud/apply-labels, which runs on the conversion runtime and cannot
import the Python package). Their tests share app-encoded fixtures
(Y2BkWcP0ahHLfyDgBwA= for instance ids), so a change to the format must update
all three and the fixtures together. The COPC node order they rebuild from the
hierarchy (data nodes sorted by chunk offset) must match the order
maplibre-gl-lidar's nodeRanges index points within a node.
The ?data= LiDAR deep link leans on two more things the compiler cannot see.
isStreamedLidarUrl (apps/geolibre-desktop/src/lib/data-url.ts) copies the
package's exported isStreamedPointCloudUrl (0.22.0 and later), which
LidarControl.loadPointCloud routes through (an /ept.json suffix or a
.copc. in an http(s) URL streams; anything else downloads whole), so that only
whole downloads get the size check. It stays a copy to keep the lidar chunk off
the startup path. If upstream changes that routing, update the copy, or a
streamed file gets a needless size check and a downloaded one skips it. Note
that a COPC stream that fails falls back to a whole download, which then skips
the size check. addLidarLayerFromUrl also relies on load firing, and adding
the store layer, before loadPointCloud resolves; it throws if not.
tests/lidar-url-layer.test.ts pins the GeoLibre side of both, and
tests/upstream-contracts.test.ts compares the copy with
isStreamedPointCloudUrl over a set of URLs.
The point cloud annotator (packages/plugins/src/plugins/point-cloud-annotation/)
edits the control's loaded points through the point-editing API the package
added in 0.18 (getPointCloudData, refreshPointColors, getRenderSettings,
pauseStreaming/resumeStreaming, isStreamingLoading,
DeckOverlay.getViewport), all called from lidar-access.ts. Two things are not
compiler checked. Edits write into the arrays getPointCloudData returns, which
relies on them being the buffers the layers render from (for a streamed cloud,
views of the loader's buffers). Saved labels are keyed by nodeRanges
((node key, index - start)), so a change in how the loaders order a node's
points would silently re-apply labels to the wrong points. ASPRS_CLASSES in
classes.ts hand-mirrors the package's CLASSIFICATION_COLORS (exported since
0.22.0, kept as a copy for the same startup reason);
tests/point-cloud-annotation.test.ts reads the real colours back through
ColorSchemeProcessor and fails on drift. Run
npx playwright test e2e/point-cloud-annotation.spec.ts --project=features on
a bump.
maplibre-gl-layer-control (packages/map/package.json)¶
packages/map/src/layer-control-host.ts drives the on-map layer control
through its public API only (0.19.0 and later): the basemapLayerIds option
when there is no fetchable basemap style URL, setLayerState to mirror store
visibility, opacity and names into the built panel (and to add the Background
row on styles with no root basemap layers), setLayerOrder to put the panel
back after a reorder the store refused, and isCollapsed so a rebuild remounts
an open control open. The compiler checks all of it. Rebuild semantics are not
visible to it, so still drive the control in the app on a bump: toggle a
grouped layer, reorder inside a group, and hide a group.
maplibre-gl-splat (packages/plugins/package.json)¶
packages/plugins/src/plugins/components/splatting.ts drives
GaussianSplatControl through its public API only (0.3.0 and later): the
isIdReserved option keeps generated splat-N / model-N ids off layers
already in the store, a restore reloads each saved layer with
loadSplat/loadModel under its saved id and placement with flyTo: false,
the splatload/modelload events' placement is written onto the store layer
so a restore can put the asset back, and hide/show keep a control mounted
only for a restore out of sight. The compiler checks all of it;
tests/splatting-restore.test.ts drives a fake with that API. After a bump,
load a splat, save and reopen the project, and check it comes back in place.
@geoman-io/maplibre-geoman-free (packages/plugins/package.json) — change-mode and shape-marker internals¶
Geoman's change mode removes a vertex on right-click, but only for LineString,
Polygon and MultiPolygon. installGeomanActionPatches in
packages/plugins/src/plugins/maplibre-geo-editor.ts adds MultiLineString
(discussion #2750). It hooks geoman.actionInstances and wraps the
edit__change action's cutVertex, reading the featureData / markerData
payload and calling fireFeatureUpdatedEvent. None of that is checked by the
compiler. patch-package is no help here: the app loads the nested copies
under packages/plugins and apps/geolibre-desktop, not the root one.
If a bump renames the action key or those members, the wrapper silently stops
applying and MultiLineString vertices go back to logging
EditChange.cutVertex: feature not updated. tests/upstream-contracts.test.ts
checks the hook points in both nested copies' dist/maplibre-geoman.es.js
(text only: Geoman cannot be built without a live map). On a bump, still
right-click a MultiLineString vertex in Edit mode. If upstream adds MultiLineString support, delete the
wrapper.
The same hook fixes edge-marker placement (#3382). Geoman's shape-markers
helper (helper__shape_markers) puts each edge's "add a vertex" marker at
getSegmentMiddlePosition, which unprojects the midpoint of the two ends'
screen positions once, at the camera an edit starts with. On a zoomed-out
globe that strews the markers away from their edges. The hook overrides
getSegmentMiddlePosition on the helper instance with
mercatorSegmentMidpoint (geo-editor-geometry.ts) and must return
{ coordinate, path } with the path built as Geoman builds it (the start's
path ending in -1), since insertVertex splices at the edge end's path. The
helper has to be registered before startAction() builds the markers, or the
first set keeps Geoman's placement. tests/upstream-contracts.test.ts checks
these hook points too. On a bump, still open Edit geometry on a world layer
(the countries Parquet sample) zoomed out on the globe, zoom in, and check the
small midpoint markers sit on their edges. If upstream computes the midpoint
from coordinates, delete the override.
@carbonplan/zarr-layer — private minZoom¶
The Dynamical plugin draws its regional datasets (analyses and ensembles, which
pack long time series into each chunk) only from a minimum zoom, so a zoomed-out
view cannot read gigabytes. MapLibre's layer zoom range covers every render, but
zarr-layer also fetches once while it initializes, gated on its own private
minZoom field (set from the constructor's minzoom, read by
isZoomInRange). The Zarr control does not forward minzoom, so
applyRegionalZoomRange in packages/plugins/src/plugins/maplibre-dynamical.ts
writes the field on the live layer, guarded by a type check. If upstream renames
it the write silently stops, and only that first fetch loses its gate (the panel
also jumps the map to the minimum zoom before adding, which covers the common
case). tests/upstream-contracts.test.ts checks the field and its use; on a
bump, check whether the Zarr control now forwards minzoom so the write can go.
zarr-cesium (packages/map/package.json) — private internals¶
packages/map/src/cesium-zarr-imagery.ts draws Zarr layers on the globe and
relies on two things zarr-cesium does not export as API:
ZarrLayerProvideronly honours named matplotlib colormaps (its documentedcolorScaleoption is still not forwarded in 0.4.4), so GeoLibre writes the layer's ramp to the provider's privatesource.colorScale.colorsand callssource.updateColormapTexture(). If those move, the globe draws the default ramp and logs one warning.ZARR_DIMENSION_ALIASESmirrors zarr-maps-tiling'sDIMENSION_ALIASES_DEFAULT(the names it files undertime/elevation). Drift sends a selector to the wrong key, so the Time Slider steps nothing.
tests/cesium-zarr-imagery.test.ts constructs the real provider and imports
the real alias table, so both fail CI on a bump; run it, and check whether
upstream now forwards colorScale so the private write can go. zarr-cesium also
imports the cesium wrapper, which apps/geolibre-desktop/vite.config.ts
aliases to @cesium/engine: keep that alias if a bump adds more cesium
imports, or the globe loads a second engine.
maplibre-gl-planetary-computer (packages/plugins/package.json): client, restore, and sync contract¶
GeoLibre drives this library through its public API only (0.5.0 and later):
maplibre-planetary-computer.ts hands the control a STACClient built from
planetaryComputerStacClientOptions() (planetary-computer-stac.ts), restores
saved layers with addItemLayer / addMosaicLayer and their id option, and
adds its own buttons through customActions (planetary-computer-actions.ts).
Nothing reaches into a private field anymore, but four behaviors are still
relied on without a type to enforce them:
- Search is a
GET /search. The Planetary Computer API has rejected the CORS preflight a JSONPOST /searchneeds, so a POST fails with "Failed to fetch" in the browser and the Tauri webview. GET is the library default; if that default changes, every search in the panel and the AI Assistant breaks. - The collection list falls back to the bundled snapshot.
planetary-computer-collections.jsonis used when the live/collectionsrequest cannot be read..github/workflows/refresh-planetary-computer-collections.ymlregenerates it monthly and opens a pull request; runnpm run gen:planetary-computer-collectionsto refresh it by hand, then format the file (npx oxfmt --write packages/plugins/src/plugins/planetary-computer-collections.json, or let the pre-commit hook do it): the script writes it minified, and the committed copy is the formatted output. updateLayerstoresvisibleandopacityverbatim before emittinglayer:update. The store-to-control and control-to-store sync both compare with===; a library that rounded or coerced the values would make toggling visibility or opacity in the Layers panel loop forever.addMosaicLayerwithmosaicIdadds the layer synchronously. The restore path registers the mosaic's search itself, then adds the layer while the store sync is suspended. If the add became asynchronous, itslayer:addevent would fire unsuspended and drop the saved layers not yet restored.
tests/upstream-contracts.test.ts checks all four against the installed
package, and tests/planetary-computer-stac.test.ts runs the real client with
GeoLibre's options. Run both on a bump. The render presets live upstream too:
the Python API and the MCP server name them in docstrings
(python/src/geolibre/mcp/server.py, skills/geolibre/references/mcp-tools.md),
so update those lists when a preset is added or renamed.
maplibre-gl-raster — stretch and gamma curves¶
buildContinuousColormapRgba (through invertRasterAdjustments,
packages/plugins/src/plugins/raster-symbology.ts) mirrors the render
pipeline's value adjustments by hand, inverted. Value-range opacity paints
its alpha into the injected 256-wide colormap texture, so it has to map a
texture column back to a data value — and the renderer samples that texture
after rescale, the stretch curve and gamma. The mirror therefore applies each
curve's inverse, in the reverse of the renderer's order — gamma first, then
the stretch:
- gamma — renderer
pow(x, 1 / max(gamma, 0.0001)), mirrorpow(t, max(gamma, 0.0001)) sqrtstretch — renderersqrt(x), mirrort * tlogstretch — rendererlog(1 + 99x) / log(1 + 99), mirror(100^t - 1) / 99
The package exports the same curves as applyAdjustments /
invertAdjustments (0.15.0 and later), but importing them here would put the
whole ~0.35 MB raster chunk on the startup path, so invertRasterAdjustments
in raster-symbology.ts stays a hand-kept copy.
tests/upstream-contracts.test.ts compares it numerically with the exported
invertAdjustments for every stretch and a range of gammas, so a reordered
pipeline, a changed curve or a retuned log strength fails
npm run test:frontend. Run tests/raster-symbology.test.ts too.
maplibre-gl-raster: pixel inspector click filter¶
packages/plugins/src/plugins/maplibre-raster.ts passes
rasterInspectorClickFilter to the control's public setInspectorClickFilter
(0.15.0 and later), so the pixel inspector ignores a click that a drawing map
tool (Measure, the Geo Editor) has claimed (#3237). Upstream's contract is that
the filter returns true to inspect a click and false to ignore it;
tests/upstream-contracts.test.ts pins the GeoLibre side against a claimed and
an unclaimed click.
maplibre-gl-raster — rasters stay out of the depth buffer¶
The package draws deck.gl rasters with depthWriteEnabled: false. Each grid
gets different mesh triangles, so with depth writes on, a raster under another
one on a different grid punches stable holes in it (#3285). Nothing errors, so
tests/upstream-contracts.test.ts checks the published bundle for the flag. If
that test fails, confirm the new version still keeps rasters from fighting
before changing it.
maplibre-gl-raster — checked by the compiler¶
GeoLibreCogRenderEngine (packages/plugins/src/types.ts) mirrors the
RenderEngine union that package exports (maplibre-gl-raster |
cog-tiler-wasm | titiler). It is hand-written rather than imported because
types.ts is the public plugin-API surface and importing there would make that
package's types a hard dependency of every external plugin. Unlike the mirrors
above this one is checked by the compiler:
CogRenderEngineMirrorIsExact in
packages/plugins/src/plugins/maplibre-raster.ts asserts both directions of
assignability against the real imported type, so a renamed or dropped engine
identifier fails npm run typecheck. Nothing extra to do on a bump beyond letting
the build run.
maplibre-gl-raster — picker data copied to keep it off startup¶
apps/geolibre-desktop/src/lib/raster-picker-mirror.ts is a hand-kept copy of
the package's COLORMAP_OPTIONS, NORMALIZED_DIFFERENCE_INDICES,
CUSTOM_NORMALIZED_DIFFERENCE, indexById and guessBandForRole. The Style
panel's colormap and spectral index pickers need them as soon as they render,
and the package ships as one shared chunk, so importing even one constant put
the whole ~0.35 MB library on the startup path. Everything else GeoLibre takes
from the package is async and dynamic-imports it instead; keep new value
imports that way.
tests/raster-picker-mirror.test.ts compares every value and both helpers with
the package export, so a colormap added or renamed upstream fails
npm run test:frontend. Regenerate the copy from the package when it does.
Datum shifts (geotiff-geokeys-to-proj4, cog-tiler-wasm, maplibre-gl-raster)¶
The EPSG tables in geotiff-geokeys-to-proj4 leave the datum shift
(+towgs84) out for many national grids, and epsg.io's PROJJSON (the default
resolver of the raster control's deck.gl engine) carries none either, so
without help those rasters land 50 to 300 m off. packages/core/src/datum-shift.ts
holds a small table of shifts and adds them wherever GeoLibre builds a
projection from an EPSG code or GeoTIFF geokeys:
cog-tiler-wasm(the raster control's default engine) through itssetSourceCrsResolverhook (0.5.0 and later), installed byinstallCogTilerDatumShiftwherever GeoLibre imports the tiler and before the raster control loads;- the deck.gl engine through the control's
epsgResolveroption (packages/plugins/src/plugins/epsg-datum-resolver.ts); epsg-proj4.ts, the OBIAtoPixel,polygonizeLabels(which traces pixels on a stand-in grid and places the vertices through the same definition), the spectral profile, samgeo, point clouds and ArcGIS Zarr.
withDatumShift leaves a definition that already names a transformation, so
a geotiff-geokeys-to-proj4 bump that adds shifts to its tables needs no
change here. On a bump of any of the three packages, run
tests/datum-shift.test.ts; it checks the British National Grid against a
PROJ-computed point. Every entry in the table was checked against PROJ's best
transformation for that code (within 2 m; 15 m for the NAD27 mean). Re-check
any entry you add the same way.
One definition is replaced whole, not only shifted: EPSG:31300 (Belge Lambert
72) uses Lambert Conic Conformal (2SP Belgium), which proj4 lacks and the tables
give as a plain LCC 2SP, about 745 m off. REPLACED in datum-shift.ts gives it
the parameters of EPSG:31370, the same grid as a plain LCC 2SP. PROJ has the same
gap (it uses the plain LCC 2SP formulas for that method), so check it against the
worked example in EPSG Guidance Note 7-2, not against PROJ, as the test does. If
a bump of geotiff-geokeys-to-proj4 fixes the code, drop the entry.
tauri-plugin-persisted-scope — private on-disk format¶
PersistedScopeState (apps/geolibre-desktop/src-tauri/src/image_scope.rs) mirrors the
plugin's private bincode Scope structure so GeoLibre can remove legacy
per-photo grants before the plugin synchronously replays them at startup. On a
tauri-plugin-persisted-scope bump, compare the upstream struct's field order
and types against this mirror and run the Rust scope-cleanup tests. Bincode
encodes fields positionally, so an upstream layout change is not compiler
checked. This mirror is Rust-side, so tests/upstream-contracts.test.ts does
not cover it.
The bincode dependency itself is pinned to the 1.x line and Dependabot is
configured (.github/dependabot.yml) to skip its major bumps: the plugin writes
the file with bincode 1, so GeoLibre must decode and re-encode it with the same
wire format. Only move when tauri-plugin-persisted-scope moves. (bincode 3.0.0
is additionally a deliberately unbuildable release — its whole source is
compile_error!("https://xkcd.com/2347/").)
@tauri-apps/plugin-http — two upstream behaviors, not APIs¶
createNativeSidecarFetch
(apps/geolibre-desktop/src/lib/sidecar-fetch.ts) routes Windows sidecar traffic
through the plugin's native fetch and hardens it with two options whose effect
comes from reqwest's implementation rather than from any documented contract.
The option names are compiler-checked — NativeFetchInit is derived from
typeof import("@tauri-apps/plugin-http").fetch, so a renamed or dropped option
fails npm run typecheck — but the semantics are not, and both fail silently:
maxRedirections: 0maps toreqwest::redirect::Policy::none()(tauri-plugin-http/src/commands.rs). Without it the native client follows redirects, andreqwestonly stripsAuthorization/Cookieacross hosts, so the per-launchX-GeoLibre-Tokenwould be replayed to whatever a 3xx pointed at.proxy: { all: { url, noProxy: "*" } }is how the sidecar reaches the loopback directly. The plugin has no "disable proxy" switch, but anyClientBuilder::proxycall setsauto_sys_proxy = false(reqwest/src/async_impl/client.rs), andNoProxy::from_string("*")matches every host (hyper-util/src/client/proxy/matcher.rs), so the supplied proxy never intercepts either. This matters because reqwest'ssystem-proxyfeature is in the resolved graph (confirm withcargo tree -e features -i reqwest; the plugin's defaultmacos-system-configurationfeature pulls it in), and hyper-util's Windows reader copies the registryProxyOverridelist verbatim — it never expands the<local>token Windows writes for "bypass proxy server for local addresses". Drop this and a corporate-proxied Windows machine sends the sidecar request body and token to the proxy.
tests/sidecar-fetch.test.ts pins the options the adapter passes, which catches a
careless edit here but cannot exercise the Rust side. On a plugin bump, re-check
both behaviors against the sources above; the failure modes are a leaked token and
a sidecar that is unreachable only for proxied users, neither of which shows up in
CI or on an unproxied dev machine.
cesium / @cesium/engine / @cesium/widgets — runtime assets fetched by URL¶
The 3D globe pane loads its code from @cesium/engine but its runtime
assets from the cesium wrapper. Both are dependencies and both must move
together: [email protected] pins the matching @cesium/engine, and the prebuilt
Workers/Assets staged from the wrapper have to match the engine running them.
@cesium/widgets is a third dependency on the same clock — it depends on
@cesium/engine itself — and it supplies the globe's home, scene-mode and
fullscreen buttons (packages/map/src/cesium-widget-controls.ts).
The code imports the engine and the widgets directly rather than through the
cesium barrel, which re-exports both and defeats tree-shaking — the base-layer
picker, geocoder, info box and Knockout all shipped in the lazy chunk even when
the pane built a bare CesiumWidget. Reverting to import("cesium") adds
~340 KB back with no build error and no test failure.
After a bump, check all five — none of these fail the build:
- Asset copy.
vite-plugins/copy-cesium-assets.tscopiesAssets,ThirdParty,WidgetsandWorkersout ofcesium/Build/Cesiumintopublic/cesium/, keyed on the installed version. The copy is gitignored, so a stale one is refreshed automatically. A directory renamed or removed upstream fails loudly —cpSyncthrowsENOENTfrombuildStart, so the dev server and the build both stop. The silent case is the opposite one: a runtime directory added upstream is simply not inRUNTIME_DIRS, so it is never copied and only surfaces as a 404 when the globe reaches for it. CESIUM_BASE_URL.CesiumCanvas.tsxderives it from the app'sBASE_URL, not a hardcoded/cesium, so a sub-path deploy (the/demo/build) still resolves. Cesium reads it at import time; if the Workers 404 the render loop dies with no error boundary.- The stylesheets.
CesiumCanvas.tsxlinks four paths by hand (CESIUM_CSS_PATHS) rather than the 32 KBWidgets/widgets.css:Widgets/CesiumWidget/CesiumWidget.cssfor the canvas sizing, credit container and error panel;Widgets/shared.cssfor the.cesium-buttonchrome both toolbar widgets are built from; andWidgets/SceneModePicker/SceneModePicker.cssplusWidgets/FullscreenButton/FullscreenButton.cssfor those two widgets. Check every one after a bump — a<link>to a path upstream moved 404s silently, and the failure is cosmetic in a way no assertion catches: the globe still mounts, but its canvas stops filling the pane, or a toolbar button loses its size and renders 0x0. (The home button has no stylesheet of its own;shared.cssis all it needs.) - The widget classes and view models.
cesium-widget-controls.tsbuildsHomeButton,SceneModePickerandFullscreenButtondirectly and writes their tooltips throughviewModel.tooltip/tooltip2D/tooltip3D/tooltipColumbusView.index.cssthen restyles them through Cesium's own class names (.cesium-button,.cesium-toolbar-button,.cesium-sceneModePicker-wrapper). A renamed observable leaves the English default in place; a renamed class leaves Cesium's dark-blue chrome on a GeoLibre toolbar. Neither fails the build. Tooltip assertions live ine2e/cesium-primary-renderer.spec.ts, alongside control mounting and alignment checks. The fullscreen button is the fragile one: its tooltip is a read-only computed, so the translated string is written onto the element from afullscreenchangelistener and survives only because DOM listeners fire in registration order. If a bump makes the widget update its own title differently — batched on a microtask, or bound to another target — the label reverts to English after the first toggle, which is why the spec toggles fullscreen and re-reads the title rather than checking it once at mount.
Scene-mode lifetime: the 2D/3D/Columbus picker controls the current
CesiumWidget only. Recreating the widget, including switching to MapLibre
and back or reopening a project, starts in 3D. The project retains its
rendering engine and camera, but does not serialize the Cesium scene mode.
Scene-mode persistence is outside the toolbar integration's scope; adding it
requires an explicit project/store field and restoration for each Cesium pane.
- PWA globs.
**/cesium-*/**/Cesium-*invite.config.tskeep the chunk out of the app-shell precache and CacheFirst-cache it instead. A chunk renamed out of that pattern would be precached, adding megabytes to first load.
e2e/cesium-globe.spec.ts mounts the real engine keyless and drags the globe,
so it catches a broken CESIUM_BASE_URL or a dead chunk.
e2e/cesium-primary-renderer.spec.ts adds the toolbar: it asserts the three
buttons mount, carry translated tooltips, and share a right edge, which catches a
renamed view-model observable and the 0x0-button case of a missing stylesheet.
tests/upstream-contracts.test.ts adds the static half: Build/Cesium's
directories must equal RUNTIME_DIRS, every CESIUM_CSS_PATHS file must exist
and define each .cesium-* class index.css restyles, and the view models
must still carry the tooltip observables. None of these catches the bundle-size
regression — check that in the build output.
ArcGIS Maps SDK for JavaScript — loaded from Esri's CDN¶
The ArcGIS renderer (docs/arcgis-renderer.md) has no npm dependency.
packages/map/src/arcgis-sdk.ts imports the SDK's ES modules from
https://js.arcgis.com/<ARCGIS_SDK_VERSION>/@arcgis/core/… at runtime and
types the surface it uses by hand, so nothing here is checked by the compiler
against Esri's declarations. Bumping ARCGIS_SDK_VERSION is therefore a
manual check, not a Dependabot event:
- Module paths and default exports.
SDK_MODULESinarcgis-sdk.tslists every module the engine loads.tests/arcgis-renderer.test.tsonly checks the assembly against fakes; probe the real CDN (curl -sIeach URL returns 200) and mount a pane in a browser — a moved module rejects the whole load and the pane shows the error banner. Also check the deck adapter's lazy imports inpackages/plugins/src/plugins/arcgis-deck/overlay.ts:layers/Layer,views/2d/layers/BaseLayerViewGL2D, andviews/3d/webgl/RenderNode. Mount a deck.gl layer in both a 2D MapView and a local SceneView after a version bump; those imports are outside the engine's module registry. - The legacy widgets.
widgets/Zoom,Compass,ScaleBar,FullscreenandLocateback the built-in controls. Esri deprecated them in 4.32 in favour of web components and still ships them in 5.x with a console warning each; a release that drops them breakssetBuiltInControlVisible. The replacement is the@arcgis/map-componentsCDN build. Attribution already uses the 5.x path: the view draws it whileview.attributionVisibleis on, so the deprecatedAttributionwidget is not loaded. - The Compass widget's
viewModel.reset. The engine overwrites it so a click levels the pitch as well as the heading, as MapLibre's compass does. That member is not part of the typed surface, and a missingviewModelis skipped quietly, so a release that restructures it silently reverts the compass to heading-only. After a bump, tilt a scene and click the compass: both heading and tilt must return to 0. - The ESM CDN notice. The SDK logs "Only use ES modules from ArcGIS CDN for
testing" on load; Esri's documented production path is an npm build, which
this renderer deliberately avoids (see the size argument in issue #2421). The
AMD CDN (
<script src="https://js.arcgis.com/<version>/">) is the supported alternative if the ESM CDN is ever withdrawn. - Hit-test attributes.
GeoJSONLayergraphics only carry the fields the renderer reads unlessoutFields: ["*"]is set; identify depends on the compiler'sgl__idfield arriving.e2e/arcgis-renderer.spec.ts(opt-in,ARCGIS_API_KEY) is the check. - CSP and caching.
https://js.arcgis.com/is allow-listed inscript-srcandfont-srcintauri.conf.jsonanddocker/nginx.conf, and cached by thegeolibre-arcgis-sdkservice-worker rule invite.config.ts. The version is in every URL, so a bump mints new cache entries.
JAXA Earth API for JavaScript — loaded from JAXA's server¶
The JAXA Earth plugin draws its tiles with JAXA's "JAXA Earth API for
JavaScript", which is not published to npm.
packages/plugins/src/plugins/jaxa-earth-api.ts fetches the release named by
JAXA_EARTH_API_VERSION from data.earth.jaxa.jp, refuses it unless its
SHA-256 equals JAXA_EARTH_MODULE_SHA256, and imports it from a blob: URL.
The module has no imports of its own, so no CSP change is needed (blob: is in
script-src and the fetch runs under connect-src). The surface it uses
(ImageCollection, TileGenerator, image.ColorMap, Resampling) is typed
by hand, so the compiler does not check it against JAXA's jaxa.earth.esm.d.ts.
The checksum is the only trust boundary: once imported, the module runs with
the app's full privileges, including the Tauri IPC bridge on desktop. To move to
a new release, bump the version, compute the checksum from the exact bytes JAXA
serves (curl -s <module url> | sha256sum), review the module and the
new .d.ts diff against the members above before committing the hash, and add a
dataset from the panel in a browser. If JAXA republishes the
pinned file in place, every JAXA layer fails with a "module changed" error
until the checksum is updated.
Desktop CSP script-src allowlist¶
The desktop CSP (apps/geolibre-desktop/src-tauri/tauri.conf.json) does not
allow all of https://cdn.jsdelivr.net/npm/. It lists one version-pinned path
per package the app executes from jsDelivr. That blocks scripts from any other
package or version on the CDN; it does not verify what is served at an allowed
path, so a compromised release at a pinned path still runs, and CSP stops
checking paths once a request is redirected. Each version is owned by
something else, so a bump can move the URL the app requests while the CSP keeps
the old one. The packaged app then hits a CSP block that tauri dev never
shows, because tauri dev does not apply the CSP. tests/tauri-csp.test.ts
re-derives every path from its owner and fails when they disagree:
script-src path |
Owner (bump this, then update the CSP) | Loaded by |
|---|---|---|
pyodide/v<ver>/full/ |
PYODIDE_VERSION in pyodide-config.ts |
Pyodide's import() of pyodide.asm.js (Python Console) |
npm/@electric-sql/pglite@<ver>/, npm/@electric-sql/pglite-postgis@<ver>/ |
lockfile | pglite-loader.cdn.ts (SQL Workspace → PostGIS) |
npm/onnxruntime-web@<ver>/dist/ |
ORT_VERSION in packages/processing/src/ort.ts |
onnxruntime's import() of its wasm glue (object detection, SAM) |
npm/@duckdb/duckdb-wasm@<ver>/dist/ |
lockfile (apps/geolibre-desktop) |
maplibre-gl-components' DuckDB converter: a blob worker that calls importScripts() on the worker URL from getJsDelivrBundles() |
npm/@duckdb/[email protected]/, npm/[email protected]/dist/, npm/[email protected]/, npm/[email protected]/ |
URLs hard-coded in maplibre-gl-vector |
Add Data → Vector Layer (DuckDB, the GeoPackage patch, the MVT fallback) |
npm/apache-arrow@…, npm/tslib@…, npm/flatbuffers@…, npm/pbf@…, npm/ieee754@…, npm/@mapbox/point-geometry@…, npm/@mapbox/vector-tile@… |
jsDelivr's /+esm builds of the maplibre-gl-vector URLs above |
the import statements inside those bundles |
Blob workers inherit the page's CSP, so importScripts() in one is checked
against script-src. Workers started from the app's own files
(pyodide-worker.js, the DuckDB and Whitebox workers) carry no CSP at all:
Tauri only attaches the policy header to HTML responses. Wasm, wheels, PGlite
data and the CereusDB/gdal3.js binaries are fetched, so connect-src
covers them.
When maplibre-gl-vector changes a CDN URL, the test's
MAPLIBRE_GL_VECTOR_URLS assertion fails. Re-derive the transitive /+esm
paths by listing each new bundle's imports, for example
curl -s https://cdn.jsdelivr.net/npm/[email protected]/+esm | grep -o '/npm/[^"]*',
recursing into each result, then update ESM_TRANSITIVE_PATHS and the CSP
together.
The web build's CSP (the app location / in docker/nginx.conf) lists exactly
the same pinned paths, and the test fails when the two lists disagree, so update
both files in the same change. There too the app's own worker files carry no
CSP: nginx serves .js files from the static-asset location, which sends none.
The JupyterLite location allows only pyodide/ from jsDelivr, unpinned: the
site's Pyodide comes from whichever jupyterlite-pyodide-kernel release pip
resolves when the image is built.
A self-hosted VITE_PYODIDE_INDEX_URL mirror needs no CSP change in either
build: pyodide-console.ts fetches the mirror's entry scripts and runs them
from blob: URLs, and the vector-tools worker is not under the CSP. A rebuilt
app that loads scripts from any other host needs that host's path added to
script-src in both files.
'unsafe-eval' stays. maplibre-gl-vector builds its CDN loader with
new Function("url", "return import(url)") at module scope, and that module is
in the startup graph. Without 'unsafe-eval' the packaged app throws an
EvalError while booting and shows a blank window (verified on the Linux
WebKitGTK build). Other features compile strings at runtime as well: the
attribute field calculator (attribute-expression.ts), the raster calculator
(raster-client.ts), the AI Assistant's JavaScript tool, the Earth Engine code
editor, Emscripten embind glue (maplibre-gl-lidar, maplibre-gl-splat), and
ndarray, Ajv and Mapillary's filter compiler. 'wasm-unsafe-eval' alone is
not enough for any of these. Dropping 'unsafe-eval' starts with an upstream
maplibre-gl-vector change, and then each of these consumers needs a
replacement.
connect-src keeps https: and http:. Users add tile, COG, vector and
service URLs from arbitrary hosts (XYZ, WMS/WMTS, ArcGIS, STAC, PMTiles), and
some of those hosts are plain-HTTP servers on a LAN, so no fixed host list can
cover them. img-src keeps https: for the same reason.
style-src is exempt from Tauri's asset CSP rewrite. At build time Tauri
hashes every inline <style> in index.html into style-src and adds a
nonce. A hash or nonce makes the browser ignore 'unsafe-inline', so the
<style> elements that external plugins and several libraries inject at
runtime are blocked, and only in the packaged app (#3210, after the startup
placeholder style landed in index.html). "dangerousDisableAssetCspModification":
["style-src"] keeps the policy as written. That deliberately lets
'unsafe-inline' cover every inline style again, which is how 3.4.0 and earlier
behaved; script-src still gets Tauri's nonces and hashes.
tests/tauri-csp.test.ts fails if the exemption is dropped or widened.
yjs (packages/collab-core/package.json) — private document internals¶
The collaboration relay core (packages/collab-core/src/crdt-relay.ts) and
document model (crdt.ts) read a few Yjs internals that are not public API,
checked against yjs 13.6.33:
doc.store.pendingStructs/doc.store.pendingDs:RelayDoc.receivedrops updates whose dependencies never arrived. Covered by "drops updates whose dependencies never arrived" intests/collab-crdt-relay.test.ts.type._item.parent/_item.parentSub:touchedLayersfinds which layer a change landed under for the layer-lock check. Covered by the lock tests intests/collab-crdt-relay.test.tsandworkers/collab-node/test/crdt.test.ts.doc._transaction:ProjectDoc.writedetects a caller's open transaction. Covered by "writes correctly inside a caller's transaction" intests/collab-crdt.test.ts.- lib0 decodes an object key
__proto__by assignment;safeJsonincrdt.tsrebuilds such values. Covered by the__proto__tests there.
After a Yjs bump, run those suites (npm run test:frontend and
npm test -w geolibre-collab-node).
httpx (backend/geolibre_server_api/pyproject.toml) — private transport pool¶
The projects server's protection against identity-provider requests to internal
addresses (geolibre_server_api/egress.py) needs an httpcore network backend,
which httpx.HTTPTransport does not accept. GuardedTransport therefore
replaces the private HTTPTransport._pool with an httpcore.ConnectionPool
built on GuardedBackend. If _pool is renamed, building the transport raises
RuntimeError at startup. If httpx keeps _pool but stops sending requests
through it, the guard is bypassed with no error. After a bump, check that
HTTPTransport.handle_request still sends requests through self._pool, and
run python -m pytest backend/geolibre_server_api/tests/test_egress.py
(test_identity_provider_client_refuses_loopback makes a real connection
through the transport).
Managed uv pin (sidecar runtimes and desktop sidecar bootstrap)¶
When uv is neither configured (GEOLIBRE_UV) nor on PATH, both the sidecar
(backend/geolibre_server/geolibre_server/app/runtime.py) and the desktop app
(apps/geolibre-desktop/src-tauri/src/uv_bootstrap.rs) download a pinned uv
release archive and verify its SHA-256 before extracting it. UV_VERSION and
UV_RELEASE_SHA256 in runtime.py are the source of truth; the Rust constants
mirror them and backend/geolibre_server/tests/test_runtime_uv_bootstrap.py
fails when they differ. To bump uv, take each digest from the release's official
<archive>.sha256 asset
(https://github.com/astral-sh/uv/releases/download/<version>/<archive>.sha256),
never from a local download, and update both files in the same PR.
For a sidecar archive mirror, set GEOLIBRE_UV_DOWNLOAD_BASE_URL with the layout
<base>/<version>/<archive>. The former GEOLIBRE_UV_INSTALL_BASE_URL setting
is ignored with a warning because remote installer scripts are no longer used.
Shared dependency ranges¶
apps/geolibre-desktop and packages/plugins declare many of the same
upstream packages. If a bump moves the range in only one of them, npm can no
longer hoist one copy and nests a second under the workspace that disagrees:
the app bundles two versions, and the contract tests above check one copy while
the other runs. Dependabot opens one PR per manifest, so this is easy to merge
by accident. npm run check:shared-deps (scripts/check-shared-deps.mjs, run
in the CI "Lint and type check" job) fails when a package declared in both
manifests, in any dependency section, carries different ranges. Fix it by
giving both the same range and refreshing package-lock.json in the same PR.
One shared three¶
The app and its three-based plugins (maplibre-gl-3d-tiles, maplibre-gl-splat,
maplibre-gl-components, deck.gl mesh layers) share one copy of three. Two things
keep it that way:
- The upstream opengeos packages keep three out of their ES
distand declare it as a peer (maplibre-gl-splat>= 0.2.9,maplibre-gl-3d-tiles>= 0.5.11,maplibre-gl-components>= 0.31.2). An older release inlines its own three again. - The root
package.jsonoverridespinsthreeto the app's range, because@dvt3d/maplibre-three-plugindeclaresthree: ^0.178.0(0.178.x only) and would otherwise pull in a second, older copy.mapillary-jsalso declares an old three, but itsdistbundles its own copy and never imports it, so the override is harmless there. Opening the Mapillary viewer still loads that bundled 0.134 copy, the only remaining "Multiple instances of Three.js" warning.
When bumping three, move the override with the app's range, then run
npm ls three: it should list one version. If npm keeps a stale nested copy,
follow the lockfile clean-up in
Dependency updates and the audit allowlist.
Spark's dist embeds three inside its sort worker's source string. That copy runs in
a Web Worker and never registers as a second main-thread instance.
One a5-js, on the A5 v1 index¶
A5 v1 (a5-js 1.0) renumbered every cell: the cells are the same, but their
IDs are not compatible with v0 (a5-js <= 0.10). GeoLibre speaks v1 everywhere
(the A5 grid plugin and the DGGS tools in @geolibre/processing). Two
dependencies still lag:
@deck.gl/geo-layers9.4 declaresa5-js: ^0.10.0forA5Layer, which plugins reach through the plugin API. The rootpackage.jsonoverridesforces it onto the app'sa5-js(A5Layer only callscellToBoundaryandhexToU64, unchanged in v1). Drop the override once a deck.gl release depends ona5-js1.x, and checknpm ls a5-jslists one version.- The DuckDB
a5community extension built for the bundled DuckDB-WASM (DuckDB v1.5.1) is still on the v0 index; only DuckDB >= 1.5.6 gets the v1 build.packages/processing/src/a5-tools.tspasses every ID the extension returns throughmigrate(), and DGGS Compact runs A5 client-side ona5-js. When a@duckdb/duckdb-wasmbump moves to DuckDB >= 1.5.6, remove the migration (DGGS Generator/Binning would otherwise migrate v1 IDs a second time).
Adding a blend mode¶
Do not add a blend mode without checking it in the browser. MapLibre's blend
state covers the alpha channel too, and it composites a blended layer as one
viewport-filling quad, so any mode that does not reduce to "leave the destination
alone" at zero source alpha repaints the whole map. That is what disqualified
darken (a MIN equation erased the entire basemap to transparent black) and
subtract (a reverse subtract left the canvas at dstA - srcA, showing the page
through the layer). The shipped list is BLEND_MODES in @geolibre/core, and
both the unit test's blend simulator and the e2e spec pin their exclusion.
Only fill and line have a *-layer-opacity in the style spec, so only they
blend as a whole layer; circle and fill-extrusion blend per symbol and
visibly double-darken where symbols overlap on screen (measured under Multiply:
rgb(23, 77, 220) in the overlap vs rgb(76, 136, 222) on a single symbol). That
is upstream's limitation, documented in
Managing Layers; the test "has a layer-level composite for
fill and line only" fails if a bump adds one of the missing properties, at which
point extend COMPOSITE_LAYER_TYPES and style-mapper together and drop the
caveat.
The Style-panel control (blendModeControl in StylePanel.tsx, rendered in each
of its terminal branches) is gated on !pluginOwnsPaint && !controlRendersLayer:
blending only reaches layers GeoLibre itself paints, so anything a control
renders or paints (3D Tiles, Gaussian splats, LiDAR, the COG raster control, and
Add Vector Layer, which sets customLayerType and controlOwnsPaint) is
excluded — layer-sync never applies fillPaint/linePaint to those, so the
*-layer-opacity that elects the composite never lands and a Blend menu there
would silently do nothing. Keep docs/user-guide/layers.md and
tests/layer-blend-modes.test.ts ("the layer kinds the Blend control is offered
for") in step with that gate; build the test's mocks the way the real controls
build their metadata, or they pass on shapes that never occur.
CDN cache browser tests¶
e2e/pyodide-cache.spec.ts runs against the production service worker and
requires HTTPS access to cdn.jsdelivr.net. It loads the pinned Pyodide
runtime script and its npm CDN copy used to create a real opaque response.
Run it with npm exec playwright -- test e2e/pyodide-cache.spec.ts --project=features.
The dev server has no service worker, and offline-only runners cannot execute
this network-bound regression. Keep real browser CORS and Cache Storage
semantics in the test rather than replacing responses with route mocks.
Coverage floors¶
The :coverage test variants run the same suites and print a coverage summary;
CI runs them so every build reports coverage. They are gated on a floor:
test:frontend:coverage fails below 78% lines / 78% branches / 63% functions.
The three Python suites are gated with pytest-cov:
| Suite | Command | Floor | Where the floor lives | CI |
|---|---|---|---|---|
Sidecar (backend/geolibre_server) |
npm run test:backend:coverage |
76% | --cov-fail-under in the root package.json |
ci.yml "Backend tests" (ci:backend) |
Projects and identity server (backend/geolibre_server_api) |
npm run test:server-api:coverage |
87% | --cov-fail-under in the root package.json |
ci.yml "Backend tests" (ci:backend) |
Python package (python/) |
npm run test:python:coverage |
88% | fail_under in python/pyproject.toml |
publish-python.yml "Test Python package" |
The Python package's floor sits in its own pyproject.toml rather than in
package.json because publish-python.yml only runs for changes under
python/ (and the app sources it bundles), so a floor kept in package.json
could change without that workflow running.
The floors sit a few points under the current numbers as a ratchet:
regressions fail CI, and when coverage rises comfortably above a floor, raise
the floor to lock in the gain. Measure in the environment CI installs (the
backend test extras, or the package list in publish-python.yml), since a
suite whose optional dependencies are missing skips tests and reports less.
Most of the sidecar's raster, conversion, OBIA and point cloud workers run as
subprocesses in production, where coverage cannot see them. Their tests call
each worker's main() in-process instead (_run_worker in
tests/test_workers_and_job_manager.py, and test_raster_workers_in_process.py
/ test_workers_in_process.py), which is what lets the floor count them; test a
new worker the same way.
The frontend report only counts files a test actually imports, so a module with no
test does not appear at all rather than as 0%. That is the part that bites:
writing the first test for a large untested module reads as a coverage
regression, because the module and everything it imports enter the denominator
at once. GeoLibre#1784 added a test that imported usePlugins.ts and so pulled in
the whole built-in plugin registry, 39 files, dropping function coverage 72.90% →
60.36% and reddening main. The fix is to test against a leaf module rather than
to lower the floor (GeoLibre#1888 extracted lib/plugin-layer-queries.ts;
geo-editor-geometry.ts in @geolibre/plugins is the same pattern). Check what a
new test transitively imports before assuming a coverage drop means the code got
worse. The untested module ratchet below
keeps the large modules that no test loads from staying out of sight.
test:frontend:coverage runs through scripts/coverage-check.mjs rather than
calling node --test directly. Node still enforces all three floors; the wrapper
only re-measures once when line coverage alone comes up short with every test
passing. Line coverage is nondeterministic on CI (GeoLibre#1889: two runs over
byte-identical sources reported 81.82% and 76.47%, 114 of 444 files differing on
lines and none on branches or functions), and it is not reproducible locally on
either Node 22 or 26. Branch and function shortfalls, and any test failure, fail on
the spot with no retry, so a real regression still fails fast. classify() is
exported and covered by tests/coverage-check.test.ts — change the retry policy
there, not by loosening a floor. If the retry starts firing regularly, fix the
measurement instead of widening the mitigation.
The backend coverage runs (and npm run ci, which calls the :coverage variants)
need pytest-cov, from the sidecar's dev extra and the identity server's
test extra. Install the test extra to
run the full backend suite — without the optional engines
(geopandas/rasterio/sedona/httpx) the vector/raster/SQL/ML tests skip themselves
and CI is green but hollow: pip install -e "backend/geolibre_server[test]".
Untested module ratchet¶
Because the report only counts imported files, a large module that no test
loads is invisible to the floors. npm run check:untested-modules
(scripts/check-untested-modules.mjs) makes those visible. It reads the lcov
report test:frontend:coverage writes to coverage/frontend.lcov, which lists
every file the suite loaded directly or transitively, and compares it with every
source file under apps/*/src and packages/*/src. Declaration files, index.*
barrels, locale catalogs, and generated files (an AUTO-GENERATED,
@generated, or DO NOT EDIT header, plus the Whitebox menu catalog) do not
count. It runs right after the coverage step in ci:frontend, so in CI's "Build
and test" job and in npm run ci; ci:web skips it because it does not measure
coverage. Run it locally after npm run test:frontend:coverage.
Every untested source file over 500 lines must be listed in
scripts/untested-modules-baseline.json with its line count, and the check
fails when:
- A new file over 500 lines appears that no test loads. Add a test that imports it, or a leaf module extracted from it (see above for why testing the leaf keeps the coverage floors steady). A renamed baseline file shows up as new: move its entry to the new path.
- A baseline file grows more than 50 lines past its recorded count with still no test loading it. Add a test, or put the new code in a tested module.
The baseline only shrinks. When an entry gains a test, drops to 500 lines or
fewer, or is deleted, the check prints a hint;
npm run check:untested-modules -- --prune removes those entries and lowers the
counts of entries that shrank, and never adds one. Do that in the same PR so the
gain is kept. --write-baseline rewrites the file from scratch and exists only
to bootstrap it; do not use it to absorb a new untested module.
The same command also prints, without gating, the backend sidecar modules that
have no test_<module>.py or test_<module>_*.py in
backend/geolibre_server/tests. Some are exercised through other test files
(the route tests drive app/main.py), so treat the list as a prompt to check,
not a count of untested code.
Lint warning ratchet¶
npm run lint runs two sequential passes, each with its own warning ratchet
in the root package.json: lint:syntax allows 79 ESLint warnings and
lint:typed allows 35 floating-promise warnings. Their combined budget remains
114; fixing one kind cannot make room for a new warning of the other kind.
The warnings come from react-hooks/exhaustive-deps,
@typescript-eslint/no-explicit-any, the type-aware
typescript/no-floating-promises (desktop app, package and worker src/
only, checked against each file's nearest tsconfig.json), and
local/no-physical-tailwind (eslint-rules/no-physical-tailwind.mjs, the
right-to-left rule from Internationalization),
and two eslint-plugin-jsx-a11y rules (control-has-associated-label,
no-static-element-interactions) on app and package .tsx.
ESLint retains the syntax, accessibility, React, and local architecture rules.
The semantic pass uses pinned Oxlint and oxlint-tsgolint versions through
scripts/lint-typed.mjs and .oxlintrc.json. It does not load every workspace's
TypeScript program into ESLint's process. Native compiler/configuration errors
fail the command. Source roots deliberately exclude vendored Tauri projects;
the MCP App is outside the existing typed-rule scope. Full type checking still
runs separately in CI.
A local comparison on 2026-11-24 used the original ESLint configuration and the new complete command sequentially on the same source snapshot (Linux, 16 available CPUs, Node 26.10.0, one run each):
| Lint command | Wall time | Largest child peak RSS |
|---|---|---|
| Original type-aware ESLint | 95.79 s | 9.58 GiB |
| Syntax ESLint + typed Oxlint | 52.28 s | 2.12 GiB |
All 114 diagnostic locations and rules matched. The baseline used a 16 GiB
Node heap limit; the new command used the default heap. RSS was measured with
resource.getrusage/wait4 and describes the largest child process, not
aggregate process-tree memory. These are single local measurements, not CI
performance guarantees. Pinned native backend upgrades still need semantic
fixtures and comparison against the existing diagnostics.
eslint-plugin-jsx-a11y 6.10 declares ESLint up to 9 as a peer. It runs under
ESLint 10, and the overrides entry for it in the root package.json points its
peer at the installed ESLint. When the plugin publishes ESLint 10 support, drop
that override. If a future ESLint breaks the plugin, npm run lint fails
loudly; pin ESLint or disable the two rules rather than reaching for
--legacy-peer-deps.
- A PR adds a warning: fix it. For a floating promise that is a deliberate
fire-and-forget, prefix the call with
voidand make sure it handles its own rejection. For a class that must stay physical (a map-anchored overlay, say), add// eslint-disable-next-line local/no-physical-tailwind -- <why>. Do not raise the limit. - A PR fixes warnings: lower the corresponding syntax or typed limit to its new count in the same PR, so the gain is kept.
- A disable directive goes stale: ESLint reports an
eslint-disablecomment that no longer suppresses anything as an error (reportUnusedDisableDirectives), so the ratchet cannot be dodged by a leftover directive hiding a future warning on that line. Delete it (eslint --fixremoves it, but leaves a blank line and any--reason that wrapped onto the next line, so tidy those up). In JSX children a directive has to be a{/* eslint-disable-next-line ... */}expression comment. Typed exceptions use// oxlint-disable-next-line typescript/no-floating-promises -- <why>. The typed runner reports stale Oxlint directives as errors even below its warning budget. It leaves unusedeslint-disablediagnostics to ESLint, because the typed pass does not run the rules those comments suppress. Do not use an ESLint directive for the migrated promise rule: ESLint's unused-directive check rejects it. - A PR turns on a new rule: the one time the limit goes up. Raise it by exactly the new rule's count on the code as it is, say so in the PR, and fix those warnings over time like the rest.
Test type-check ratchet¶
The frontend tests run under node --import tsx --test, and tsx strips types
without checking them, so a test fake that drifts from the interface it stands
in for (a renamed property, a new required member, a changed argument) still
runs and still passes. npm run typecheck:tests closes that gap: it runs
tsc --noEmit over three projects in tests/ and fails when the number of
errors in test files rises above --max-errors (in the root package.json).
It runs in CI's "Lint and type check" job and in npm run ci / ci:web.
tests/tsconfig.jsonchecks every test against the DOM lib with the Node, React and Vite types and the ambient.d.tsfiles the app and packages compile with.allowJslets tests import thescripts/*.mjsthey cover with inferred types.tests/tsconfig.workers.jsonchecks the tests that importworkers/tilesorworkers/vieweragainst@cloudflare/workers-types, andtests/tsconfig.ai-proxy.jsonthe ones that importworkers/ai-proxyagainst that worker's generatedworker-configuration.d.ts. The Workers runtime types redeclare the DOM globals, so these tests cannot share the main program. A new test that imports worker source goes in the main project'sexcludeand one worker project's list; the script fails if an excluded test is in neither worker project.
Only errors in tests/ count. A test's imports pull product source into the
program, and that source is checked by its own workspace's tsconfig; an error
it reports under the tests' settings (DOM-using @geolibre/core code under the
Workers types, say) is printed for information and not counted.
The limit works like the lint warning ratchet:
- A PR adds a type error in a test: fix it. Build fakes against the real
type: spread
DEFAULT_LAYER_STYLEfor a partialLayerStyle, usetests/helpers/layer-fixtures.tsfor a layer, and cast a deliberately partial fake of a large interface (a MapLibreMap, a Cesium viewer) once throughunknownin a small typed helper rather than at every call. Do not raise the limit. - A PR fixes type errors: lower the limit to the new total the script prints, in the same PR.
Run node scripts/check-test-typecheck.mjs --max-errors 0 --verbose to list
every counted error, or npx tsc --noEmit -p tests/tsconfig.json for tsc's own
output.
Boot bundle budget¶
npm run build fails when the JS the app entry imports statically (what
index.html modulepreloads before the shell mounts) grows past either budget
in apps/geolibre-desktop/boot-budget.json, or when it contains Cesium. The
check is bootBundleBudgetPlugin in apps/geolibre-desktop/vite-chunking.ts.
| Budget | Limit | Measured when set |
|---|---|---|
rawBytes |
3 MiB, minified | ~2.2 MB |
gzipBytes |
900 KiB, gzip level 9 | ~680 kB |
Gzip is the closer proxy for what a browser downloads; raw is what it parses.
Most regressions trip both, because they come from a chunk-grouping change
that drags a whole lazy package (Cesium, DuckDB, a maplibre-gl-* plugin) onto
the boot path. The error lists the largest boot chunks. Fix the grouping in
CODE_SPLITTING_GROUPS / manualChunks rather than raising a budget; raise
one only after confirming the new eager code belongs at boot, and say so in the
PR.
npm run bundle:report (after a build) writes bundle-report/bundle-report.md
and .json: every JS/WASM asset in dist/assets with raw and gzip sizes, the
boot set read from the built index.html against both budgets, and the size of
each top-level dist entry. CI's build job uploads it as the bundle-report
artifact and appends the Markdown to the job summary, so two runs can be
compared without rebuilding.
Workers do not share chunks with the main build¶
Vite bundles each new Worker(new URL(...)) as a separate build, so anything a
worker imports is emitted again even when the main thread has the same module.
That once shipped h5wasm (libhdf5, ~4.8 MB) twice, once for the local NetCDF
reader and once inside netcdf-remote.worker.ts. The main build now emits h5wasm
as an explicit chunk and the worker imports it by URL
(apps/geolibre-desktop/vite-plugins/shared-h5wasm.ts), and the build fails if
anything but exactly one hdf5_hl-*.js is emitted. A new worker that
imports a large library should do the same, or accept the duplicate knowingly;
the bundle report makes a second copy easy to spot.
Dependency updates and the audit allowlist¶
Dependencies are watched two ways: Dependabot (.github/dependabot.yml) opens
grouped weekly update PRs for npm, pip (backend + python/), cargo, and Actions,
and CI runs npm run audit:ci (blocking, in the "Lint and type check" job) plus a
non-blocking pip-audit of the resolved backend environment (in the "Backend
tests" job).
audit:ci is scripts/audit-check.mjs, a thin wrapper over npm audit
--omit=dev that still fails on every high/critical advisory except the ones
listed in its ALLOWLIST. The wrapper exists because plain npm audit cannot
accept a single finding, so one unpatchable transitive advisory reddens every PR
until upstream ships a fix — which for an unmaintained leaf package may be never.
Only allowlist an advisory when there is no patched version to upgrade to and
the vulnerable code is unreachable from a GeoLibre runtime path, and say why on
both counts in the entry. Anything upgradeable gets upgraded instead. Stale entries
print a warning rather than failing, since the advisory database is a live service
and a transient omission must not redden an unrelated PR.
When the fix is a scoped overrides entry (such as @loaders.gl/compression →
fflate), npm 12 accepts it and npm ls then checks against the override's
range. The lockfile still lists the package's own declared dependency (fflate:
0.7.4), though, and npm keeps the old nested copy, so npm ls reports it as
invalid. Delete that package's
nested node_modules/.../<pkg> entries from package-lock.json (and from
node_modules), then run npm install again so it resolves them fresh. Confirm
with npm ls <pkg> before you commit.
If no other package already installs a copy that satisfies the override, npm
does not fetch one. It leaves the package out of the tree and npm audit
reports 0 vulnerabilities, which looks like a fix but isn't. That is why the
texture-compressor → image-size@^2.0.4 override needed a hand-written lock
entry: version, resolved, integrity, license, bin and engines, taken
from npm view <pkg>@<version> --json (npm 12 wraps that output in an array).
Check a fresh npm ci with npm ls <pkg> before you commit. That override
patches GHSA-w3rx-r6r6-pgpr and GHSA-5p2g-fcmc-qvqq, but image-size 2.x takes a
buffer rather than a path, so texture-compressor's own CLI can no longer read
image sizes. GeoLibre never runs it: only @loaders.gl/textures'
encodeImageURLToCompressedTextureURL, a Node-only encoder, spawns it via
npx. Drop the override once loaders.gl stops depending on texture-compressor
(4.5.x already makes it a peer).
Publishing @geolibre/core and @geolibre/map¶
Both are published to npm by .github/workflows/publish-packages.yml on each
GitHub Release, alongside @geolibre/embed. Their checked-in
main/types/exports point at TypeScript source, because that is how the
monorepo consumes them: Vite, tsc and tsx all resolve ./src/index.ts through
the package's own exports, so npm run dev and
node --import tsx --test tests/<name>.test.ts need no build step.
The npm tarball ships dist instead, and npm cannot express that split on its
own: unlike pnpm and Yarn it deliberately ignores entry fields nested under
publishConfig (npm/cli#7586), so a manifest that only states its dist entries
there publishes ./src/index.ts to consumers who never receive src. The
published entries therefore live under publishConfig, and
scripts/prepare-npm-package.mjs hoists them (and pins the "*"
@geolibre/core dependency to the release version) just before npm publish.
Point those top-level fields at dist and every frontend test that imports a
@geolibre/map subpath fails with ERR_MODULE_NOT_FOUND, because dist is
gitignored and nothing builds it before the suite.
tests/prepare-npm-package.test.ts guards both halves, including that each
published path is one the package's own tsdown entries actually emit
(--format esm --dts writes <entry>.mjs and <entry>.d.mts, not .d.ts).
The release workflow does build both packages, but a green build proves only that
the bundles were written, not that every path the manifest publishes names one of
them, so nothing else would notice that drift.
The bundled sidecar lockfile¶
backend/geolibre_server/uv.lock is committed (the root .gitignore ignores
uv.lock everywhere else and negates it for this one path). That project is
bundled into the desktop installers and launched with
uv run --frozen --project <resource dir> from src-tauri/src/sidecar.rs and
jupyter.rs — a
directory the user cannot write (C:\Program Files\…,
/usr/lib/GeoLibre Desktop/…). Ship it lockless and uv resolves, then tries to
write uv.lock there, fails with "Permission denied" and exits 2 — which reaches
the user as "Jupyter server exited before it was ready (exit code: 2)" with the
cause invisible.
So: any edit to that pyproject.toml's dependencies must land with a refreshed
lock (uv lock --project backend/geolibre_server). CI's "Check the bundled sidecar
lockfile is in sync" step (uv lock --check) fails if they drift.
The launch also passes --python 3.12 (SIDECAR_PYTHON_VERSION), the default
version of the Whitebox and conversion runtimes and the one CI tests. Without it uv
picks the newest Python available, and --frozen then fails outright if a locked
package has no compatible wheel or usable source distribution for it
(psycopg-binary on 3.15 did). Moving the pin rebuilds users'
sidecar-server and jupyter-server environments, dropping anything they
%pip installed, and that first launch needs network access unless the
interpreter and packages are already present, so mention it in the release notes
and check the lock has wheels for the new version on every
platform first.
Credentials must never reach a redistributable build¶
Anything we hand to someone else — the Jupyter wheel above all — must carry no credential of ours. Three properties of this build make that easy to get wrong, and every guard below blocks one of them.
apps/geolibre-desktop/vite.config.tsbridges bare shell vars into theirVITE_names —GOOGLE_MAPS_API_KEY→VITE_GOOGLE_MAPS_API_KEY, and the same forMAPBOX_TOKENandCESIUM_TOKEN. Convenient for local testing; it also means the build machine's shell is build input.- Something in the graph reads
import.meta.envas a whole object. Vite cannot tell which keys such a read wants, so it stops replacing per key and inlines the entire env record — everyVITE_var on the build machine — into every chunk that read reaches. Ours waspackages/core/src/runtime-env.ts; the one we cannot fix is@clerk/shared'sgetEnvVariable.mjs, which doesimport.meta.env[name]with a computed name, so the inlined record lands in theClerkGate-*.jschunk. python/hatch_build.pyskips each frontend build when its staged output (static/app/index.htmlorstatic/mcp/show-map.html) already exists andGEOLIBRE_FORCE_JS_BUILDis unset. A localpython -m buildcan therefore package assets left by earliernpm run build:embed/npm run build:mcp-appruns, with no JavaScript running at all.
The rules now¶
BUILD_ENV_KEYSinvite.config.tsis the allowlist ofVITE_names that may reach a bundle.pruneBuildEnv()deletes every otherVITE_var fromprocess.envbefore Vite reads it. Adding a new build-time var means adding it here — otherwise it silently resolves to undefined.CREDENTIAL_ENV_KEYSis the subset that authenticates as, and bills to, whoever ran the build. In a redistributable build these are blanked to""(blanked, not deleted, so a.envfile cannot reintroduce them). A build is redistributable whenGEOLIBRE_EMBED=1(the Jupyter wheel) orGEOLIBRE_STRIP_CREDENTIALS=1. The web deploy is not redistributable: it is our own site using our own referrer-restricted keys, and it keeps them.- Public-by-design identifiers stay in every build: the Clerk publishable key,
the Auth0 client ID and domain, the GEE OAuth client ID, the GA measurement ID.
publish-python.ymldeliberately injects the GEE client ID into the wheel. - Prefer
getBuildEnvironment()from@geolibre/coreover readingimport.meta.envyourself. A whole-object read re-opens cause (2) for every chunk it reaches, and nothing in the type system will tell you.
Each stripped credential resolves through getRuntimeEnvironment(), which
overlays window.__GEOLIBRE_RUNTIME_ENV__ from Settings → Environment variables.
So a wheel user supplies their own token and the affected surfaces degrade as
documented: Mapbox prompts in the basemap API-keys view, the 3D globe loses
terrain and Ion imagery (the pane itself still works), Protomaps basemaps are
hidden.
The scan¶
scripts/scan-credentials.mjs verifies the output. A build run by hand can
satisfy every rule above and still be wrong, and a third-party asset dropped into
the tree can arrive with a key already inside it — neither is visible from the
config. It runs in two places:
scripts/build-embed.mjs, before stagingdist-embedinto the Python package.python/hatch_build.py, before packaging any wheel or sdist — including the stale-assets path (3) above, which no JS-side guard can cover. This one needs no Node.
Both read scripts/credential-patterns.json, so the JS and Python scanners
cannot drift; the file is force-included into the sdist so an sdist → wheel build
is gated too. tests/credential-scan.test.ts covers it.
To scan any built directory by hand:
node scripts/scan-credentials.mjs apps/geolibre-desktop/dist-embed
When the scan fires after a dependency bump¶
allowedValueHashes in credential-patterns.json holds the SHA-256 of values
that match a pattern but are public by design — currently CesiumJS's built-in
default Ion token, which ships inside cesium and appears in every build. A
Cesium upgrade changes that token, so the guard will fire on the new one.
That is intended. Decode the payload before doing anything: CesiumJS's has
sub: "CesiumJS" and iss: "https://api.cesium.com". Only once you have
confirmed it is the vendor's own token, replace the hash. Never add a hash to
silence a finding you have not decoded — the whole point of the list is that it
is short and every entry was checked.
Bundled plugin drop-ins under apps/geolibre-desktop/public/plugins/<id>/ are
scanned too. They are third-party build artifacts that are not committed here, so
a hardcoded key inside one is fixed in that plugin's own repository, never by
allowlisting it. Note that removing such a drop-in does not clean a dist/ built
while it was present: Vite copies public/ into the output and only clears that
output when a build actually runs. Rebuild, or delete the stale directory.
Generated files and cross-file sync¶
-
The network endpoints page.
network-endpoints.mdlists every external host the app contacts, by hand. A change that adds one (a basemap, plugin, relay route inworkers/tiles, CDN asset, or default service), including amaplibre-gl-*bump that brings a new host, updates that page in the same PR and marks the host default or opt-in. -
Native PostGIS tile concurrency.
MAX_TILES_IN_FLIGHTinapps/geolibre-desktop/src/lib/postgis-tiles-url.tscaps tile requests per connection at the Rust pool size,POOL_SIZEinsrc-tauri/src/postgis_tiles.rs, so surplus tiles wait where MapLibre can still cancel them. Change both together;tests/postgis-tiles-url.test.tsreads the Rust constant and fails on drift. -
The open data gallery.
gallery.mdand the "Open data showcase" teaser ondemos.md(between the<!-- demo-gallery-teaser -->markers) are generated fromscripts/demo-gallery.json: the themes, the featured demos, and one entry per demo (slug, title, theme tag, caption, data credit). Edit the JSON, runnpm run gallery, and commit both files;npm run gallery:check(part ofnpm run ci) fails on drift. Each entry's screenshot must already be athttps://assets.geolibre.app/images/<slug>.webp(opengeos/geolibre-assets), and itsthemeshould match the tag on its share.geolibre.app project. - The built-in plugin reference. The table on
user-guide/plugins.md(between the<!-- plugin-reference:start/end -->markers) is generated byscripts/gen-plugin-reference.mjs. It reads the plugin list and order fromBUILT_IN_PLUGIN_METADATAinpackages/plugins/src/builtin-plugin-metadata.ts, including each plugin'sidandname, the display name fromen.json'stoolbar.plugin, the menu location fromPluginsMenu.tsxand theWEB_SERVICE_PLUGIN_IDS/DGGS_PLUGIN_IDSgroups, and the?plugin=link name from theplugin-deep-link.tsrules. Only the one-line description (and amenufor a pluginPluginsMenuhides) is hand-written, inscripts/plugin-reference.json. After registering, renaming, or regrouping a built-in plugin, add its entry, runnpm run plugins:docs, and commit both files.tests/plugin-reference-docs.test.tsandnpm run plugins:docs:check(part ofnpm run ci) fail on drift, and the generator itself fails on a registered plugin with no description. - Processing tool metadata. Names, descriptions, group labels, parameter
labels/help and select options live in registries with no i18n access, so the
dialogs resolve them through
apps/geolibre-desktop/src/lib/processing-tool-i18n.tsand fall back to the registry's own English string. For the four small bundled registries,en.json'sprocessing.toolMeta/processing.toolGroupsubtrees are the generated baseline translators work from. After adding or renaming one of those tools, parameters, or select options, runnpm run i18n:toolsand commit the result; CI fails on drift. Whitebox's much larger metadata is deliberately absent from all bundled locales and comes from optional, validated packs atlanguages.geolibre.app(or local file import); do not addprocessing.toolMeta.whitebox,processing.whitebox.categories,menuTool, ormenuSubcategoryback to a bundled locale. - The agent skill.
skills/geolibre/is a user-facing agent skill — aSKILL.mdplusreferences/that teaches an external AI agent to author.geolibre.jsonprojects throughgeolibre-mcp, the Python package, or hand-written JSON. It is not for contributors working on GeoLibre itself. It restates things that live elsewhere: the MCP tool surface (python/src/geolibre/mcp/server.py), the basemap/color-ramp/legend catalogs (python/src/geolibre/basemaps.py,color_ramp.py,legends.py), the project schema (Project Format), and the embed parameters (Embedding).python/tests/test_agent_skill.pyguards the parts that can be checked mechanically: every registered MCP tool must appear in the tool reference, every tool andMapmethod the skill names must exist, and the basemap, color-ramp, legend-preset, layer-type, frontmatter, and reference-file lists must match their sources. It cannot check prose, so a changed size cap, limit, or behavioral caveat still has to be carried over by hand — update the skill in the same PR. A stale caveat sends an agent down a path that no longer works, with no failure anywhere.